MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / get_table_oid

Method get_table_oid

lib/sqlalchemy/dialects/postgresql/base.py:3882–3898  ·  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

3880
3881 @reflection.cache
3882 def get_table_oid(self, connection, table_name, schema=None, **kw):
3883 """Fetch the oid for schema.table_name."""
3884 query = select(pg_catalog.pg_class.c.oid).where(
3885 pg_catalog.pg_class.c.relname == table_name,
3886 self._pg_class_relkind_condition(
3887 pg_catalog.RELKINDS_ALL_TABLE_LIKE
3888 ),
3889 )
3890 query = self._pg_class_filter_scope_schema(
3891 query, schema, scope=ObjectScope.ANY
3892 )
3893 table_oid = connection.scalar(query)
3894 if table_oid is None:
3895 raise exc.NoSuchTableError(
3896 f"{schema}.{table_name}" if schema else table_name
3897 )
3898 return table_oid
3899
3900 @reflection.cache
3901 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