(curs, table_name)
return res[0][0]
Find Postgres OID for table.
Find Postgres OID for table.
Find Postgres OID for table .
def get_table_oid(curs, table_name):
    """Find Postgres OID for table."""
    schema, name = fq_name_parts(table_name)
    q = """select c.oid from pg_namespace n, pg_class c
           where c.relnamespace = n.oid
             and n.nspname = %s and c.relname = %s"""
    curs.execute(q, [schema, name])
    res = curs.fetchall()
    if len(res) == 0:
        raise Exception('Table not found: '+table_name)
    return res[0][0]
def get_table_oid ( curs , table_name ) : schema , name = fq_name_parts ( table_name ) q = """select c.oid from pg_namespace n, pg_class c
           where c.relnamespace = n.oid
             and n.nspname = %s and c.relname = %s""" curs . execute ( q , [ schema , name ] ) res = curs . fetchall ( ) if len ( res ) == 0 : raise Exception ( 'Table not found: ' + table_name ) return res [ 0 ] [ 0 ]