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

Class MetaData

lib/sqlalchemy/sql/schema.py:5389–5959  ·  view source on GitHub ↗

A collection of :class:`_schema.Table` objects and their associated schema constructs. Holds a collection of :class:`_schema.Table` objects as well as an optional binding to an :class:`_engine.Engine` or :class:`_engine.Connection`. If bound, the :class:`_schema.Table` objects

Source from the content-addressed store, hash-verified

5387
5388
5389class MetaData(HasSchemaAttr):
5390 """A collection of :class:`_schema.Table`
5391 objects and their associated schema
5392 constructs.
5393
5394 Holds a collection of :class:`_schema.Table` objects as well as
5395 an optional binding to an :class:`_engine.Engine` or
5396 :class:`_engine.Connection`. If bound, the :class:`_schema.Table` objects
5397 in the collection and their columns may participate in implicit SQL
5398 execution.
5399
5400 The :class:`_schema.Table` objects themselves are stored in the
5401 :attr:`_schema.MetaData.tables` dictionary.
5402
5403 :class:`_schema.MetaData` is a thread-safe object for read operations.
5404 Construction of new tables within a single :class:`_schema.MetaData`
5405 object,
5406 either explicitly or via reflection, may not be completely thread-safe.
5407
5408 .. seealso::
5409
5410 :ref:`metadata_describing` - Introduction to database metadata
5411
5412 """
5413
5414 __visit_name__ = "metadata"
5415
5416 def __init__(
5417 self,
5418 schema: Optional[str] = None,
5419 quote_schema: Optional[bool] = None,
5420 naming_convention: Optional[_NamingSchemaParameter] = None,
5421 info: Optional[_InfoType] = None,
5422 ) -> None:
5423 """Create a new MetaData object.
5424
5425 :param schema:
5426 The default schema to use for the :class:`_schema.Table`,
5427 :class:`.Sequence`, and potentially other objects associated with
5428 this :class:`_schema.MetaData`. Defaults to ``None``.
5429
5430 .. seealso::
5431
5432 :ref:`schema_metadata_schema_name` - details on how the
5433 :paramref:`_schema.MetaData.schema` parameter is used.
5434
5435 :paramref:`_schema.Table.schema`
5436
5437 :paramref:`.Sequence.schema`
5438
5439 :param quote_schema:
5440 Sets the ``quote_schema`` flag for those :class:`_schema.Table`,
5441 :class:`.Sequence`, and other objects which make usage of the
5442 local ``schema`` name.
5443
5444 :param info: Optional data dictionary which will be populated into the
5445 :attr:`.SchemaItem.info` attribute of this object.
5446

Callers 15

test_reflectMethod · 0.90
test_reprMethod · 0.90
test_column_proxyMethod · 0.90
test_subquery_proxyMethod · 0.90
test_alias_proxyMethod · 0.90
t_fixtureMethod · 0.90
test_checkfirst_tableMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_reflectMethod · 0.72
test_reprMethod · 0.72
test_column_proxyMethod · 0.72
test_subquery_proxyMethod · 0.72
test_alias_proxyMethod · 0.72
t_fixtureMethod · 0.72
test_checkfirst_tableMethod · 0.72