MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _resolve_table_key

Method _resolve_table_key

lib/sqlalchemy/orm/clsregistry.py:448–470  ·  view source on GitHub ↗
(
        self, key: str, metadata: MetaData
    )

Source from the content-addressed store, hash-verified

446 self.tables_only = tables_only
447
448 def _resolve_table_key(
449 self, key: str, metadata: MetaData
450 ) -> Optional[Table]:
451 if metadata.schema is not None and "." not in key:
452 schema_key = _get_table_key(key, metadata.schema)
453 if schema_key in metadata.tables:
454 return metadata.tables[schema_key]
455 if key in metadata.tables:
456 util.warn_deprecated(
457 "The string '%s' was resolved to the "
458 "non-schema-qualified table '%s', however "
459 "the MetaData object has a default schema "
460 "of '%s'. In a future version of SQLAlchemy, "
461 "this unqualified name will be resolved as "
462 "'%s'. To reference a table without a "
463 "schema, use the Table object directly."
464 % (key, key, metadata.schema, schema_key),
465 "2.1",
466 )
467 return metadata.tables[key]
468 elif key in metadata.tables:
469 return metadata.tables[key]
470 return None
471
472 def _access_cls(self, key: str) -> Any:
473 cls = self.cls

Callers 1

_access_clsMethod · 0.95

Calls 1

_get_table_keyFunction · 0.85

Tested by

no test coverage detected