Logo Search packages:      
Sourcecode: sqlalchemy version File versions  Download package

sqlalchemy::schema::MetaData Class Reference

Inheritance diagram for sqlalchemy::schema::MetaData:

sqlalchemy::schema::SchemaItem sqlalchemy::schema::ThreadLocalMetaData

List of all members.


Detailed Description

A collection of Tables and their associated schema constructs.

Holds a collection of Tables and an optional binding to an ``Engine`` or
``Connection``.  If bound, the :class:`~sqlalchemy.schema.Table` objects
in the collection and their columns may participate in implicit SQL
execution.

The `Table` objects themselves are stored in the `metadata.tables`
dictionary.

The ``bind`` property may be assigned to dynamically.  A common pattern is
to start unbound and then bind later when an engine is available::

  metadata = MetaData()
  # define tables
  Table('mytable', metadata, ...)
  # connect to an engine later, perhaps after loading a URL from a
  # configuration file
  metadata.bind = an_engine

MetaData is a thread-safe object after tables have been explicitly defined
or loaded via reflection.

.. index::
  single: thread safety; MetaData

Definition at line 1714 of file schema.py.


Public Member Functions

def __contains__
def __getstate__
def __init__
def __repr__
def __setstate__
def append_ddl_listener
def bind
def clear
def create_all
def drop_all
def get_children
def info
def is_bound
def reflect
def remove
def sorted_tables

Public Attributes

 bind
 ddl_listeners
 metadata
 tables

Static Public Attributes

tuple bind = property(bind, _bind_to)
tuple ddl_events = ('before-create', 'after-create', 'before-drop', 'after-drop')
 quote = None

Private Member Functions

def _bind_to

Private Attributes

 _bind

Static Private Attributes

string __visit_name__ = 'metadata'

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index