src/dirbs/listgen/generator.py
def _allowed_delta_reasons(self, conn, tblname):
        """Utility function to generate the allowed delta reasons for a particular table."""
        with conn.cursor() as cursor:
            cursor.execute("""SELECT pg_get_expr(conbin, conrelid) AS consrc
                                FROM pg_constraint
                               WHERE conrelid = %s::regclass
                                 AND pg_get_expr(conbin, conrelid) LIKE '(delta_reason%%'""",
                           [tblname])
            result = cursor.fetchall()
            assert len(result) == 1
            constraint_src = result[0].consrc
            constraint_array_vals = re.sub(r'.*ARRAY\[(.*)\].*', r'\1', constraint_src)
            split_array_vals = constraint_array_vals.split(',')
            return [re.sub(r"\s*.*\'(.*)\'::text", r'\1', v) for v in split_array_vals]
Utility function to generate the allowed delta reasons for a particular table.
Utility function to generate the allowed delta reasons for a particular table.
Utility function to generate the allowed delta reasons for a particular table .
def _allowed_delta_reasons(self, conn, tblname):
        with conn.cursor() as cursor:
            cursor.execute("""SELECT pg_get_expr(conbin, conrelid) AS consrc
                                FROM pg_constraint
                               WHERE conrelid = %s::regclass
                                 AND pg_get_expr(conbin, conrelid) LIKE '(delta_reason%%'""",
                           [tblname])
            result = cursor.fetchall()
            assert len(result) == 1
            constraint_src = result[0].consrc
            constraint_array_vals = re.sub(r'.*ARRAY\[(.*)\].*', r'\1', constraint_src)
            split_array_vals = constraint_array_vals.split(',')
            return [re.sub(r"\s*.*\'(.*)\'::text", r'\1', v) for v in split_array_vals]
def _allowed_delta_reasons ( self , conn , tblname ) : with conn . cursor ( ) as cursor : cursor . execute ( """SELECT pg_get_expr(conbin, conrelid) AS consrc
                                FROM pg_constraint
                               WHERE conrelid = %s::regclass
                                 AND pg_get_expr(conbin, conrelid) LIKE '(delta_reason%%'""" , [ tblname ] ) result = cursor . fetchall ( ) assert len ( result ) == 1 constraint_src = result [ 0 ] . consrc constraint_array_vals = re . sub ( r'.*ARRAY\[(.*)\].*' , r'\1' , constraint_src ) split_array_vals = constraint_array_vals . split ( ',' ) return [ re . sub ( r"\s*.*\'(.*)\'::text" , r'\1' , v ) for v in split_array_vals ]
Utility function to generate the allowed delta reasons for a particular table.
Utility function to generate the allowed delta reasons for a particular table .
"""Utility function to generate the allowed delta reasons for a particular table."""
self
conn
tblname