Ñò Š„[Jc@sšdZddkZddkZddklZlZlZlZddkl Z l Z e a ddddd d d d d dddddddddddgZ e iƒde ifd„ƒYZd„Zde ifd„ƒYZdee ifd„ƒYZdee ifd„ƒYZdefd„ƒYZdefd „ƒYZdefd!„ƒYZd efd"„ƒYZdefd#„ƒYZdefd$„ƒYZeZdefd%„ƒYZ d e fd&„ƒYZ!d e fd'„ƒYZ"d e fd(„ƒYZ#de fd)„ƒYZ$d efd*„ƒYZ%defd+„ƒYZ&de&fd,„ƒYZ'de i(fd-„ƒYZ)defd.„ƒYZ*d/„Z+d0„Z,dS(1s1The schema module provides the building blocks for database metadata. Each element within this module describes a database entity which can be created and dropped, or is otherwise part of such an entity. Examples include tables, columns, sequences, and indexes. All entities are subclasses of :class:`~sqlalchemy.schema.SchemaItem`, and as defined in this module they are intended to be agnostic of any vendor-specific constructs. A collection of entities are grouped into a unit called :class:`~sqlalchemy.schema.MetaData`. MetaData serves as a logical grouping of schema elements, and can also be associated with an actual database connection such that operations involving the contained elements can contact the database as needed. Two of the elements here also build upon their "syntactic" counterparts, which are defined in :class:`~sqlalchemy.sql.expression.`, specifically :class:`~sqlalchemy.schema.Table` and :class:`~sqlalchemy.schema.Column`. Since these objects are part of the SQL expression language, they are usable as components in SQL expressions. iÿÿÿÿN(ttypestexctutilt databases(t expressiontvisitorst SchemaItemtTabletColumnt ForeignKeytSequencetIndextForeignKeyConstrainttPrimaryKeyConstrainttCheckConstrainttUniqueConstrainttDefaultGeneratort ConstrainttMetaDatatThreadLocalMetaDatat SchemaVisitortPassiveDefaultt DefaultClauset FetchedValuet ColumnDefaulttDDLcBs\eZdZdZdZd„Zd„Zd„Zd„Z e d„ƒZ e d„ƒZ RS( s3Base class for items that define a database schema.t schema_itemcGs3x,|D]$}|dj o|i|ƒqqWdS(s7Initialize the list of child items for this SchemaItem.N(tNonet _set_parent(tselftargstitem((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt _init_items1s cCs tƒ‚dS(s/Associate with this SchemaItem's parent object.N(tNotImplementedError(Rtparent((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR8scKsgS(s"used to allow SchemaVisitor access((Rtkwargs((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt get_children=scCsd|iiS(Ns%s()(t __class__t__name__(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__repr__AscCs|i}|o |ipdS(s7Return the connectable associated with this SchemaItem.N(tmetadatatbindR(Rtm((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR)Ds cCs2y |iSWn tj oh|_|iSXdS(N(t_infotAttributeError(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytinfoKs   N( R&t __module__t__doc__t__visit_name__RtquoteR RR$R'tpropertyR)R-(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR+s    cCs"|djo|S|d|SdS(Nt.(R(tnametschema((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt_get_table_keyTs t_TableSingletoncBseZdZd„ZRS(sGA metaclass used by the ``Table`` object to provide singleton behavior.c Os(|id|iddƒƒ}|idtƒ}|idtƒ}t||ƒ}yW|i|} | o*| i||Žotid|ƒ‚n| i ||Ž| SWnyt j om|otid|ƒ‚nyt i |||||ŽSWq$||ijo|i|=n‚q$XnXdS(NR5townert useexistingt mustexists’Table '%s' is already defined for this MetaData instance. Specify 'useexisting=True' to redefine options and columns on an existing Table object.sTable '%s' not defined( tgetRtpoptFalseR6ttablest_cant_overrideRtInvalidRequestErrort_init_existingtKeyErrorttypet__call__( RR4R(RR#R5R9R:tkeyttable((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRD]s, (R&R.R/RD(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR7ZscBsøeZdZeZdZdZd„Zd„Zd„Z d „Z d „Z e d „ƒZ d „Zd „Ze eeƒZd„Zd„Zd„Zd„Zd„Zd„Zeed„Zdd„Zded„Zded„Zdd„ZRS(s Represent a table in a database.RFs before-creates after-creates before-drops after-dropcOsátt|ƒi|ƒ||_|id|idd ƒƒ|_tƒ|_tƒ|_ t i ƒ|_ t ƒ|_tiƒ|_titƒ|_h|_|id j od|i|if|_n |i|_|idtƒ}|idd ƒ}|idd ƒ}|i|ƒ|idd ƒ|_|idd ƒ|_|id ƒo|id ƒ|_n|id gƒ|_|i||o;|o|i |d|ƒqÍt!|ƒi |d|ƒn|i"||Žd S( sÛ Construct a Table. :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 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. R5R8s%s.%stautoloadt autoload_withtinclude_columnsR1t quote_schemaR-tprefixesN(#tsuperRt__init__R(R<RR5tsettindexest constraintsRtColumnCollectiont_columnsR t primary_keyRt OrderedSett _foreign_keyst defaultdicttlistt ddl_listenersR#R4tfullnameR=RR1RJR;R+t _prefixest_Table__extra_kwargst reflecttablet_bind_or_errort_Table__post_init(RR4R(RR#RGRHRI((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMs8K !       c Os@|idtƒ}|iddƒ}|iddƒ}|o/||ijotid|i|fƒ‚n|iddƒ}|o<x9|iD]*}|i|jo|ii|ƒqqWnx8d D]0}||jot |||i|ƒƒqÈqÈWd|jo|idƒ|_ n|i ||i ||ŽdS( NRGRHR5s7Can't change schema of existing table from '%s' to '%s'RIR1RJR-(squotes quote_schema( R<R=RR5Rt ArgumentErrortcR4tremovetsetattrR+R[R^( RRR#RGRHR5RIR`RE((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRA÷s*  !  cOs2t|ƒp%tt|ƒiddddgƒƒS(sðReturn True if any argument is not supported as an override. Takes arguments that would be sent to Table.__init__, and returns True if any of them would be disallowed if sent to an existing Table singleton. RGRHR5R8(tboolRNt difference(RRR#((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR?scKsƒtg}|D]4}tidditiƒ|ƒp ||qq~ƒo tdt|iƒƒƒ‚n|i i |ƒdS(Ns^(?:%s)_t|s!Invalid argument(s) for Table: %s( tlentretmatchtjoinRt__all__t TypeErrortreprtkeysR#tupdate(RR#t_[1]tk((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__extra_kwargss ;cOs|i|ŒdS(N(R (RRR#((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt __post_init"scCst|i|iƒS(N(R6R4R5(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRE%scCsPt|ddƒ|ijo|ii|iƒn||_|ii|ƒdS(Nt _primary_key(tgetattrRRPRaRstadd(Rtpk((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt_set_primary_key)s cCs|iS(N(Rs(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRS/scCsddit|iƒgt|iƒgg}|iD]}|t|ƒq6~g}dgD]&}|d|tt||ƒƒfq^~ƒS(Ns Table(%s)s, R5s%s=%s(RiRlR4R(tcolumnsRt(RRotxt_[2]Rp((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'3s GcCst|i|iƒS(N(R6t descriptionR5(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__str__9scCs|i|ƒdS(s&Append a ``Column`` to this ``Table``.N(R(Rtcolumn((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt append_column<scCs|i|ƒdS(s*Append a ``Constraint`` to this ``Table``.N(R(Rt constraint((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytappend_constraintAscCs8||ijot|ƒ‚n|i|i|ƒdS(sMAppend a DDL event listener to this ``Table``. The ``listener`` callable will be triggered when this ``Table`` is created or dropped, either directly before or after the DDL is issued to the database. The listener may modify the Table, but may not abort the event itself. Arguments are: event One of ``Table.ddl_events``; e.g. 'before-create', 'after-create', 'before-drop' or 'after-drop'. listener A callable, invoked with three positional arguments: event The event currently being handled schema_item The ``Table`` object being created or dropped bind The ``Connection`` bueing used for DDL execution. Listeners are added to the Table's ``ddl_listeners`` attribute. N(t ddl_eventst LookupErrorRXtappend(Rteventtlistener((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytappend_ddl_listenerFscCs)||it|i|iƒ<||_dS(N(R>R6R4R5R((RR(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRescKsS|ptii|d||S|o#g}|iD] }||q6~SgSdS(Ntcolumn_collections(Rt TableClauseR$Rx(RR‡tschema_visitorR#RoR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR$is  #cs9|djotˆƒ}n‡fd†}|i|ƒS(s!Return True if this table exists.cs|ii|ˆidˆiƒS(NR5(tdialectt has_tableR4R5(tconn(R(s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytdoysN(RR]t run_callable(RR)R((Rs5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytexistsss cCs&|iid|d|d|gƒdS(sbIssue a ``CREATE`` statement for this table. See also ``metadata.create_all()``. R)t checkfirstR>N(R(t create_all(RR)R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytcreate}scCs&|iid|d|d|gƒdS(s^Issue a ``DROP`` statement for this table. See also ``metadata.drop_all()``. R)RR>N(R(tdrop_all(RR)R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytdrop„sc CsÅy5|p |i}nt|i|ƒ}|i|SWn‰tj o}g}x*|iD]}|i|id|ƒƒqVWx*|iD]}|i|id|ƒƒqƒWt |i|d||ŒSXdS(sIReturn a copy of this ``Table`` associated with a different ``MetaData``.R5N( R5R6R4R>RBRxRƒtcopyRPR(RR(R5RERR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt tometadata‹s   (s before-creates after-creates before-drops after-dropN(R&R.R/R7t __metaclass__R0RRMRAR?R[R^R2RERwRSR'R|R~R€R†RtTrueR=R$RRR’R”R–(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRxs0 v            cBszeZdZdZd„Zd„Zed„ƒZd„Zd„Z d„Z d„Z d „Z d d „Zed „ZRS( s(Represents a column in a database table.R}cOs­|iddƒ}|iddƒ}|oWt|ƒ}t|dtƒo3|dj otidƒ‚n|idƒ}q‚n|o˜|d}ti|ƒo|dƒ}nt|t i ƒp#t|t ƒoFt |t i ƒo3|dj otidƒ‚n|idƒ}q!nt t|ƒi|d|ƒ||_|id|ƒ|_|idtƒ|_|id|i ƒ|_|id dƒ|_|id dƒ|_|id dƒ|_|id dƒ|_|id dƒ|_|iddƒ|_|iddƒ|_|idtƒ|_tƒ|_ti ƒ|_!ti"|ƒ|i#dƒo|idƒ|_$n|o#tidt%|i&ƒƒƒ‚ndS(sv Construct a new ``Column`` object. :param name: The name of this column as represented in the database. This argument may be the first positional argument, or specified via keyword. 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. The name field may be omitted at construction time and applied later, at any time before the Column is associated with a :class:`Table`. This is to support convenient usage within the :mod:`~sqlalchemy.ext.declarative` extension. :param type\_: The column's type, indicated using an instance which subclasses :class:`~sqlalchemy.types.AbstractType`. If no arguments are required for the type, the class of the type can be sent as well, e.g.:: # use a type with arguments Column('data', String(50)) # use no arguments Column('level', Integer) The ``type`` argument may be the second positional argument or specified by keyword. If this column also contains a :class:`ForeignKey`, the type argument may be left as ``None`` in which case the type assigned will be that of the referenced column. :param \*args: Additional positional arguments include various :class:`SchemaItem` derived constructs which will be applied as options to the column. These include instances of :class:`Constraint`, :class:`ForeignKey`, :class:`ColumnDefault`, and :class:`Sequence`. In some cases an equivalent keyword argument is available such as ``server_default``, ``default`` and ``unique``. :param autoincrement: This flag may be set to ``False`` to disable SQLAlchemy indicating at the DDL level that an integer primary key column should have autoincrementing behavior. This is an oft misunderstood flag and has no effect whatsoever unless all of the following conditions are met: * The column is of the :class:`~sqlalchemy.types.Integer` datatype. * The column has the ``primary_key`` flag set, or is otherwise a member of a :class:`PrimaryKeyConstraint` on this table. * a CREATE TABLE statement is being issued via :meth:`create()` or :meth:`create_all()`. The flag has no relevance at any other time. * The database supports autoincrementing behavior, such as PostgreSQL or MySQL, and this behavior can be disabled (which does not include SQLite). :param default: A scalar, Python callable, or :class:`~sqlalchemy.sql.expression.ClauseElement` representing the *default value* for this column, which will be invoked upon insert if this column is otherwise not specified in the VALUES clause of the insert. This is a shortcut to using :class:`ColumnDefault` as a positional argument. Contrast this argument to ``server_default`` which creates a default generator on the database side. :param key: An optional string identifier which will identify this ``Column`` object on the :class:`Table`. When a key is provided, this is the only identifier referencing the ``Column`` within the application, including ORM attribute mapping; the ``name`` field is used only when rendering SQL. :param index: When ``True``, indicates that the column is indexed. This is a shortcut for using a :class:`Index` construct on the table. To specify indexes with explicit names or indexes that contain multiple columns, use the :class:`Index` construct instead. :param info: A dictionary which defaults to ``{}``. A space to store application specific data. This must be a dictionary. :param nullable: If set to the default of ``True``, indicates the column will be rendered as allowing NULL, else it's rendered as NOT NULL. This parameter is only used when issuing CREATE TABLE statements. :param onupdate: A scalar, Python callable, or :class:`~sqlalchemy.sql.expression.ClauseElement` representing a default value to be applied to the column within UPDATE statements, which wil be invoked upon update if this column is not present in the SET clause of the update. This is a shortcut to using :class:`ColumnDefault` as a positional argument with ``for_update=True``. :param primary_key: If ``True``, marks this column as a primary key column. Multiple columns can have this flag set to specify composite primary keys. As an alternative, the primary key of a :class:`Table` can be specified via an explicit :class:`PrimaryKeyConstraint` object. :param server_default: A :class:`FetchedValue` instance, str, Unicode or :func:`~sqlalchemy.sql.expression.text` construct representing the DDL DEFAULT value for the column. String types will be emitted as-is, surrounded by single quotes:: Column('x', Text, server_default="val") x TEXT DEFAULT 'val' A :func:`~sqlalchemy.sql.expression.text` expression will be rendered as-is, without quotes:: Column('y', DateTime, server_default=text('NOW()'))0 y DATETIME DEFAULT NOW() Strings and text() will be converted into a :class:`DefaultClause` object upon initialization. Use :class:`FetchedValue` to indicate that an already-existing column will generate a default value on the database side which will be available to SQLAlchemy for post-fetch after inserts. This construct does not specify any DDL and the implementation is left to the database, such as via a trigger. :param server_onupdate: A :class:`FetchedValue` instance representing a database-side default generation function. This indicates to SQLAlchemy that a newly generated value will be available after updates. This construct does not specify any DDL and the implementation is left to the database, such as via a trigger. :param quote: Force quoting of this column'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 unique: When ``True``, indicates that this column contains a unique constraint, or if ``index`` is ``True`` as well, indicates that the :class:`Index` should be created with the unique flag. To specify multiple columns in the constraint/index or to specify an explicit name, use the :class:`UniqueConstraint` or :class:`Index` constructs explicitly. R4ttype_is0May not pass name positionally and as a keyword.s1May not pass type_ positionally and as a keyword.RERStnullabletdefaulttserver_defaulttserver_onupdatetindextuniqueR1tonupdatet autoincrementR-s$Unknown arguments passed to Column: N('R<RRWt isinstancet basestringRR_RtcallableRt AbstractTypeRCt issubclassRLRRMRRER=RSRšR›RœRRžRŸR1R R˜R¡RNRPRTt foreign_keystset_creation_orderR;R+RlRm(RRR#R4R™tcoltype((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM sR”         cCs^|idjodS|idj o.|iio|iid|iS|iSn|iSdS(Ns (no name)R3(R4RRFtnamed_with_columnR{(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR|cs  cCs |iiS(N(RFR)(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR)nscCs4x-|iD]}|i|iƒotSq WtSdS(sGReturn True if this Column references the given column via foreign key.N(R§t referencesRFR˜R=(RR}tfk((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR«rs   cCs|i|ƒdS(N(R(RR¬((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytappend_foreign_keyzscCs™g}|i|ijo|idƒn|io|idƒn|ip|idƒn|io|idƒn|io|idƒn|io|idƒnddit |iƒgt |i ƒgg}|i D]$}|dj o|t |ƒqçqç~g}|i D]}|t |ƒq ~|iod |iipd gg}|D]&}|d |t t||ƒƒfqg~ƒS( NRERSRšR R›Rœs Column(%s)s, s table=<%s>ts%s=%s(RER4RƒRSRšR R›RœRiRlRCR§RRPRFR{Rt(RtkwargRoRyRzt_[3]Rp((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'}s       ¢cCs|idjotidƒ‚n|idjo|i|_n|i|_t|ddƒdj otidƒ‚n|i|ijo|ii|iƒ|_ n|ii |ƒ|i o|i i |ƒn7|i|i jo#tid|i|i fƒ‚n||_ |ioGt|itƒotidƒ‚ntd|i|d|iƒnK|io@t|itƒotidƒ‚n|it|iƒƒnt|iƒ}|idj oAt|itƒo|i|iƒq|it|iƒƒn|idj oAt|itƒo|i|iƒqc|it|iƒƒn|idj o |it|id tƒƒn|i dj oGt|i tƒo|i|iƒqê|it|i d tƒƒn|i!|Œd|_dS( NsPColumn must be constructed with a name or assign .name before adding to a Table.RFs this Column already has a table!sTTrying to redefine primary-key column '%s' as a non-primary-key column on table '%s's–The 'index' keyword argument on Column is boolean only. To create indexes with a specific name, create an explicit Index object external to the Table.six_%sRŸsõThe 'unique' keyword argument on Column is boolean only. To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint to the Table's list of elements, or create an explicit Index object external to the Table.t for_update("R4RRR_RER(RtRRR;t_pre_existing_columntreplaceRSRYRFRžR¢R£R t_labelRŸR€RRWRR›RRƒRœRRR R˜RR (RRFttoinit((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR’s\      !    cKsyt|i|i|id|id|id|id|id|id|i g}|i D]}||i |qY~ŒS(sgCreate a copy of this ``Column``, unitialized. This is used in ``Table.tometadata``. RERSRšR1RžR¡( RR4RCR›RERSRšR1RžR¡RPR•(RtkwRoR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•ÔscCsìg}|iD]}|t|iƒq~}t|p|i|i|id|p|id|id|i d|i |Œ}||_ |g|_ |i i|ƒ|io|ii|ƒng}|D]}||i|ƒqË~|S(s§Create a *proxy* for this column. This is a copy of this ``Column`` referenced by a different parent (such as an alias or select statement). RERSRšR1(R§R R}RR4RCR›RERSRšR1RFtproxiesRxRuR (Rt selectableR4RotfR¬R`Rz((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt _make_proxyÜs -       (cKsu|oWg}|i|ifD]}|dj o ||qq~t|iƒt|iƒStii||SdS(N( R›R RRWR§RPRt ColumnClauseR$(RR‰R#RoRy((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR$ôsWN(R&R.R/R0RMR|R2R)R«R­R'RR•RRºR=R$(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR›s à     B  c BseZdZdZd ed d d d d ed„Zd„Zd d„Zd d„Z e e ƒZ d„Z d„Z eid„ƒZd „ZRS( sDefines a column-level FOREIGN KEY constraint between two columns. ``ForeignKey`` is specified as an argument to a :class:`Column` object, e.g.:: t = Table("remote_table", metadata, Column("remote_id", ForeignKey("main_table.id")) ) For a composite (multiple column) FOREIGN KEY, use a :class:`ForeignKeyConstraint` object specified at the level of the :class:`Table`. Further examples of foreign key configuration are in :ref:`metadata_foreignkeys`. t foreign_keyc CsU||_||_||_||_||_||_||_||_| |_dS(s> Construct a column-level FOREIGN KEY. :param column: A single target column for the key relationship. A :class:`Column` object or a column name as a string: ``tablename.columnkey`` or ``schema.tablename.columnkey``. ``columnkey`` is the ``key`` which has been assigned to the column (defaults to the column name itself), unless ``link_to_name`` is ``True`` in which case the rendered name of the column is used. :param constraint: Optional. A parent :class:`ForeignKeyConstraint` object. If not supplied, a :class:`ForeignKeyConstraint` will be automatically created and added to the parent table. :param name: Optional string. An in-database name for the key if `constraint` is not provided. :param onupdate: Optional string. If set, emit ON UPDATE when issuing DDL for this constraint. Typical values include CASCADE, DELETE and RESTRICT. :param ondelete: Optional string. If set, emit ON DELETE when issuing DDL for this constraint. Typical values include CASCADE, DELETE and RESTRICT. :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. :param initially: Optional string. If set, emit INITIALLY when issuing DDL for this constraint. :param link_to_name: if True, the string name given in ``column`` is the rendered name of the referenced column, not its locally assigned ``key``. :param use_alter: If True, do not emit this key as part of the CREATE TABLE definition. Instead, use ALTER TABLE after table creation to add the key. Useful for circular dependencies. N( t_colspecRt use_alterR4R tondeletet deferrablet initiallyt link_to_name( RR}RR¾R4R R¿RÀRÁRÂ((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMs(        cCsd|iƒS(NsForeignKey(%r)(t _get_colspec(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'@scCst|id|ƒƒS(s)Produce a copy of this ForeignKey object.R5(R RÃ(RR5((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•CscCsŒ|o$|d|iiid|iiSt|itƒo|iSt|idƒo|iiƒ}n |i}d|ii |ifS(NR3t__clause_element__s%s.%s( R}RFR4RER¢R½R£thasattrRÄRY(RR5t_column((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRÃHs$ cCs|i|iƒdj S(s@Return True if the given table is referenced by this ForeignKey.N(tcorresponding_columnR}R(RRF((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR«VscCs|i|iƒS(sžReturn the column in the given table referenced by this ForeignKey. Returns None if this ``ForeignKey`` does not reference the given table. (RÇR}(RRF((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt get_referentZsc Cs‰t|itƒoxN|iiD]$}t|tƒo|i}Pq q Wtidt |iƒƒ‚|ii dƒ}|djotid|iƒ‚nd \}}}t |ƒdjo|i ƒ}n|i ƒ}|i ƒ}t |ƒdjodi|ƒ}nt||ƒ|ijotid|ƒ‚nt||idtd|ƒ}d}|djo(|i} |ii|iidƒ}n^|io8|} xJ|iD] }|i|jo |}q°q°Wn|} |ii|dƒ}|p,tid |i|i|i| fƒ‚qYn0t|id ƒo|iiƒ}n |i}t|iitiƒo|i|i_n|S( Ns@Parent column '%s' does not descend from a table-attached ColumnR3s,Invalid foreign key column specification: %siis>Could not find table '%s' with which to generate a foreign keyR:R5sSCould not create ForeignKey '%s' on table '%s': table '%s' has no column named '%s'RÄ(NNN(R¢R½R£R"t base_columnsRRFRR_tstrtsplitRRfR<RiR6R(tNoReferencedTableErrorRR˜R`R;RERÂR4tNoReferencedColumnErrorRÅRÄRCRtNullType( RR`t parenttableR*R5ttnametcolnameRFRÆRE((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR}csb           ' cCsht|dƒotidƒ‚n||_t|idƒodxa|iiiD]L}|i|ijo3|iiii|ƒ|iii i|i ƒqOqOWn|i djoˆt |iit ƒortggd|id|id|id|id|id |iƒ|_ |iii|i ƒ|i i|ƒn|iii|ƒ|iiii|ƒdS( NR"s&This ForeignKey already has a parent !R²R¾R4R R¿RÀRÁ(RÅRR@R"R²R§ttarget_fullnameRFRaRPRRR¢RR R¾R4R R¿RÀRÁR€t _append_fkRu(RR}R¬((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR·s$ %&N(R&R.R/R0RR=RMR'R•RÃR2RÒR«RÈRtmemoized_propertyR}R(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR üs!2     TcBsAeZdZdZedd„Zd„Zdd„Zd„Z RS(s'Base class for column *default* values.tdefault_generatorcCs1||_ti|ttdƒfdƒ|_dS(NR((R±Rtassert_arg_typeRRCRR((RR±R(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMÓs cCsE||_|iii|_|io||i_n ||i_dS(N(R}RFR(R±R R›(RR}((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR×s   cKs-|djot|ƒ}n|i||S(N(RR]t_execute_default(RR)R#((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytexecuteßs cCsdS(NsDefaultGenerator()((R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'äsN( R&R.R/R0R=RRMRRØR'(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRÎs   cBs>eZdZd„Zd„Zd„ZeeƒZd„ZRS(swA plain default value on a column. This could correspond to a constant, a callable function, or a SQL clause. cKsitt|ƒi|t|tƒotidƒ‚nti|ƒo|i |ƒ}n||_ dS(Ns4ColumnDefault may not be a server-side default type.( RLRRMR¢RRR_RR¤t_maybe_wrap_callabletarg(RRÚR#((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMîs cs&tiˆƒo ˆ}nAtiˆƒo ˆi}n$tˆdƒo ˆi}nˆ}yti|ƒ}Wntj o‡fd†SXt|dƒ}ti |ƒo|d8}n|djo‡fd†S|ddj ot|dƒpd}||djot i dƒ‚nˆS( s<Backward compat: Wrap callables that don't accept a context.RDcsˆƒS(((tctx(tfn(s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytsiicsˆƒS(((RÛ(RÜ(s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRÝ sisDColumnDefault Python function takes zero or one positional argumentsN( tinspectt isfunctiontisclassRMRÅRDt getargspecRkRftismethodRRR_(RRÜt inspectabletargspect positionalst defaulted((RÜs5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRÙ÷s*    ( cCs|iodSdSdS(Ntcolumn_onupdatetcolumn_default(R±(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt _visit_names cCsdt|iƒS(NsColumnDefault(%s)(RlRÚ(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR's( R&R.R/RMRÙRéR2R0R'(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRès    cBs\eZdZdZdddedd„Zd„Zd„Zde d„Z de d„Z RS(s%Represents a named database sequence.tsequencecKsYtt|ƒi|||_||_||_||_||_||_||_ dS(N( RLR RMR4tstartt incrementtoptionalR1R5R#(RR4RëRìR5RíR1R#((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM%s      c Cs^ddit|iƒgg}dddgD]&}|d|tt||ƒƒfq,~ƒS(Ns Sequence(%s)s, RëRìRís%s=%s(RiRlR4Rt(RRoRp((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'0s cCs#tt|ƒi|ƒ||_dS(N(RLR RRê(RR}((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR6scCs4|djot|ƒ}n|i|d|ƒdS(s&Creates this sequence in the database.RN(RR]R’(RR)R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR’:s cCs4|djot|ƒ}n|i|d|ƒdS(s&Drops this sequence from the database.RN(RR]R”(RR)R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR”As N( R&R.R/R0RR=RMR'RR˜R’R”(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR s   cBs,eZdZed„Zd„Zd„ZRS(s1A default that takes effect on the database side.cCs ||_dS(N(R±(RR±((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMLscCs3||_|io||i_n ||i_dS(N(R}R±RRœ(RR}((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyROs  cCs d|iS(NsFetchedValue(for_update=%r)(R±(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'Vs(R&R.R/R=RMRR'(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRIs  cBs#eZdZed„Zd„ZRS(s%A DDL-specified DEFAULT column value.cCsEti|ttitifdƒtt|ƒi|ƒ||_ dS(NRÚ( RRÖR£Rt ClauseElementt _TextClauseRLRRMRÚ(RRÚR±((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM]s  cCsd|i|ifS(Ns DefaultClause(%r, for_update=%r)(RÚR±(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'ds(R&R.R/R=RMR'(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRZs cBseeZdZdZd d d d„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z RS( s–A table-level SQL constraint, such as a KEY. Implements a hybrid of dict/setlike behavior with regards to the list of underying columns. RcCs.||_tiƒ|_||_||_dS(svCreate a SQL constraint. name Optional, the in-database name of this ``Constraint``. deferrable Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. initially Optional string. If set, emit INITIALLY when issuing DDL for this constraint. N(R4RRQRxRÀRÁ(RR4RÀRÁ((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMts  cCs ||ijS(N(Rx(RRy((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt __contains__ˆscCs|ii|ƒS(N(Rxtcontains_column(Rtcol((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRñ‹scCs |iiƒS(N(RxRm(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRmŽscCs |i|S(N(Rx(Rtother((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__add__‘scCs t|iƒS(N(titerRx(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__iter__”scCs t|iƒS(N(RfRx(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__len__—scKs tƒ‚dS(N(R!(RR¶((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•šsN( R&R.R/R0RRMRðRñRmRôRöR÷R•(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRks      cBsGeZdZdddd„Zd„ZeeƒZd„Zd„ZRS(slA table- or column-level CHECK constraint. Can be included in the definition of a Table or Column. cCsLtt|ƒi|||ƒt|tƒptidƒ‚n||_dS(sâConstruct a CHECK constraint. sqltext A string containing the constraint definition. Will be used verbatim. name Optional, the in-database name of the constraint. deferrable Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. initially Optional string. If set, emit INITIALLY when issuing DDL for this constraint. s3sqltext must be a string and will be used verbatim.N(RLRRMR¢R£RR_tsqltext(RRøR4RÀRÁ((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM£s  cCs t|itƒodSdSdS(Ntcheck_constrainttcolumn_check_constraint(R¢R"R(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR0¼scCs||_|ii|ƒdS(N(R"RPRu(RR"((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRÃs cKst|id|iƒS(NR4(RRøR4(RR¶((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•ÇsN( R&R.R/RRMR0R2RR•(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRs    cBsVeZdZdZdddedded„Zd„Zd„Zd„Z d„Z RS(s¦A table-level FOREIGN KEY constraint. Defines a single column or composite FOREIGN KEY ... REFERENCES constraint. For a no-frills, single column foreign key, adding a :class:`ForeignKey` to the definition of a :class:`Column` is a shorthand equivalent for an unnamed, single column :class:`ForeignKeyConstraint`. Examples of foreign key configuration are in :ref:`metadata_foreignkeys`. tforeign_key_constraintc Cstt|ƒi|||ƒ||_||_tiƒ|_||_||_ | |_ |i djo|ot idƒ‚n||_dS(s Construct a composite-capable FOREIGN KEY. :param columns: A sequence of local column names. The named columns must be defined and present in the parent Table. The names should match the ``key`` given to each column (defaults to the name) unless ``link_to_name`` is True. :param refcolumns: A sequence of foreign column names or Column objects. The columns must all be located within the same Table. :param name: Optional, the in-database name of the key. :param onupdate: Optional string. If set, emit ON UPDATE when issuing DDL for this constraint. Typical values include CASCADE, DELETE and RESTRICT. :param ondelete: Optional string. If set, emit ON DELETE when issuing DDL for this constraint. Typical values include CASCADE, DELETE and RESTRICT. :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. :param initially: Optional string. If set, emit INITIALLY when issuing DDL for this constraint. :param link_to_name: if True, the string name given in ``column`` is the rendered name of the referenced column, not its locally assigned ``key``. :param use_alter: If True, do not emit this key as part of the CREATE TABLE definition. Instead, use ALTER TABLE after table creation to add the key. Useful for circular dependencies. s9Alterable ForeignKey/ForeignKeyConstraint requires a nameN(RLR RMt_ForeignKeyConstraint__colnamest"_ForeignKeyConstraint__refcolnamesRRTtelementsR R¿RÂR4RRR_R¾( RRxt refcolumnsR4R R¿R¾RÀRÁRÂ((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM×s"     cCsg||_||ijoJ|ii|ƒx7t|i|iƒD]\}}|i||ƒq?WndS(N(RFRPRutzipRüRýtappend_element(RRFR`tr((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRs   cCsgt|d|d|id|id|id|id|iƒ}|i|ii|ƒ|i |ƒdS(NRR4R R¿R¾RÂ( R R4R R¿R¾RÂRRFR`RÓ(RRòtrefcolR¬((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR s?cCs4|ii|ii|iiƒ|ii|ƒdS(N(RxRuRFR`R"RERþ(RR¬((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRÓs cKs|tg}|iD]}||iiq~g}|iD]}||i|q8~d|id|id|id|iƒS(NR4R R¿R¾(R RþR"R4RÃR R¿R¾(RR¶RoRyRz((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•sN( R&R.R/R0RR=RMRRRÓR•(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR Ês -   cBsbeZdZdZd„Zd„Zd„ZeZd„Zd„Z d„Z e i Z d„Z RS( s1A table-level PRIMARY KEY constraint. Defines a single column or composite PRIMARY KEY constraint. For a no-frills primary key, adding ``primary_key=True`` to one or more ``Column`` definitions is a shorthand equivalent for an unnamed single- or multiple-column PrimaryKeyConstraint. tprimary_key_constraintc OsŸtd|iddƒd|iddƒd|iddƒƒ}|o0tiddid„|iƒDƒƒƒ‚ntt|ƒi |t |ƒ|_ dS(sConstruct a composite-capable PRIMARY KEY. \*columns A sequence of column names. All columns named must be defined and present within the parent Table. name Optional, the in-database name of the key. deferrable Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. initially Optional string. If set, emit INITIALLY when issuing DDL for this constraint. R4RÀRÁs,Unknown PrimaryKeyConstraint argument(s): %ss, cssx|]}t|ƒVqWdS(N(Rl(t.0Ry((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pys ;s N( tdictR<RRR_RiRmRLR RMRWt_PrimaryKeyConstraint__colnames(RRxR#tconstraint_args((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM"s'cCs>||_||_x%|iD]}|i|i|ƒqWdS(N(RFRSRRuR`(RRFR4((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR@s    cCs|ii|ƒt|_dS(N(RxRuR˜RS(RRò((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRuFscCs|ii|ƒdS(N(RxR³(RRò((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR³KscCst|_|i|i=dS(N(R=RSRxRE(RRò((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRaNs cKs1td|ig}|D]}||iq~ŒS(NR4(R R4RE(RR¶RoR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•RscCs |i|jS(N(Rx(RRó((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt__eq__Ws(R&R.R/R0RMRRuR~R³RaR•Rt__hash__R (((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR s       cBs8eZdZdZd„Zd„Zd„Zd„ZRS(sA table-level UNIQUE constraint. Defines a single column or composite UNIQUE constraint. For a no-frills, single column constraint, adding ``unique=True`` to the ``Column`` definition is a shorthand equivalent for an unnamed, single column UniqueConstraint. tunique_constraintc OsŸtd|iddƒd|iddƒd|iddƒƒ}|o0tiddid„|iƒDƒƒƒ‚ntt|ƒi |t |ƒ|_ dS(sûConstruct a UNIQUE constraint. \*columns A sequence of column names. All columns named must be defined and present within the parent Table. name Optional, the in-database name of the key. deferrable Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. initially Optional string. If set, emit INITIALLY when issuing DDL for this constraint. R4RÀRÁs(Unknown UniqueConstraint argument(s): %ss, cssx|]}t|ƒVqWdS(N(Rl(RRy((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pys ~s N( RR<RRR_RiRmRLRRMRWt_UniqueConstraint__colnames(RRxR#R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMes'cCsE||_|ii|ƒx%|iD]}|i|i|ƒq#WdS(N(RFRPRuR R~R`(RRFR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRƒs   cCs|ii|ƒdS(N(RxRu(RRò((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR~‰scKstd|i|iŒS(NR4(RR4R (RR¶((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR•Œs(R&R.R/R0RMRR~R•(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRZs    cBsbeZdZdZd„Zd„Zd„Zd„Zd d„Z d d„Z d„Z d „Z RS( sîA table-level INDEX. Defines a composite (one or more column) INDEX. For a no-frills, single column index, adding ``index=True`` to the ``Column`` definition is a shorthand equivalent for an unnamed, single column Index. RžcOsJ||_g|_d|_|idtƒ|_||_|i|ŒdS(sêConstruct an index object. Arguments are: name The name of the index \*columns Columns to include in the index. All columns must belong to the same table, and no column may appear more than once. \**kwargs Keyword arguments include: unique Defaults to False: create a unique index. postgres_where Defaults to None: create a partial index when using PostgreSQL RŸN( R4RxRRFR<R=RŸR#R (RR4RxR#((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM™s     cGs(x!|D]}|it|ƒƒqWdS(N(R~t_to_schema_column(RRR}((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR ·scCs)||_|i|_|ii|ƒdS(N(RFR(RORu(RRF((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR»s  cCsÂ|idjo|i|iƒn‹|i|ijo&tid||i|ifƒ‚nR|ig}|iD]}||iqq~jo tid|i|fƒ‚n|ii|ƒdS(Ns?All index columns must be from same table. %s is from %s not %ssJA column may not appear twice in the same index (%s already has column %s)(RFRRRR_R4RxRƒ(RR}RoR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR~Às1cCs.|djot|ƒ}n|i|ƒ|S(N(RR]R’(RR)((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR’Ðs  cCs.|djot|ƒ}n|i|ƒdS(N(RR]R”(RR)((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR”Ös cCs t|ƒS(N(Rl(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR|ÛscCs;d|idid„|iDƒƒ|iodpdfS(NsIndex("%s", %s%s)s, cssx|]}t|ƒVqWdS(N(Rl(RR`((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pys às s , unique=TrueR®(R4RiRxRŸ(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'Þs N( R&R.R/R0RMR RR~RR’R”R|R'(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR s       cBs eZdZdZdZded„Zd„Zd„Z d „Z d „Z d „Z e id ƒd „ƒZd„Zd„ZeeeƒZd„Zd„Ze idƒedd„ƒZed„ƒZdddd„Zd„Zdded„Zdded„ZRS(s¤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 R(s before-creates after-creates before-drops after-dropcCs`h|_||_||_titƒ|_|o(|ptidƒ‚n|i ƒndS(sCreate a new MetaData object. bind An Engine or Connection to bind to. May also be a string or URL instance, these are passed to create_engine() and this MetaData will be bound to the resulting engine. reflect Optional, automatically load all tables from the bound database. Defaults to False. ``bind`` is required when this option is set. For finer control over loaded tables, use the ``reflect`` method of ``MetaData``. s8A bind must be supplied in conjunction with reflect=TrueN( R>R)R(RRVRWRXRR_treflect(RR)R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRMs    cCs d|iS(Ns MetaData(%r)(R)(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'scCs ||ijS(N(R>(RRE((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRð scCsh|id6S(NR>(R>(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt __getstate__#scCs|d|_d|_dS(NR>(R>Rt_bind(Rtstate((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt __setstate__&s cCs |idj S(s:True if this MetaData is bound to an Engine or Connection.N(RR(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytis_bound*ssJDeprecated. Use ``metadata.bind = `` or ``metadata.bind = ``.cKsjtdjoddklant|ttfƒo&ddkl}||||_n ||_dS(s]Bind this MetaData to an Engine. bind A string, ``URL``, ``Engine`` or ``Connection`` instance. If a string or ``URL``, will be passed to ``create_engine()`` along with ``\**kwargs`` to produce the engine which to connect to. Otherwise connects directly to the given ``Engine``. iÿÿÿÿ(tURL(t create_engineN(RRtsqlalchemy.engine.urlR¢R£t sqlalchemyRR(RR)R#R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytconnect/s cCs|iS(sAn Engine or Connection to which this MetaData is bound. 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()``. (R(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR)DscCsgtdjoddklant|ttfƒo#ddkl}||ƒ|_n ||_dS(s;Bind this MetaData to an Engine, Connection, string or URL.iÿÿÿÿ(R(RN(RRRR¢R£RRR(RR)R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt_bind_toNs  cCs|iiƒdS(s+Clear all Table objects from this MetaData.N(R>tclear(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR\scCs|i|i=dS(s1Remove the given Table object from this MetaData.N(R>RE(RRF((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRabss*Deprecated. Use ``metadata.sorted_tables``cCs{ddkl}|djo|iiƒ}nt|ƒi|iiƒƒ}||ƒ}|ot|ƒ}nt|ƒS(s*Deprecated - use metadata.sorted_tables().iÿÿÿÿ(t sort_tablesN( tsqlalchemy.sql.utilRRR>tvaluesRNt intersectiontreversedRõ(RtreverseR>Rtret((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyttable_iteratorhs  cCs#ddkl}||iiƒƒS(sSReturns a list of ``Table`` objects sorted in order of dependency. iÿÿÿÿ(R(RRR>R(RR((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyt sorted_tablesvsc Cshtd6}|d jot|ƒ}d }n||d<|iƒ}|d j o||dRmR¤RR@turlRiR(RR)R5tonlyt reflect_optsRŒt availabletcurrentRoR4tloadRzR°tmissingtst_[4]((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR~s4         652&2cCs8||ijot|ƒ‚n|i|i|ƒdS(sIAppend a DDL event listener to this ``MetaData``. The ``listener`` callable will be triggered when this ``MetaData`` is involved in DDL creates or drops, and will be invoked either before all Table-related actions or after. Arguments are: event One of ``MetaData.ddl_events``; 'before-create', 'after-create', 'before-drop' or 'after-drop'. listener A callable, invoked with three positional arguments: event The event currently being handled schema_item The ``MetaData`` object being operated upon bind The ``Connection`` bueing used for DDL execution. Listeners are added to the MetaData's ``ddl_listeners`` attribute. Note: MetaData listeners are invoked even when ``Tables`` are created in isolation. This may change in a future release. I.e.:: # triggers all MetaData and Table listeners: metadata.create_all() # triggers MetaData listeners too: some.table.create() N(RR‚RXRƒ(RR„R…((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR†½s"cCsŠ|djot|ƒ}nx%|idD]}|d||ƒq+W|i|d|d|ƒx%|idD]}|d||ƒqlWdS(sxCreate all tables stored in this metadata. Conditional by default, will not attempt to recreate tables already present in the target database. bind A :class:`~sqlalchemy.engine.base.Connectable` used to access the database; if None, uses the existing bind on this ``MetaData``, if any. tables Optional list of ``Table`` objects, which is a subset of the total tables in the ``MetaData`` (others are ignored). checkfirst Defaults to True, don't issue CREATEs for tables already present in the target database. s before-createRR>s after-createN(RR]RXR’(RR)R>RR…((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR‘ãs cCsŠ|djot|ƒ}nx%|idD]}|d||ƒq+W|i|d|d|ƒx%|idD]}|d||ƒqlWdS(siDrop all tables stored in this metadata. Conditional by default, will not attempt to drop tables not present in the target database. bind A :class:`~sqlalchemy.engine.base.Connectable` used to access the database; if None, uses the existing bind on this ``MetaData``, if any. tables Optional list of ``Table`` objects, which is a subset of the total tables in the ``MetaData`` (others are ignored). checkfirst Defaults to True, only issue DROPs for tables confirmed to be present in the target database. s before-dropRR>s after-dropN(RR]RXR”(RR)R>RR…((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR“þs (s before-creates after-creates before-drops after-dropN(R&R.R/R0RRR=RMR'RðRRRRt deprecatedRR)RR2RRaR˜R"R#RR†R‘R“(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRãs,          ? &cBsheZdZdZd„Zeidƒd„ƒZd„Zd„Z e ee ƒZd„Z d„Z RS( sA 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``. R(cCs2tiiƒ|_h|_tt|ƒiƒdS(s Construct a ThreadLocalMetaData.N(Rt threadingtlocaltcontextt_ThreadLocalMetaData__enginesRLRRM(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRM)s sJDeprecated. Use ``metadata.bind = `` or ``metadata.bind = ``.cKs˜tdjoddklant|ttfƒoPy|i|}Wn2tj o&ddkl}|||}nX|}n|i |ƒdS(s[Bind to an Engine in the caller's thread. bind A string, ``URL``, ``Engine`` or ``Connection`` instance. If a string or ``URL``, will be passed to ``create_engine()`` along with ``\**kwargs`` to produce the engine which to connect to. Otherwise connects directly to the given ``Engine``. iÿÿÿÿ(R(RN( RRRR¢R£R5RBRRR(RR)R#R&R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR0s  cCst|iddƒS(sê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()``.t_engineN(RtR4R(R((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR)IscCsÎtdjoddklant|ttfƒofy|i||i_WqÊtj o<ddk l }||ƒ}||i|<||i_qÊXn.||ijo||i|RØ(RR„RR)R:((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRD0scCs|i|i||ƒS(N(R:t_prepare_context(RRR)((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR>7scCsS|idjotSt|itƒo|i|iijS|i|||ƒSdS(N(R;RR˜R¢R£R&R4(RR„RR)((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR<:s cCsÀt|tƒo¥|iiƒ}|ii}|i|ƒ}t|ƒdjo|dd}}n|d|d}}|id|ƒ|id|ƒ|id|i |ƒƒ|S|iSdS(NiiR®iÿÿÿÿRFR5RY( R¢RR4R•RŠtidentifier_preparertformat_table_seqRft setdefaultt format_table(RRR)R4tpreparertpathRFR5((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyRBBs c Cs{dt|ƒit|ƒdit|iƒgg}dD]4}t||ƒo|d|t||ƒfq8q8~ƒfS(Ns <%s@%s; %s>s, R;R4s%s=%r(sonscontext(RCR&tidRiRlR:Rt(RRoRE((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR'Us  N(R&R.R/RRMRØRAR)RR2RDR>R<RBR'(((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR|s< 1     cCsGt|dƒo|iƒ}nt|tƒptidƒ‚n|S(NRÄsschema.Column object expected(RÅRÄR¢RRR_(telement((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR ]s cCs°|i}|pœ|ii}t|dt|ddƒƒ}|od||f}n|}t|ttfƒod|}n d|}d||f}ti |ƒ‚n|S(NRYR4s%s %rsthe %s's .bindsthis %s's .metadata.bindsÈThe %s is not bound to an Engine or Connection. Execution can not proceed without a database to execute against. Either execute with an explicit connection or assign %s to enable implicit execution.( R)R%R&RtRR¢RRRtUnboundExecutionError(t schemaitemR)R4tlabelRtbindabletmsg((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pyR]ds     (-R/RgRÞRRRRRtsqlalchemy.sqlRRRRRjtsortt VisitableRR6t VisitableTypeR7RˆRR»RR RRR tobjectRRRRRR R RR RRt ClauseVisitorRRR R](((s5/usr/lib/python2.6/site-packages/sqlalchemy/schema.pytsJ"    ) ÿ$ÿbÒ8)2-MC5Tÿ7]á