class documentation

class ThreadLocalMetaData(MetaData):

View In Hierarchy

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
def __init__(self):
Construct a ThreadLocalMetaData.
@util.preload_module('sqlalchemy.engine.url')
def _bind_to(self, bind):
Bind to a Connectable in the caller's thread.
def bind(self):

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().

def dispose(self):
Dispose all bound engines, in all thread contexts.
def is_bound(self):
True if there is a bind for this thread.
__visit_name__: str =
__engines: dict =

Undocumented

context =

Undocumented