MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / get_table_oid

Method get_table_oid

lib/sqlalchemy/dialects/postgresql/base.py:3735–3751  ·  view source on GitHub ↗

Fetch the oid for schema.table_name.

(self, connection, table_name, schema=None, **kw)

Source from the content-addressed store, hash-verified

3733
3734 @reflection.cache
3735 def get_table_oid(self, connection, table_name, schema=None, **kw):
3736 """Fetch the oid for schema.table_name."""
3737 query = select(pg_catalog.pg_class.c.oid).where(
3738 pg_catalog.pg_class.c.relname == table_name,
3739 self._pg_class_relkind_condition(
3740 pg_catalog.RELKINDS_ALL_TABLE_LIKE
3741 ),
3742 )
3743 query = self._pg_class_filter_scope_schema(
3744 query, schema, scope=ObjectScope.ANY
3745 )
3746 table_oid = connection.scalar(query)
3747 if table_oid is None:
3748 raise exc.NoSuchTableError(
3749 f"{schema}.{table_name}" if schema else table_name
3750 )
3751 return table_oid
3752
3753 @reflection.cache
3754 def get_schema_names(self, connection, **kw):

Callers 4

get_table_oidMethod · 0.45
test_get_table_oidMethod · 0.45
test_pg_indexMethod · 0.45
test_pg_constraintMethod · 0.45

Calls 5

selectFunction · 0.90
whereMethod · 0.45
scalarMethod · 0.45

Tested by 3

test_get_table_oidMethod · 0.36
test_pg_indexMethod · 0.36
test_pg_constraintMethod · 0.36