def table_invariants_list(conn, table_names, invariant_col_names):
    'Gets a list of tuples containing the values for common table invariant columns across a list table names.'
    if (len(table_names) == 0):
        return []
    with conn.cursor() as cursor:
        table_queries = []
        for tblname in table_names:
            table_queries.append(sql.SQL('SELECT * FROM (SELECT {0} FROM {1} LIMIT 1) {2}').format(sql.SQL(', ').join(map(sql.Identifier, invariant_col_names)), sql.Identifier(tblname), sql.Identifier('tmp_{0}'.format(tblname))))
        cursor.execute(sql.SQL(' UNION ALL ').join(table_queries))
        return cursor.fetchall()
Gets a list of tuples containing the values for common table invariant columns across a list table names.
def table_invariants_list(conn, table_names, invariant_col_names):
    
    if (len(table_names) == 0):
        return []
    with conn.cursor() as cursor:
        table_queries = []
        for tblname in table_names:
            table_queries.append(sql.SQL('SELECT * FROM (SELECT {0} FROM {1} LIMIT 1) {2}').format(sql.SQL(', ').join(map(sql.Identifier, invariant_col_names)), sql.Identifier(tblname), sql.Identifier('tmp_{0}'.format(tblname))))
        cursor.execute(sql.SQL(' UNION ALL ').join(table_queries))
        return cursor.fetchall()