• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1528)  |  Call(1186)  |  Derive(0)  |  Import(342)
Represent a table in a database.

e.g.::

    mytable = Table("mytable", metadata, 
                    Column('mytable_id', Integer, primary_key=True),
                    Column('value', String(50))
               )

The Table object constructs a unique instance of itself based on its
name within the given MetaData object.   Constructor
arguments are as follows:

:param name: The name of this table as represented in the database. 

    This property, along with the *schema*, indicates the *singleton
    identity* of this table in relation to its parent :class:`MetaData`.
    Additional calls to :class:`Table` with the same name, metadata,
    and schema name will return the same :class:`Table` object.

    Names which contain no upper case characters
    will be treated as case insensitive names, and will not be quoted
    unless they are a reserved word.  Names with any number of upper
    case characters will be quoted and sent exactly.  Note that this
    behavior applies even for databases which standardize upper 
    case names as case insensitive such as Oracle.

:param metadata: a :class:`MetaData` object which will contain this 
    table.  The metadata is used as a point of association of this table
    with other tables which are referenced via foreign key.  It also
    may be used to associate this table with a particular 
    :class:`~sqlalchemy.engine.base.Connectable`.

:param \*args: Additional positional arguments are used primarily
    to add the list of :class:`Column` objects contained within this
    table. Similar to the style of a CREATE TABLE statement, other
    :class:`.SchemaItem` constructs may be added here, including
    :class:`PrimaryKeyConstraint`, and :class:`ForeignKeyConstraint`.
    
:param autoload: Defaults to False: the Columns for this table should 
    be reflected from the database. Usually there will be no Column
    objects in the constructor if this property is set.

:param autoload_with: If autoload==True, this is an optional Engine 
    or Connection instance to be used for the table reflection. If
    ``None``, the underlying MetaData's bound connectable will be used.

:param implicit_returning: True by default - indicates that 
    RETURNING can be used by default to fetch newly inserted primary key 
    values, for backends which support this.  Note that 
    create_engine() also provides an implicit_returning flag.

:param include_columns: A list of strings indicating a subset of 
    columns to be loaded via the ``autoload`` operation; table columns who
    aren't present in this list will not be represented on the resulting
    ``Table`` object. Defaults to ``None`` which indicates all columns
    should be reflected.

:param info: A dictionary which defaults to ``{}``.  A space to store
    application specific data. This must be a dictionary.

