class ThreadLocalMetaData(MetaData):
A MetaData variant that presents a different bind in every thread.
Makes the bind property of the MetaData a thread-local value, allowing this collection of tables to be bound to different Engine implementations or connections in each thread.
The ThreadLocalMetaData starts off bound to None in each thread. Binds must be made explicitly by assigning to the bind property or using connect(). You can also re-bind dynamically multiple times per thread, just like a regular MetaData.
Method | __init__ |
Construct a ThreadLocalMetaData. |
Method | _bind_to |
Bind to a Connectable in the caller's thread. |
Method | bind |
The bound Engine or Connection for this thread. |
Method | dispose |
Dispose all bound engines, in all thread contexts. |
Method | is_bound |
True if there is a bind for this thread. |
Class Variable | __visit_name__ |
Undocumented |
Instance Variable | __engines |
Undocumented |
Instance Variable | context |
Undocumented |
Inherited from MetaData
:
Method | __contains__ |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | _add_table |
Undocumented |
Method | _remove_table |
Undocumented |
Method | clear |
Clear all Table objects from this MetaData. |
Method | create_all |
Create all tables stored in this metadata. |
Method | drop_all |
Drop all tables stored in this metadata. |
Method | reflect |
Load all available table definitions from the database. |
Method | remove |
Remove the given Table object from this MetaData. |
Instance Variable | _bind |
Undocumented |
Instance Variable | _fk_memos |
Undocumented |
Instance Variable | _schemas |
Undocumented |
Instance Variable | _sequences |
Undocumented |
Instance Variable | info |
Info dictionary associated with the object, allowing user-defined
data to be associated with this .SchemaItem . |
Instance Variable | naming_convention |
Undocumented |
Instance Variable | schema |
Undocumented |
Instance Variable | tables |
A dictionary of _schema.Table objects keyed to their name or "table key". |
Property | sorted_tables |
Returns a list of _schema.Table objects sorted in order of foreign key dependency. |
Inherited from SchemaItem
(via MetaData
):
Method | _init_items |
Initialize the list of child items for this SchemaItem. |
Method | _schema_item_copy |
Undocumented |
Class Variable | _use_schema_map |
Undocumented |
Class Variable | create_drop_stringify_dialect |
Undocumented |
Inherited from SchemaEventTarget
(via MetaData
, SchemaItem
):
Method | _set_parent |
Associate with this SchemaEvent's parent object. |
Method | _set_parent_with_dispatch |
Undocumented |
Inherited from Traversible
(via MetaData
, SchemaItem
):
Method | get_children |
Return immediate child .visitors.Traversible elements of this .visitors.Traversible . |
Method | __class_getitem__ |
Undocumented |
sqlalchemy.sql.schema.MetaData.__init__
sqlalchemy.sql.schema.MetaData._bind_to
sqlalchemy.sql.schema.MetaData.bind
The bound Engine or Connection for this thread.
This property may be assigned an Engine or Connection, or assigned a string or URL to automatically create a basic Engine for this bind with create_engine().
sqlalchemy.sql.schema.MetaData.is_bound