:param mustexist: When ``True``, indicates that this Table must already 
    be present in the given :class:`MetaData`` collection.

:param prefixes:
    A list of strings to insert after CREATE in the CREATE TABLE
    statement.  They will be separated by spaces.

:param quote: Force quoting of this table's name on or off, corresponding
    to ``True`` or ``False``.  When left at its default of ``None``,
    the column identifier will be quoted according to whether the name is
    case sensitive (identifiers with at least one upper case character are 
    treated as case sensitive), or if it's a reserved word.  This flag 
    is only needed to force quoting of a reserved word which is not known
    by the SQLAlchemy dialect.

:param quote_schema: same as 'quote' but applies to the schema identifier.

:param schema: The *schema name* for this table, which is required if 
    the table resides in a schema other than the default selected schema
    for the engine's database connection. Defaults to ``None``.

:param useexisting: When ``True``, indicates that if this Table is already
    present in the given :class:`MetaData`, apply further arguments within
    the constructor to the existing :class:`Table`. If this flag is not
    set, an error is raised when the parameters of an existing
    :class:`Table` are overwritten.

src/r/e/reporter-lib-HEAD/packages/sqlalchemy/examples/large_collection/large_collection.py   reporter-lib(Download)
 
from sqlalchemy import (MetaData, Table, Column, Integer, String, ForeignKey,
                        create_engine)
from sqlalchemy.orm import (mapper, relationship, sessionmaker)
 
 
meta = MetaData()
 
org_table = Table('organizations', meta, 
    Column('org_id', Integer, primary_key=True),
    Column('org_name', String(50), nullable=False, key='name'),
    mysql_engine='InnoDB')
 
member_table = Table('members', meta,

src/s/q/sqlalchemy-HEAD/examples/large_collection/large_collection.py   sqlalchemy(Download)
 
from sqlalchemy import (MetaData, Table, Column, Integer, String, ForeignKey,
                        create_engine)
from sqlalchemy.orm import (mapper, relation, sessionmaker)
 
 
meta = MetaData()
 
org_table = Table('organizations', meta, 
    Column('org_id', Integer, primary_key=True),
    Column('org_name', String(50), nullable=False, key='name'),
    mysql_engine='InnoDB')
 
member_table = Table('members', meta,

src/r/e/reporter-lib-HEAD/packages/sqlalchemy/examples/vertical/dictlike-polymorphic.py   reporter-lib(Download)
 
 
if __name__ == '__main__':
    from sqlalchemy import (MetaData, Table, Column, Integer, Unicode,
        ForeignKey, UnicodeText, and_, not_, or_, String, Boolean, cast, text,
        null, case)
    from sqlalchemy.orm import mapper, relationship, create_session
    from sqlalchemy.orm.collections import attribute_mapped_collection
 
    metadata = MetaData()
 
    animals = Table('animal', metadata,
                    Column('id', Integer, primary_key=True),
                    Column('name', Unicode(100)))
 
    chars = Table('facts', metadata,
                  Column('animal_id', Integer, ForeignKey('animal.id'),
                         primary_key=True),
                  Column('key', Unicode(64), primary_key=True),

src/s/q/SQLAlchemy-0.6.4/examples/large_collection/large_collection.py   SQLAlchemy(Download)
 
from sqlalchemy import (MetaData, Table, Column, Integer, String, ForeignKey,
                        create_engine)
from sqlalchemy.orm import (mapper, relationship, sessionmaker)
 
 
meta = MetaData()
 
org_table = Table('organizations', meta, 
    Column('org_id', Integer, primary_key=True),
    Column('org_name', String(50), nullable=False, key='name'),
    mysql_engine='InnoDB')
 
member_table = Table('members', meta,

src/s/q/sqlalchemy-HEAD/examples/vertical/dictlike-polymorphic.py   sqlalchemy(Download)
 
 
if __name__ == '__main__':
    from sqlalchemy import (MetaData, Table, Column, Integer, Unicode,
        ForeignKey, UnicodeText, and_, not_, or_, String, Boolean, cast, text,
        null, case)
    from sqlalchemy.orm import mapper, relation, create_session
    from sqlalchemy.orm.collections import attribute_mapped_collection
 
    metadata = MetaData()
 
    animals = Table('animal', metadata,
                    Column('id', Integer, primary_key=True),
                    Column('name', Unicode(100)))
 
    chars = Table('facts', metadata,
                  Column('animal_id', Integer, ForeignKey('animal.id'),
                         primary_key=True),
                  Column('key', Unicode(64), primary_key=True),

src/a/t/atma-HEAD/trunk/examples/system/lib/classes/model.py   atma(Download)
engine = sa.create_engine(config.connectionURI)
metadata = sa.BoundMetaData(engine)
 
sa.Table('user', metadata,
    sa.Column('id', sa.Integer, primary_key=True),
    sa.Column('name', sa.String(16), nullable=False, unique=True),
    sa.Column('rfc2617_realm', sa.String(120), nullable=False),     # authentication realm

src/a/t/atma-HEAD/examples/system/lib/classes/model.py   atma(Download)
engine = sa.create_engine(config.connectionURI)
metadata = sa.BoundMetaData(engine)
 
sa.Table('user', metadata,
    sa.Column('id', sa.Integer, primary_key=True),
    sa.Column('name', sa.String(16), nullable=False, unique=True),
    sa.Column('rfc2617_realm', sa.String(120), nullable=False),     # authentication realm

src/s/q/SQLAlchemy-0.6.4/examples/vertical/dictlike-polymorphic.py   SQLAlchemy(Download)
 
 
if __name__ == '__main__':
    from sqlalchemy import (MetaData, Table, Column, Integer, Unicode,
        ForeignKey, UnicodeText, and_, not_, or_, String, Boolean, cast, text,
        null, case)
    from sqlalchemy.orm import mapper, relationship, create_session
    from sqlalchemy.orm.collections import attribute_mapped_collection
 
    metadata = MetaData()
 
    animals = Table('animal', metadata,
                    Column('id', Integer, primary_key=True),
                    Column('name', Unicode(100)))
 
    chars = Table('facts', metadata,
                  Column('animal_id', Integer, ForeignKey('animal.id'),
                         primary_key=True),
                  Column('key', Unicode(64), primary_key=True),

src/r/e/reporter-lib-HEAD/packages/sqlalchemy/examples/inheritance/single.py   reporter-lib(Download)
from sqlalchemy import MetaData, Table, Column, Integer, String, ForeignKey
from sqlalchemy.orm import mapper, relationship, create_session
 
metadata = MetaData('sqlite://')
metadata.bind.echo = 'debug'
 
# a table to store companies
companies = Table('companies', metadata, 
   Column('company_id', Integer, primary_key=True),
   Column('name', String(50)))
 
employees_table = Table('employees', metadata, 

src/s/q/sqlalchemy-HEAD/examples/inheritance/single.py   sqlalchemy(Download)
from sqlalchemy import MetaData, Table, Column, Integer, String, ForeignKey
from sqlalchemy.orm import mapper, relation, create_session
 
metadata = MetaData('sqlite://')
metadata.bind.echo = 'debug'
 
# a table to store companies
companies = Table('companies', metadata, 
   Column('company_id', Integer, primary_key=True),
   Column('name', String(50)))
 
employees_table = Table('employees', metadata, 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next