ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4]c@@sdZddlmZddlZddlZddlZddlmZddlmZddlm Z ddl m Z dd l m Z dd l m Z dd l mZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZejdZejddZ dZ!dZ"ej#dee j$fd YZ%d!e e%efd"YZ&d#e e%efd$YZ'd%e e%fd&YZ(d'e)fd(YZ*d)e*e%fd*YZ+d+e+fd,YZ,d-e+fd.YZ-ej#d/e*efd0YZ.d1e.fd2YZ/ej0d3d4d5e/fd6YZ1d7e e%fd8YZ2d9Z3d:Z4d;e)fd<YZ5d=e5e2fd>YZ6d?e6fd@YZ7dAe6fdBYZ8dCe6fdDYZ9dEe6fdFYZ:dGe e5e%fdHYZ;ej<idIdJ6Z=dKe%fdLYZ>dMe>fdNYZ?dOe)fdPYZ@e@eAZBe@jCZCdS(Qs/The 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(tabsolute_importNi(tddl(ttype_api(tvisitors(t_bind_or_error(tColumnCollection(t DialectKWArgs(tSchemaEventTarget(t _as_truncated(t_document_text_coercion(t_literal_as_text(t ClauseElement(t ColumnClause(t ColumnElement(t quoted_name(t TextClause(t TableClausei(tevent(texc(t inspection(tutilt retain_schemat blank_schemasSymbol indicating that a :class:`.Table` or :class:`.Sequence` should have 'None' for its schema, even if the parent :class:`.MetaData` has specified a schema. .. versionadded:: 1.0.14 cC@s |dkr|S|d|SdS(Nt.(tNone(tnametschema((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_get_table_keyIs c@s%fd}tj|i|S(Nc@sFt|tr>|jkr>|jjkr>j|jSdSdS(N(t isinstancetColumnttabletkeytcR(tcol(t source_tablet target_table(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytreplaceSs (Rtreplacement_traverse(t expressionR"R#R$((R"R#sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_copy_expressionRs t SchemaItemcB@steZdZdZdZdZdZeej dddZ ej dZ d Z d ZRS( s3Base class for items that define a database schema.t schema_itemcG@s1x*|D]"}|dk r|j|qqWdS(s7Initialize the list of child items for this SchemaItem.N(Rt_set_parent_with_dispatch(tselftargstitem((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _init_itemsfs  cK@sgS(s"used to allow SchemaVisitor access((R+tkwargs((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt get_childrenmscC@stj|ddgS(Nt omit_kwargtinfo(Rt generic_repr(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt__repr__qss0.9sThe :attr:`.SchemaItem.quote` attribute is deprecated and will be removed in a future release. Use the :attr:`.quoted_name.quote` attribute on the ``name`` field of the target schema item to retrievequoted status.cC@s |jjS(sReturn the value of the ``quote`` flag passed to this schema object, for those schema items which have a ``name`` field. (Rtquote(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR5tscC@siS(sLInfo dictionary associated with the object, allowing user-defined data to be associated with this :class:`.SchemaItem`. The dictionary is automatically generated when first accessed. It can also be specified in the constructor of some objects, such as :class:`.Table` and :class:`.Column`. ((R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR2s cC@s;d|jkr$|jj|_n|jj|j|S(NR2(t__dict__R2tcopytdispatcht_update(R+R)((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_schema_item_copyscC@s|j||S(N(tget(R+teffective_schematmap_((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_translate_schemas(t__name__t __module__t__doc__t__visit_name__R.R0R4tpropertyRt deprecatedR5tmemoized_propertyR2R:R>(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR(`s    tTablecB@seZdZdZejdddfdZeejdddZ d Z d Z fe e d Zed Zed ZdZdZdZdZedZedZdZdZedZdZdZdZejdddZdZe edZ e dZ!e edZ"e ed Z#e$e e d!Z%RS("s2Represent a table in a database. e.g.:: mytable = Table("mytable", metadata, Column('mytable_id', Integer, primary_key=True), Column('value', String(50)) ) The :class:`.Table` object constructs a unique instance of itself based on its name and optional schema name within the given :class:`.MetaData` object. Calling the :class:`.Table` constructor with the same name and same :class:`.MetaData` argument a second time will return the *same* :class:`.Table` object - in this way the :class:`.Table` constructor acts as a registry function. .. seealso:: :ref:`metadata_describing` - Introduction to database metadata Constructor arguments are as follows: :param name: The name of this table as represented in the database. The table name, along with the value of the ``schema`` parameter, forms a key which uniquely identifies this :class:`.Table` within the owning :class:`.MetaData` collection. 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 or contain special characters. A name with any number of upper case characters is considered to be case sensitive, and will be sent as quoted. To enable unconditional quoting for the table name, specify the flag ``quote=True`` to the constructor, or use the :class:`.quoted_name` construct to specify the name. :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:`.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, unless :paramref:`.Table.autoload_with` is set in which case it defaults to True; :class:`.Column` objects for this table should be reflected from the database, possibly augmenting or replacing existing :class:`.Column` objects that were explicitly specified. .. versionchanged:: 1.0.0 setting the :paramref:`.Table.autoload_with` parameter implies that :paramref:`.Table.autoload` will default to True. .. seealso:: :ref:`metadata_reflection_toplevel` :param autoload_replace: Defaults to ``True``; when using :paramref:`.Table.autoload` in conjunction with :paramref:`.Table.extend_existing`, indicates that :class:`.Column` objects present in the already-existing :class:`.Table` object should be replaced with columns of the same name retrieved from the autoload process. When ``False``, columns already present under existing names will be omitted from the reflection process. Note that this setting does not impact :class:`.Column` objects specified programmatically within the call to :class:`.Table` that also is autoloading; those :class:`.Column` objects will always replace existing columns of the same name when :paramref:`.Table.extend_existing` is ``True``. .. seealso:: :paramref:`.Table.autoload` :paramref:`.Table.extend_existing` :param autoload_with: An :class:`.Engine` or :class:`.Connection` object with which this :class:`.Table` object will be reflected; when set to a non-None value, it implies that :paramref:`.Table.autoload` is ``True``. If left unset, but :paramref:`.Table.autoload` is explicitly set to ``True``, an autoload operation will attempt to proceed by locating an :class:`.Engine` or :class:`.Connection` bound to the underlying :class:`.MetaData` object. .. seealso:: :paramref:`.Table.autoload` :param extend_existing: When ``True``, indicates that if this :class:`.Table` is already present in the given :class:`.MetaData`, apply further arguments within the constructor to the existing :class:`.Table`. If :paramref:`.Table.extend_existing` or :paramref:`.Table.keep_existing` are not set, and the given name of the new :class:`.Table` refers to a :class:`.Table` that is already present in the target :class:`.MetaData` collection, and this :class:`.Table` specifies additional columns or other constructs or flags that modify the table's state, an error is raised. The purpose of these two mutually-exclusive flags is to specify what action should be taken when a :class:`.Table` is specified that matches an existing :class:`.Table`, yet specifies additional constructs. :paramref:`.Table.extend_existing` will also work in conjunction with :paramref:`.Table.autoload` to run a new reflection operation against the database, even if a :class:`.Table` of the same name is already present in the target :class:`.MetaData`; newly reflected :class:`.Column` objects and other options will be added into the state of the :class:`.Table`, potentially overwriting existing columns and options of the same name. As is always the case with :paramref:`.Table.autoload`, :class:`.Column` objects can be specified in the same :class:`.Table` constructor, which will take precedence. Below, the existing table ``mytable`` will be augmented with :class:`.Column` objects both reflected from the database, as well as the given :class:`.Column` named "y":: Table("mytable", metadata, Column('y', Integer), extend_existing=True, autoload=True, autoload_with=engine ) .. seealso:: :paramref:`.Table.autoload` :paramref:`.Table.autoload_replace` :paramref:`.Table.keep_existing` :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 resolve_fks: Whether or not to reflect :class:`.Table` objects related to this one via :class:`.ForeignKey` objects, when :paramref:`.Table.autoload` or :paramref:`.Table.autoload_with` is specified. Defaults to True. Set to False to disable reflection of related tables as :class:`.ForeignKey` objects are encountered; may be used either to save on SQL calls or to avoid issues with related tables that can't be accessed. Note that if a related table is already present in the :class:`.MetaData` collection, or becomes present later, a :class:`.ForeignKey` object associated with this :class:`.Table` will resolve to that table normally. .. versionadded:: 1.3 .. seealso:: :paramref:`.MetaData.reflect.resolve_fks` :param info: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. :param keep_existing: When ``True``, indicates that if this Table is already present in the given :class:`.MetaData`, ignore further arguments within the constructor to the existing :class:`.Table`, and return the :class:`.Table` object as originally created. This is to allow a function that wishes to define a new :class:`.Table` on first call, but on subsequent calls will return the same :class:`.Table`, without any of the declarations (particularly constraints) being applied a second time. If :paramref:`.Table.extend_existing` or :paramref:`.Table.keep_existing` are not set, and the given name of the new :class:`.Table` refers to a :class:`.Table` that is already present in the target :class:`.MetaData` collection, and this :class:`.Table` specifies additional columns or other constructs or flags that modify the table's state, an error is raised. The purpose of these two mutually-exclusive flags is to specify what action should be taken when a :class:`.Table` is specified that matches an existing :class:`.Table`, yet specifies additional constructs. .. seealso:: :paramref:`.Table.extend_existing` :param listeners: A list of tuples of the form ``(, )`` which will be passed to :func:`.event.listen` upon construction. This alternate hook to :func:`.event.listen` allows the establishment of a listener function specific to this :class:`.Table` before the "autoload" process begins. Particularly useful for the :meth:`.DDLEvents.column_reflect` event:: def listen_for_reflect(table, column_info): "handle the column reflection event" # ... t = Table( 'sometable', autoload=True, listeners=[ ('column_reflect', listen_for_reflect) ]) :param mustexist: When ``True``, indicates that this Table must already be present in the given :class:`.MetaData` collection, else an exception is raised. :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``. If the owning :class:`.MetaData` of this :class:`.Table` specifies its own :paramref:`.MetaData.schema` parameter, then that schema name will be applied to this :class:`.Table` if the schema parameter here is set to ``None``. To set a blank schema name on a :class:`.Table` that would otherwise use the schema set on the owning :class:`.MetaData`, specify the special symbol :attr:`.BLANK_SCHEMA`. .. versionadded:: 1.0.14 Added the :attr:`.BLANK_SCHEMA` symbol to allow a :class:`.Table` to have a blank schema name even when the parent :class:`.MetaData` specifies :paramref:`.MetaData.schema`. The quoting rules for the schema name are the same as those for the ``name`` parameter, in that quoting is applied for reserved words or case-sensitive names; to enable unconditional quoting for the schema name, specify the flag ``quote_schema=True`` to the constructor, or use the :class:`.quoted_name` construct to specify the name. :param useexisting: the same as :paramref:`.Table.extend_existing`. :param comment: Optional string that will render an SQL comment on table creation. .. versionadded:: 1.2 Added the :paramref:`.Table.comment` parameter to :class:`.Table`. :param \**kw: Additional keyword arguments not mentioned above are dialect specific, and passed in the form ``_``. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. Rt useexistings0.7sThe :paramref:`.Table.useexisting` parameter is deprecated and will be removed in a future release. Please use :paramref:`.Table.extend_existing`.c O@sZ|stj|Sy$|d|d|d}}}Wntk rVtdnX|jdd}|dkr|j}n|tkrd}n|jdt }|jdt }d|kr|rd }t j |n|jdt }n|r|rd }t j |n|jd t } t ||} | |j kr| r}| r}t|r}t jd | n|j | } |r| j||n| S| rt jd | ntj|} | jj| ||j||| y1| j||||| jj| || SWn*tj|j||WdQXnXdS(Niiis$Table() takes at least two argumentsRt keep_existingtextend_existingRGs/useexisting is synonymous with extend_existing.s9keep_existing and extend_existing are mutually exclusive.t mustexistsTable '%s' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.sTable '%s' not defined(tobjectt__new__t IndexErrort TypeErrorR;RRt BLANK_SCHEMAtpoptFalseRt ArgumentErrorRttablestbooltInvalidRequestErrort_init_existingR8tbefore_parent_attacht _add_tablet_inittafter_parent_attachRt safe_reraiset _remove_table( tclsR,tkwRtmetadataRRHRItmsgRJRR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRLsX  $          s0.9sThe :meth:`.SchemaItem.quote` method is deprecated and will be removed in a future release. Use the :attr:`.quoted_name.quote` attribute on the ``schema`` field of the target schema item to retrieve quoted status.cC@s |jjS(s^Return the value of the ``quote_schema`` flag passed to this :class:`.Table`. (RR5(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt quote_schemas cO@sdS(sConstructor for :class:`~.schema.Table`. This method is a no-op. See the top-level documentation for :class:`~.schema.Table` for constructor arguments. N((R+R,R^((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt__init__tcO@stt|jt||jdd||_|jdd|_|jdkrg|j|_nB|jtkrd|_n'|jdd}t|j||_t |_ t |_ t |_ tdtj|t |_t |_|jdk r&d|j|jf|_n |j|_|jdd}|jd|dk }|jdt|jd d}|jd t} |jd d} |jd t|_|jd d|_d|kr|jd|_nd|kr5|jd} x*| D]\} } tj|| | qWn|jdg|_|j||r|j||| d |d | n|j|dS(NR5RRat_implicit_generateds%s.%st autoload_withtautoloadtautoload_replacet _extend_ont resolve_fkstinclude_columnstimplicit_returningtcommentR2t listenerstprefixes(tsuperRFRbRRPRR_RROtsettindexest constraintsRt_columnstPrimaryKeyConstrainttTrueR*t foreign_keyst_extra_dependenciesRtfullnameRkRlR2Rtlistent _prefixest _extra_kwargst _autoloadR.(R+RR_R,R/RaReRfRhRiRjRmtevttfn((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRY sZ             cC@si|r.|j|jj||||d|n7t|dd}|j|jj||||d|dS(NRhR`sNo engine is bound to this Table's MetaData. Pass an engine to the Table via autoload_with=, or associate the MetaData with an engine via metadata.bind=(t run_callabletdialectt reflecttableR(R+R_ReRjtexclude_columnsRiRhtbind((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR|Ps$     cC@st|jddS(sTReturn the set of constraints as a list, sorted by creation order. RcS@s|jS(N(t_creation_order(R ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt{Rc(tsortedRr(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_sorted_constraintsuscC@std|jDS(s:class:`.ForeignKeyConstraint` objects referred to by this :class:`.Table`. This list is produced from the collection of :class:`.ForeignKey` objects currently associated. .. versionadded:: 1.0.0 cs@s|]}|jVqdS(N(t constraint(t.0tfkc((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys s(RpRv(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytforeign_key_constraints}s c O@s|jdd}|jd|dk }|jdt}|jdd}|jdd}|r||jkrtjd|j|fn|jdd}|jdt} |dk rx6|jD](} | j|kr|jj | qqWnx,dD]$} | |krtjd qqWd |krO|jd d|_ nd |krp|jd |_ n|r|sg|jD]} | j^q} nd} |j |j ||| | d|n|j||j|dS(NReRfRgRRhs7Can't change schema of existing table from '%s' to '%s'RjRiR5Ras2Can't redefine 'quote' or 'quote_schema' argumentsRlR2(R5Ra((RPRRuRRRRR RRstremoveRlR2R|R_R{R.( R+R,R/ReRfRgRRhRjRiR RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRVsH     "  cK@s|j|dS(N(t_validate_dialect_kwargs(R+R/((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR{scC@sdS(N((R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_init_collectionsscC@sdS(N((R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_reset_exportedscC@s |jjS(N(t primary_keyt_autoincrement_column(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRscC@st|j|jS(s_Return the 'key' for this :class:`.Table`. This value is used as the dictionary key within the :attr:`.MetaData.tables` collection. It is typically the same as that of :attr:`.Table.name` for a table with no :attr:`.Table.schema` set; otherwise it is typically of the form ``schemaname.tablename``. (RRR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs c C@sddjt|jgt|jgg|jD]}t|^q2gdgD]%}d|tt||f^qRS(Ns Table(%s)s, Rs%s=%s(tjointreprRR_tcolumnstgetattr(R+txtk((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR4s cC@st|j|jS(N(Rt descriptionR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt__str__scC@s|jr|jjpdS(s2Return the connectable associated with this Table.N(R_RR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRscC@s|jj|dS(sAdd a 'dependency' for this Table. This is another Table object which must be created first before this one can, or dropped after this one. Usually, dependencies between tables are determined via ForeignKey objects. However, for other situations that create dependencies outside of foreign keys (rules, inheriting), this method can manually establish such a link. N(Rwtadd(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytadd_is_dependent_ons cC@s|j|dS(szAppend a :class:`~.schema.Column` to this :class:`~.schema.Table`. The "key" of the newly added :class:`~.schema.Column`, i.e. the value of its ``.key`` attribute, will then be available in the ``.c`` collection of this :class:`~.schema.Table`, and the column definition will be included in any CREATE TABLE, SELECT, UPDATE, etc. statements generated from this :class:`~.schema.Table` construct. Note that this does **not** change the definition of the table as it exists within any underlying database, assuming that table has already been created in the database. Relational databases support the addition of columns to existing tables using the SQL ALTER command, which would need to be emitted for an already-existing table that doesn't contain the newly added column. N(R*(R+tcolumn((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt append_columnscC@s|j|dS(sAppend a :class:`~.schema.Constraint` to this :class:`~.schema.Table`. This has the effect of the constraint being included in any future CREATE TABLE statement, assuming specific DDL creation events have not been associated with the given :class:`~.schema.Constraint` object. Note that this does **not** produce the constraint within the relational database automatically, for a table that already exists in the database. To add a constraint to an existing relational database table, the SQL ALTER command must be used. SQLAlchemy also provides the :class:`.AddConstraint` construct which can produce this SQL when invoked as an executable clause. N(R*(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytappend_constraintssthe :meth:`.Table.append_ddl_listener` method is deprecated and will be removed in a future release. Please refer to :class:`.DDLEvents`.c@s9fd}tj|djdd|dS(s8Append a DDL event listener to this ``Table``. c@s||dS(N((ttargett connectionR^(t event_nametlistener(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytadapt_listener/sRct-t_N(RRyR$(R+RRR((RRsH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytappend_ddl_listener$s cC@s&|j|j|j|||_dS(N(RXRRR_(R+R_((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _set_parent4scK@s7|stj|d||S|r/t|jSgSdS(Ntcolumn_collections(RR0tlistR(R+Rtschema_visitorR^((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR08s  cC@s=|dkrt|}n|j|jj|jd|jS(s!Return True if this table exists.RN(RRRRt has_tableRR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytexistsEs cC@s8|dkrt|}n|jtj|d|dS(sIssue a ``CREATE`` statement for this :class:`.Table`, using the given :class:`.Connectable` for connectivity. .. seealso:: :meth:`.MetaData.create_all`. t checkfirstN(RRt _run_visitorRtSchemaGenerator(R+RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytcreateOs cC@s8|dkrt|}n|jtj|d|dS(sIssue a ``DROP`` statement for this :class:`.Table`, using the given :class:`.Connectable` for connectivity. .. seealso:: :meth:`.MetaData.drop_all`. RN(RRRRt SchemaDropper(R+RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytdrop^s c C@s|dkr|j}n|tkr0|j}n|dkrH|j}nt||}||jkrtjd|j|j|Sg}x*|j D]}|j |j d|qWt ||d|d|j ||j}x|jD]}t|trb|j} |r%||||| } n| |jkr:|nd} |j|j d| d|q|js|jrzqn|j|j d|d|qqWxg|jD]\} | jrqnt| jd| jd|g| jD]} t| ||^q| jqW|j|S(s` Return a copy of this :class:`.Table` associated with a different :class:`.MetaData`. E.g.:: m1 = MetaData() user = Table('user', m1, Column('id', Integer, primary_key=True)) m2 = MetaData() user_copy = user.tometadata(m2) :param metadata: Target :class:`.MetaData` object, into which the new :class:`.Table` object will be created. :param schema: optional string name indicating the target schema. Defaults to the special symbol :attr:`.RETAIN_SCHEMA` which indicates that no change to the schema name should be made in the new :class:`.Table`. If set to a string name, the new :class:`.Table` will have this new name as the ``.schema``. If set to ``None``, the schema will be set to that of the schema set on the target :class:`.MetaData`, which is typically ``None`` as well, unless set explicitly:: m2 = MetaData(schema='newschema') # user_copy_one will have "newschema" as the schema name user_copy_one = user.tometadata(m2, schema=None) m3 = MetaData() # schema defaults to None # user_copy_two will have None as the schema name user_copy_two = user.tometadata(m3, schema=None) :param referred_schema_fn: optional callable which can be supplied in order to provide for the schema name that should be assigned to the referenced table of a :class:`.ForeignKeyConstraint`. The callable accepts this parent :class:`.Table`, the target schema that we are changing to, the :class:`.ForeignKeyConstraint` object, and the existing "target schema" of that constraint. The function should return the string schema name that should be applied. E.g.:: def referred_schema_fn(table, to_schema, constraint, referred_schema): if referred_schema == 'base_tables': return referred_schema else: return to_schema new_table = table.tometadata(m2, schema="alt_schema", referred_schema_fn=referred_schema_fn) .. versionadded:: 0.9.2 :param name: optional string name indicating the target table name. If not specified or None, the table name is retained. This allows a :class:`.Table` to be copied to the same :class:`.MetaData` target with a new name. .. versionadded:: 1.0.0 sBTable '%s' already exists within the given MetaData - not copying.RRlR#tuniquet_tableN(RRt RETAIN_SCHEMARRRSRtwarnRRtappendR7RFRlR/RrRtForeignKeyConstraintt_referred_schemaRt _type_boundt _column_flagRqtIndexRt expressionsR'R:( R+R_Rtreferred_schema_fnRRR,R Rtreferred_schematfk_constraint_schematindextexpr((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt tometadatalsZG                ((&R?R@RARBRtdeprecated_paramsRLRCRDRaRbRYRuRR|RRRVR{RRRRR4RRRRRRRRQR0RRRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRFsP = I  6          RcB@seZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z eeed Zed ZRS(s(Represents a column in a database table.RcO@s|jdt}|jdt}t|}|rt|dtjr||tk rjtjdn|jd}nn|r|d}t|dr|tk rtjdn|jd}nn|tk rt ||jdt}nd|krtjdnt t |j |||jd ||_ |jd t|_|jd |j |_|jd t|_|jd t|_|jdt|_|jdt|_|jdt|_|jdt|_|jdt|_|jdt|_|jdd|_t|_t|_|jdt|_d|kr|jd|_n%t|jt r|jj!|n|jtk rEt|jt"t#fr|j$|jnct%|jdtr,t|jtj&r)tj'd|j |jfnn|j$t"|jn|jtk rt|jt(r|j$|jj)tn|j$t*|jn|jtk rt|jt"t#fr|j$|jn|j$t"|jdt+n|jtk rPt|jt(r1|j$|jj)t+n|j$t*|jdt+n|j,|tj-|d|kr|jd|_.n|j/|dS(s#4 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.TypeEngine`. 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 the ``type`` is ``None`` or is omitted, it will first default to the special type :class:`.NullType`. If and when this :class:`.Column` is made to refer to another column using :class:`.ForeignKey` and/or :class:`.ForeignKeyConstraint`, the type of the remote-referenced column will be copied to this column as well, at the moment that the foreign key is resolved against that remote :class:`.Column` object. .. versionchanged:: 0.9.0 Support for propagation of type to a :class:`.Column` from its :class:`.ForeignKey` object has been improved and should be more reliable and timely. :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: Set up "auto increment" semantics for an integer primary key column. The default value is the string ``"auto"`` which indicates that a single-column primary key that is of an INTEGER type with no stated client-side or python-side defaults should receive auto increment semantics automatically; all other varieties of primary key columns will not. This includes that :term:`DDL` such as PostgreSQL SERIAL or MySQL AUTO_INCREMENT will be emitted for this column during a table create, as well as that the column is assumed to generate new integer primary key values when an INSERT statement invokes which will be retrieved by the dialect. The flag may be set to ``True`` to indicate that a column which is part of a composite (e.g. multi-column) primary key should have autoincrement semantics, though note that only one column within a primary key may have this setting. It can also be set to ``True`` to indicate autoincrement semantics on a column that has a client-side or server-side default configured, however note that not all dialects can accommodate all styles of default as an "autoincrement". It can also be set to ``False`` on a single-column primary key that has a datatype of INTEGER in order to disable auto increment semantics for that column. .. versionchanged:: 1.1 The autoincrement flag now defaults to ``"auto"`` which indicates autoincrement semantics by default for single-column integer primary keys only; for composite (multi-column) primary keys, autoincrement is never implicitly enabled; as always, ``autoincrement=True`` will allow for at most one of those columns to be an "autoincrement" column. ``autoincrement=True`` may also be set on a :class:`.Column` that has an explicit client-side or server-side default, subject to limitations of the backend database and dialect. The setting *only* has an effect for columns which are: * Integer derived (i.e. INT, SMALLINT, BIGINT). * Part of the primary key * Not referring to another column via :class:`.ForeignKey`, unless the value is specified as ``'ignore_fk'``:: # turn on autoincrement for this column despite # the ForeignKey() Column('id', ForeignKey('other.id'), primary_key=True, autoincrement='ignore_fk') It is typically not desirable to have "autoincrement" enabled on a column that refers to another via foreign key, as such a column is required to refer to a value that originates from elsewhere. The setting has these two effects on columns that meet the above criteria: * DDL issued for the column will include database-specific keywords intended to signify this column as an "autoincrement" column, such as AUTO INCREMENT on MySQL, SERIAL on PostgreSQL, and IDENTITY on MS-SQL. It does *not* issue AUTOINCREMENT for SQLite since this is a special SQLite flag that is not required for autoincrementing behavior. .. seealso:: :ref:`sqlite_autoincrement` * The column will be considered to be available using an "autoincrement" method specific to the backend database, such as calling upon ``cursor.lastrowid``, using RETURNING in an INSERT statement to get at a sequence-generated value, or using special functions such as "SELECT scope_identity()". These methods are highly specific to the DBAPIs and databases in use and vary greatly, so care should be taken when associating ``autoincrement=True`` with a custom default generation function. :param default: A scalar, Python callable, or :class:`.ColumnElement` expression 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; see that class for full detail on the structure of the argument. Contrast this argument to :paramref:`.Column.server_default` which creates a default generator on the database side. .. seealso:: :ref:`metadata_defaults_toplevel` :param doc: optional String that can be used by the ORM or similar to document attributes on the Python side. This attribute does **not** render SQL comments; use the :paramref:`.Column.comment` parameter for this purpose. :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: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. :param nullable: When set to ``False``, will cause the "NOT NULL" phrase to be added when generating DDL for the column. When ``True``, will normally generate nothing (in SQL this defaults to "NULL"), except in some very specific backend-specific edge cases where "NULL" may render explicitly. Defaults to ``True`` unless :paramref:`~.Column.primary_key` is also ``True``, in which case it defaults to ``False``. 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 will 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``. .. seealso:: :ref:`metadata_defaults` - complete discussion of onupdate :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()')) 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. .. seealso:: :ref:`server_defaults` - complete discussion of server side defaults :param server_onupdate: A :class:`.FetchedValue` instance representing a database-side default generation function, such as a trigger. This indicates to SQLAlchemy that a newly generated value will be available after updates. This construct does not actually implement any kind of generation function within the database, which instead must be specified separately. .. seealso:: :ref:`triggered_columns` :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. :param system: When ``True``, indicates this is a "system" column, that is a column which is automatically made available by the database, and should not be included in the columns list for a ``CREATE TABLE`` statement. For more elaborate scenarios where columns should be conditionally rendered differently on different backends, consider custom compilation rules for :class:`.CreateColumn`. :param comment: Optional string that will render an SQL comment on table creation. .. versionadded:: 1.2 Added the :paramref:`.Column.comment` parameter to :class:`.Column`. Rttype_is0May not pass name positionally and as a keyword.t _sqla_types1May not pass type_ positionally and as a keyword.R5s9Explicit 'name' is required when sending 'quote' argumentRRtnullabletdefaulttserver_defaulttserver_onupdateRRtsystemtdoctonupdatet autoincrementtautoRlt_proxiest_warn_on_bytestrings?Unicode column '%s' has non-unicode default value %r specified.t for_updateR2N(0RPRRRRt string_typesRRRthasattrRRoRRbRRQRRRRRRRRRRRRpRrRvRlRttypeRR*t ColumnDefaulttSequenceRRt binary_typeRt FetchedValuet_as_for_updatet DefaultClauseRuR.tset_creation_orderR2R{(R+R,R/RRtcoltype((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbs               cK@s|j|dS(N(R(R+R/((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR{jscC@sX|jdkrdS|jdk rM|jjrC|jjd|jS|jSn|jSdS(Ns (no name)R(RRRtnamed_with_columnR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRqs  cC@s8x1|jD]"}|jjj|jr tSq WtSdS(sOReturn True if this Column references the given column via foreign key.N(RvRt proxy_sett intersectionRuRQ(R+Rtfk((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt references|scC@s|j|dS(N(R*(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytappend_foreign_keysc C@stg}|j|jkr(|jdn|jrA|jdn|jsZ|jdn|jrs|jdn|jr|jdn|jr|jdnddjt |jgt |j gg|j D]}|dk rt |^qg|j D]}t |^q|jdk r8d |jjp;d gg|D]%}d |t t||f^qFS( NRRRRRRs Column(%s)s, s table=<%s>s table=Nones%s=%s(RRRRRRRRRRRRvRRrRRR(R+tkwargRR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR4s      c@s1|jstjdn|jdkr9|j|_nt|dd}|dk r|k rtjd|j|jfn|jjkr jj|j}||k r xL|j D]>}j j ||j j krj j |j qqWq njj ||jr6jj|n4|jjkrjtjd|jjfn|_|jrt|jtjrtjdntd|dt|jdtnO|jrt|jtjrtjdnjt|jdtn|jfd dS( NsfColumn must be constructed with a non-blank name or assign a non-blank .name before adding to a Table.Rs1Column object '%s' already assigned to Table '%s'sTTrying to redefine primary-key column '%s' as a non-primary-key column on table '%s'sThe 'index' keyword argument on Column is boolean only. To create indexes with a specific name, create an explicit Index object external to the Table.RRsThe '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.c@s |jS(N(t_set_remote_table(R(R(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRRc(RRRRRRRRRsR;RvRRRrR$Rt_replaceRxRRRRRRRTRRuRtUniqueConstraintt_setup_on_memoized_fks(R+RtexistingR!R((RsH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRsJ        %  cC@s|jj|jftf|jj|jftfg}xf|D]^\}}||jjjkr=x:|jjj|D]"}|j|krr||qrqrWq=q=WdS(N(RRRQRRuR_t _fk_memost link_to_name(R+R~tfk_keystfk_keyRR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRscC@s9|jdk r"|||jntj|d|dS(NRZ(RRRRy(R+R~((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_on_table_attachsc K@s$g|jD]}|js |j|^q g|jD]}|js5|j|^q5}|j}t|tr|j|}n|jd|j d|d|j d|j d|j d|j d|jd|jd |jd |jd |jd |jd |jd|jd|j|}|j|S(siCreate a copy of this ``Column``, uninitialized. This is used in ``Table.tometadata``. RRRRRRRRRRRRRRRl(RrRR7RvRRRRt _constructorRRRRRRRRRRRRRRlR:(R+R^R R,R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR7s. +/                c K@syg|jD]}t|jd|j^q }|dkr[|jdkr[tjdny||j|rt |py|jn |p|j|j d|r|n|r|n|j d|j d|j d|g|}Wn+tk rtjtd|jnX||_|jj||jdk rF|jj|j |_n|j rb|j j|n|jj|||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). The column should be used only in select scenarios, as its full DDL/default information is not transferred. t _constraints^Cannot initialize a sub-selectable with this Column object until its 'name' has been assigned.RRRRsCould not create a copy of this %r object. Ensure the class includes a _constructor() attribute or method which accepts the standard Column constructor arguments, or references the Column class itself.N(Rvt ForeignKeyRRRRRRURRRRRRRNRtraise_from_causet __class__RRsRt _is_clone_ofRR8RZ( R+t selectableRRtname_is_truncatableR^tfRR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _make_proxys8 +   !      cK@sc|rOg|j|jfD]}|dk r|^qt|jt|jStj||SdS(N(RRRRRvRrR R0(R+RR/R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR0PsI(R?R@RARBRbR{RRRR4RRRR7RRQRR0(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs q    ?  &4Rc B@seZdZdZdedddddeddd ZdZddZdddZ e dZ dZ e e Z dZd Zejd Zd Zd Zd ZejdZdZdZdZdZRS(sDefines a dependency 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")) ) Note that ``ForeignKey`` is only a marker object that defines a dependency between two columns. The actual constraint is in all cases represented by the :class:`.ForeignKeyConstraint` object. This object will be generated automatically when a ``ForeignKey`` is associated with a :class:`.Column` which in turn is associated with a :class:`.Table`. Conversely, when :class:`.ForeignKeyConstraint` is applied to a :class:`.Table`, ``ForeignKey`` markers are automatically generated to be present on each associated :class:`.Column`, which are also associated with the constraint object. Note that you cannot define a "composite" foreign key constraint, that is a constraint between a grouping of multiple parent/child columns, using ``ForeignKey`` objects. To define this grouping, the :class:`.ForeignKeyConstraint` object must be used, and applied to the :class:`.Table`. The associated ``ForeignKey`` objects are created automatically. The ``ForeignKey`` objects associated with an individual :class:`.Column` object are available in the `foreign_keys` collection of that column. Further examples of foreign key configuration are in :ref:`metadata_foreignkeys`. t foreign_keyc K@s;||_t|jtjr*d|_nt|jdrQ|jj|_n |j|_t|jtst j d|jn:t|jj tj t fst j d|jj n||_d|_||_||_||_||_||_||_| |_| |_| r.| |_n| |_dS(s9 Construct a column-level FOREIGN KEY. The :class:`.ForeignKey` object when constructed generates a :class:`.ForeignKeyConstraint` which is associated with the parent :class:`.Table` object's collection of constraints. :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 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: passed to the underlying :class:`.ForeignKeyConstraint` to indicate the constraint should be generated/dropped externally from the CREATE TABLE/ DROP TABLE statement. See :paramref:`.ForeignKeyConstraint.use_alter` for further description. .. seealso:: :paramref:`.ForeignKeyConstraint.use_alter` :ref:`use_alter` :param match: Optional string. If set, emit MATCH when issuing DDL for this constraint. Typical values include SIMPLE, PARTIAL and FULL. :param info: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. .. versionadded:: 1.0.0 :param \**dialect_kw: Additional keyword arguments are dialect specific, and passed in the form ``_``. The arguments are ultimately handled by a corresponding :class:`.ForeignKeyConstraint`. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. .. versionadded:: 0.9.2 t__clause_element__s9String, Column, or Column-bound argument expected, got %rs8ForeignKey received Column not bound to a Table, got: %rN(t_colspecRRRRt _table_columnRRR RRRRtNoneTypeRRtparentt use_alterRRtondeletet deferrablet initiallyRtmatchR2t_unvalidated_dialect_kw( R+RRRRRRRRRRR2t dialect_kw((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbs8R              cC@sd|jS(NsForeignKey(%r)(t _get_colspec(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR4scC@sst|jd|d|jd|jd|jd|jd|jd|jd|jd |j |j }|j |S( sProduce a copy of this :class:`.ForeignKey` object. The new :class:`.ForeignKey` will not be bound to any :class:`.Column`. This method is usually used by the internal copy procedures of :class:`.Column`, :class:`.Table`, and :class:`.MetaData`. :param schema: The returned :class:`.ForeignKey` will reference the original table and column name, qualified by the given string schema name. RRRRRRRRR( RRRRRRRRRRRR:(R+RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR7s        cC@s|r>|j\}}}|dk r-|}nd|||fS|r~|j\}}}|rmd|||fSd||fSn3|jdk rd|jjj|jjfS|jSdS(sReturn a string based 'column specification' for this :class:`.ForeignKey`. This is usually the equivalent of the string-based "tablename.colname" argument first passed to the object's constructor. s%s.%s.%ss%s.%sN(t_column_tokensRRRRxRR(R+Rt table_namet_schemattnametcolname((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs   cC@s |jdS(Ni(R(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR9scC@sX|jdk r5|jjdkr%dS|jjjSn|j\}}}t||SdS(N(RRRRRR(R+RR R ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _table_key=s cC@s|j|jdk S(s\Return True if the given :class:`.Table` is referenced by this :class:`.ForeignKey`.N(tcorresponding_columnRR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRIscC@s|j|jS(sReturn the :class:`.Column` in the given :class:`.Table` referenced by this :class:`.ForeignKey`. Returns None if this :class:`.ForeignKey` does not reference the given :class:`.Table`. (R R(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt get_referentOs cC@s|jjd}|dkr:tjd|jnt|dkra|j}d}n|j}|j}t|dkrdj|}nd}|||fS(s7parse a string-based _colspec into its component parts.Rs,Invalid foreign key column specification: %siiN( RtsplitRRRRRtlenRPR(R+tmR R R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRZs     cC@s|jdkr!tjdn$|jjdkrEtjdn|jj}xH|jjD].}t|tr^|j|kstPq^q^Wt st|j \}}}|dkr|j j dk r|j j }nt ||}|||fS(NsLthis ForeignKey object does not yet have a parent Column associated with it.sCthis ForeignKey's parent column is not yet associated with a Table.(RRRRURt base_columnsRRtAssertionErrorRQRR_RR(R+t parenttableR RR R ttablekey((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_resolve_col_tokensys"    cC@st|jds!||j_n|jj|ks9td}|dkrr|j}|jj|jjd}nY|j r|}xG|jD]}|j |kr|}qqWn|}|jj|d}|dkr t j d|j |j |j |f|j |n|j|dS(Nt_referred_tablesiCould not initialize target column for ForeignKey '%s' on table '%s': table '%s' has no column named '%s'(RRRRRRR R;RRRRtNoReferencedColumnErrorRt_set_target_column(R+RRR t_columnRR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_link_to_col_by_colstrings*     c@se|jjjr!j|j_nt|jjtrXfd}|jj|n|_dS(Nc@s%|jjjr!j|j_ndS(N(RRt_isnull(R(R(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytset_types(RRRRRRFRR(R+RR((RsH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs cC@st|jtjr|j\}}}||jkr^tjd|j||f|q|j |jkrtj d|qtj d|j|j ||f||n2t |jdr|jj}|S|j}|SdS(sReturn the target :class:`.Column` referenced by this :class:`.ForeignKey`. If no target column has been established, an exception is raised. .. versionchanged:: 0.9.0 Foreign key target column resolution now occurs as soon as both the ForeignKey object and the remote Column to which it refers are both associated with the same MetaData object. s|Foreign key associated with column '%s' could not find table '%s' with which to generate a foreign key to target column '%s's9Table %s is no longer associated with its parent MetaDatasiCould not initialize target column for ForeignKey '%s' on table '%s': table '%s' has no column named '%s'RN(RRRRRR_RtNoReferencedTableErrorRRRURRRR(R+RRR R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs*    cC@sc|jdk r0|j|k r0tjdn||_|jjj||jj|jdS(Ns&This ForeignKey already has a parent !(RRRRURvRRt _set_table(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs   cC@s<|j\}}}|j||||jj|dS(N(RRRt_validate_dest_table(R+RRRR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR scC@sO|j\}}}||f}||j|krK|j|j|ndS(N(RRR(R+R_Rt table_keyR R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_remove_from_metadatas cC@s|jdkrt|trtggd|jd|jd|jd|jd|j d|j d|j |j |_|jj |||jj|n|jj|t|jtjrN|j\}}}||f}||jjkr4|jj|}y|j|||Wq4tjk r0q4Xn|jj|j|nGt|jdr|jj}|j|n|j}|j|dS( NRRRRRRRR(RRRRFRRRRRRRRRt_append_elementR*RvRRRRRR_RSRRRRRRRR(R+RRRR!R RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs<        N(R?R@RARBRRQRbR4R7RRCRR ttarget_fullnameRRRRERRRRRRRR"R(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR[s:# o      # # 0  t_NotAColumnExprcB@s-eZdZdZZedZRS(cC@stjd|jjdS(Ns7This %s cannot be used directly as a column expression.(RRURR?(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_not_a_column_expr@scC@s |jS(N(R&(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRFRccC@s |jS(N(R&(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRGRc(R?R@R&Rt self_groupRCt _from_objects(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR%?s  tDefaultGeneratorcB@s_eZdZdZeZeZdZedZ dZ ddZ dZ e dZRS(s'Base class for column *default* values.tdefault_generatorcC@s ||_dS(N(R(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbSscC@s1||_|jr!||j_n ||j_dS(N(RRRR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRVs  cK@s+|dkrt|}n|j||S(N(RRt_execute_default(R+RR/((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytexecute]s cC@s|j|||S(N(R+(R+Rt multiparamstparams((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_execute_on_connectionbscC@s-t|dddk r%|jjjSdSdS(s4Return the connectable associated with this default.RN(RRRRR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRes N(R?R@RARBRQt is_sequencetis_server_defaultRRRbRR,R/RCR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR)Js    RcB@seZdZdZejdZejdZejdZejej ddZ dZ dZ e e Zd ZRS( sA plain default value on a column. This could correspond to a constant, a callable function, or a SQL clause. :class:`.ColumnDefault` is generated automatically whenever the ``default``, ``onupdate`` arguments of :class:`.Column` are used. A :class:`.ColumnDefault` can be passed positionally as well. For example, the following:: Column('foo', Integer, default=50) Is equivalent to:: Column('foo', Integer, ColumnDefault(50)) cK@sett|j|t|tr7tjdntj|rX|j |}n||_ dS(sj"Construct a new :class:`.ColumnDefault`. :param arg: argument representing the default value. May be one of the following: * a plain non-callable Python value, such as a string, integer, boolean, or other simple type. The default value will be used as is each time. * a SQL expression, that is one which derives from :class:`.ColumnElement`. The SQL expression will be rendered into the INSERT or UPDATE statement, or in the case of a primary key column when RETURNING is not used may be pre-executed before an INSERT within a SELECT. * A Python callable. The function will be invoked for each new row subject to an INSERT or UPDATE. The callable must accept exactly zero or one positional arguments. The one-argument form will receive an instance of the :class:`.ExecutionContext`, which provides contextual information as to the current :class:`.Connection` in use as well as the current statement and parameters. s4ColumnDefault may not be a server-side default type.N( RoRRbRRRRRRtcallablet_maybe_wrap_callabletarg(R+R4R/((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbs cC@stj|jS(N(RR2R4(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt is_callablescC@st|jtS(N(RR4R (R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytis_clause_elementscC@s|j o|j o|j S(N(R5R6R0(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt is_scalars  ssqlalchemy.sql.sqltypescC@s(|jr t|jj|j StSdS(N(R6RR4RtNullTypeRQ(R+tsqltypes((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _arg_is_typeds c@sytjdt}Wn'tk rBtjfdSX|ddk rct|dpfd}t|d|}|dkrtjfdS|dkrStjddS( sWrap callables that don't accept a context. This is to allow easy compatibility with default callables that aren't specific to accepting of a context. tno_selfc@sS(N((tctx(R~(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRRciic@sS(N((R<(R~(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRRcisDColumnDefault Python function takes zero or one positional argumentsN( Rtget_callable_argspecRuRNt wrap_callableRRRRR(R+R~targspect defaultedt positionals((R~sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR3s &  cC@s|jr dSdSdS(Ntcolumn_onupdatetcolumn_default(R(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _visit_names cC@sd|jfS(NsColumnDefault(%r)(R4(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR4s(R?R@RARbRRER5R6R7t dependenciesR:R3RDRCRBR4(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRns #   RcB@seZdZdZeZddddddddddedddedZe j dZ e j dZ e j ddZdZdZd Zed Zded Zded Zd ZRS(sRepresents a named database sequence. The :class:`.Sequence` object represents the name and configurational parameters of a database sequence. It also represents a construct that can be "executed" by a SQLAlchemy :class:`.Engine` or :class:`.Connection`, rendering the appropriate "next value" function for the target database and returning a result. The :class:`.Sequence` is typically associated with a primary key column:: some_table = Table( 'some_table', metadata, Column('id', Integer, Sequence('some_table_seq'), primary_key=True) ) When CREATE TABLE is emitted for the above :class:`.Table`, if the target platform supports sequences, a CREATE SEQUENCE statement will be emitted as well. For platforms that don't support sequences, the :class:`.Sequence` construct is ignored. .. seealso:: :class:`.CreateSequence` :class:`.DropSequence` tsequencecC@stt|jd|t|| |_||_||_||_||_||_ ||_ ||_ | |_ | |_ | |_| tkrd|_} nF|dk r| dkr|jr|j|_} nt| ||_||_t|| |_|r|j|ndS(sConstruct a :class:`.Sequence` object. :param name: The name of the sequence. :param start: the starting index of the sequence. This value is used when the CREATE SEQUENCE command is emitted to the database as the value of the "START WITH" clause. If ``None``, the clause is omitted, which on most platforms indicates a starting value of 1. :param increment: the increment value of the sequence. This value is used when the CREATE SEQUENCE command is emitted to the database as the value of the "INCREMENT BY" clause. If ``None``, the clause is omitted, which on most platforms indicates an increment of 1. :param minvalue: the minimum value of the sequence. This value is used when the CREATE SEQUENCE command is emitted to the database as the value of the "MINVALUE" clause. If ``None``, the clause is omitted, which on most platforms indicates a minvalue of 1 and -2^63-1 for ascending and descending sequences, respectively. .. versionadded:: 1.0.7 :param maxvalue: the maximum value of the sequence. This value is used when the CREATE SEQUENCE command is emitted to the database as the value of the "MAXVALUE" clause. If ``None``, the clause is omitted, which on most platforms indicates a maxvalue of 2^63-1 and -1 for ascending and descending sequences, respectively. .. versionadded:: 1.0.7 :param nominvalue: no minimum value of the sequence. This value is used when the CREATE SEQUENCE command is emitted to the database as the value of the "NO MINVALUE" clause. If ``None``, the clause is omitted, which on most platforms indicates a minvalue of 1 and -2^63-1 for ascending and descending sequences, respectively. .. versionadded:: 1.0.7 :param nomaxvalue: no maximum value of the sequence. This value is used when the CREATE SEQUENCE command is emitted to the database as the value of the "NO MAXVALUE" clause. If ``None``, the clause is omitted, which on most platforms indicates a maxvalue of 2^63-1 and -1 for ascending and descending sequences, respectively. .. versionadded:: 1.0.7 :param cycle: allows the sequence to wrap around when the maxvalue or minvalue has been reached by an ascending or descending sequence respectively. This value is used when the CREATE SEQUENCE command is emitted to the database as the "CYCLE" clause. If the limit is reached, the next number generated will be the minvalue or maxvalue, respectively. If cycle=False (the default) any calls to nextval after the sequence has reached its maximum value will return an error. .. versionadded:: 1.0.7 :param schema: Optional schema name for the sequence, if located in a schema other than the default. The rules for selecting the schema name when a :class:`.MetaData` is also present are the same as that of :paramref:`.Table.schema`. :param cache: optional integer value; number of future values in the sequence which are calculated in advance. Renders the CACHE keyword understood by Oracle and PostgreSQL. .. versionadded:: 1.1.12 :param order: optional boolean value; if true, renders the ORDER keyword, understood by Oracle, indicating the sequence is definitively ordered. May be necessary to provide deterministic ordering using Oracle RAC. .. versionadded:: 1.1.12 :param optional: boolean value, when ``True``, indicates that this :class:`.Sequence` object only needs to be explicitly generated on backends that don't provide another way to generate primary key identifiers. Currently, it essentially means, "don't create this sequence on the PostgreSQL backend, where the SERIAL keyword creates a sequence for us automatically". :param quote: boolean value, when ``True`` or ``False``, explicitly forces quoting of the schema name on or off. When left at its default of ``None``, normal quoting rules based on casing and reserved words take place. :param quote_schema: set the quoting preferences for the ``schema`` name. :param metadata: optional :class:`.MetaData` object which this :class:`.Sequence` will be associated with. A :class:`.Sequence` that is associated with a :class:`.MetaData` gains the following capabilities: * The :class:`.Sequence` will inherit the :paramref:`.MetaData.schema` parameter specified to the target :class:`.MetaData`, which affects the production of CREATE / DROP DDL, if any. * The :meth:`.Sequence.create` and :meth:`.Sequence.drop` methods automatically use the engine bound to the :class:`.MetaData` object, if any. * The :meth:`.MetaData.create_all` and :meth:`.MetaData.drop_all` methods will emit CREATE / DROP for this :class:`.Sequence`, even if the :class:`.Sequence` is not associated with any :class:`.Table` / :class:`.Column` that's a member of this :class:`.MetaData`. The above behaviors can only occur if the :class:`.Sequence` is explicitly associated with the :class:`.MetaData` via this parameter. .. seealso:: :ref:`sequence_metadata` - full discussion of the :paramref:`.Sequence.metadata` parameter. :param for_update: Indicates this :class:`.Sequence`, when associated with a :class:`.Column`, should be invoked for UPDATE statements on that column's table, rather than for INSERT statements, when no value is otherwise present for that column in the statement. RN(RoRRbRRtstartt incrementtminvaluetmaxvaluet nominvaluet nomaxvaluetcycletcachetordertoptionalRORRR_Rt_keyt _set_metadata(R+RRGRHRIRJRKRLRMRRNRORPR5R_RaR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRb s*           ! cC@stS(N(RQ(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR5 scC@stS(N(RQ(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR6 sssqlalchemy.sql.functions.funccC@s|j|d|jS(sReturn a :class:`.next_value` function element which will render the appropriate increment function for this :class:`.Sequence` within any SQL expression. R(t next_valueR(R+tfunc((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRS scC@s*tt|j||j|jdS(N(RoRRRR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR scC@s|j|jdS(N(RRR_(R+RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR scC@s ||_||jj|j when issuing DDL for this constraint. :param info: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. .. versionadded:: 1.0.0 :param _create_rule: a callable which is passed the DDLCompiler object during compilation. Returns True or False to signal inline generation of this Constraint. The AddConstraint and DropConstraint DDL constructs provide DDLElement's more comprehensive "conditional DDL" approach that is passed a database connection when DDL is being issued. _create_rule is instead called during any CREATE TABLE compilation, where there may not be any transaction/connection in progress. However, it allows conditional compilation of the constraint even for backends which do not support addition of constraints through ALTER TABLE, which currently includes SQLite. _create_rule is used by some types to create constraints. Currently, its call signature is subject to change at any time. :param \**dialect_kw: Additional keyword arguments are dialect specific, and passed in the form ``_``. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. N( RRRR2t _create_ruleRRRR(R+RRRR_R2RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbQ s4       cC@sDyt|jtr|jSWntk r0nXtjddS(NsdThis constraint is not bound to a table. Did you mean to call table.append_constraint(constraint) ?(RRRFtAttributeErrorRRU(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR s  cC@s||_|jj|dS(N(RRrR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR s cK@s tdS(N(tNotImplementedError(R+R^((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR7 sN( R?R@RARBRRQRbRCRRR7(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR^L s 7 cC@sCt|dr|j}nt|ts?tjdn|S(NRsschema.Column object expected(RRRRRRR(telement((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_to_schema_column s cC@sWt|dr|j}nt|tjtfsSd}tj||n|S(NRs1Element %r is not a string name or column element(RRRRRR RRR(RbR`((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_to_schema_column_or_string s tColumnCollectionMixincB@sAeZdZeZdZedZedZ dZ RS(cO@su|jdt}|jdt|_t|_g|D]}t|^q:|_|rq|jrq|jndS(Nt _autoattachR( RPRuRQRRRRdt_pending_colargst _check_attach(R+RR^RfR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRb s  "cc@sx|D]}d}d}t|dr7|j}nt|ttfsU|}n6g}tj|ii|jd6|r|d}n|dk r|n|}||||fVqWdS(NRRi( RRRRR RRttraverseR(R]RRtstrnameRtcolst add_element((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt"_extract_col_expression_collection s   c @sgjD]}t|tr |^q }g|D]}t|jtr2|^q2}t|j|r| stdtjj|}|sfd}_xD]}|j |qWdSn|}d|D} t | dkr j | j nt | dkrj r|dj} g|dD]}|j| k rT|^qT} | rtjddjd| D| jfqndS( Ns#Should not reach here on event callc@s<t|tr8j|s8jdtq8ndS(NR}(RRFtdiscardRhRu(RR(t cols_wo_tableR+(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _col_attached s cS@sh|]}|jqS((R(RR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys s iis(Column(s) %s are not part of table '%s'.s, cs@s|]}d|VqdS(s'%s'N((RR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys  s(RgRRRRFRpt differenceRt_cols_wo_tableRRR*RPt_allow_multiple_tablesRRRRR( R+R}R tcol_objst cols_w_tablethas_string_colsRpR!RRSRtothers((RoR+sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRh s0++   ,cC@sJxC|jD]8}t|tjr2|j|}n|jj|q WdS(N(RgRRRR RR(R+RR!((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR sN( R?R@RRRQRsRbt classmethodRmRhR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRe s   0tColumnCollectionConstraintcB@sSeZdZdZdZdZdZdZdZ dZ dZ RS( s-A constraint that proxies a ColumnCollection.cO@sT|jdt}|jdt}tj||tj|d|d||dS(sZ :param \*columns: A sequence of column names or Column objects. :param name: Optional, the in-database name of this constraint. :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 \**kw: other keyword arguments including dialect-specific arguments are propagated to the :class:`.Constraint` superclass. RfRN(RPRuRQR^RbRe(R+RR^RfR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRb s cC@s$tj||tj||dS(N(R^RRe(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR8 scC@s ||jkS(N(R(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt __contains__< scK@s@|jd|jd|jd|j|jj}|j|S(NRRR(RRRRRtkeysR:(R+R^R ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR7? s    cC@s|jj|S(sReturn True if this constraint contains the given column. Note that this object also contains an attribute ``.columns`` which is a :class:`.ColumnCollection` of :class:`.Column` objects. (Rtcontains_column(R+R!((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR|H sc@s#|jjfdjDS(Nc3@s|]}|VqdS(N((RR(t ordered_dict(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys W s(Rt_datat_list(R+((R}sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt__iter__R s cC@st|jjS(N(RRR~(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt__len__Y sN( R?R@RARbRRRRzR7R|RR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRy s    tCheckConstraintc B@sheZdZeZedddddddddeedZdZ e e Z ddZ RS(slA table- or column-level CHECK constraint. Can be included in the definition of a Table or Column. tsqltexts:class:`.CheckConstraint`s$:paramref:`.CheckConstraint.sqltext`c K@st|dt|_g} tj|jii| jd6tt|jd|d|d|d|d|d| d || | |d k r|j |nd S( sConstruct a CHECK constraint. :param sqltext: A string containing the constraint definition, which will be used verbatim, or a SQL expression construct. If given as a string, the object is converted to a :func:`.text` object. If the textual string includes a colon character, escape this using a backslash:: CheckConstraint(r"foo ~ E'a(?\:b|c)d") :param name: Optional, the in-database name of the constraint. :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 info: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. .. versionadded:: 1.0.0 tallow_coercion_to_textRRRRR_R2RRfN( R RuRRRiRRoRRbRR*( R+RRRRRR2R_RfRR^R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbe s.  cC@st|jtrdSdSdS(Ntcheck_constrainttcolumn_check_constraint(RRRF(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRB scK@s|dk r't|j|j|}n |j}t|d|jd|jd|jd|jd|dt d|j }|j |S(NRRRR_RRfR( RR'RRRRRRR_RQRR:(R+R#R^RR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR7 s       N( R?R@RARuRsR RRQRbRBRCR7(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR] s"2  Rc B@seZdZdZd d d d d eed d d d ZdZd Zd Z e dZ e dZ e dZ dZe dZe d Zd Zd d d ZRS( sA 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 K@stj|d|d|d|d| | ||_||_| |_||_| |_tt|t|krtt|t|krt j dqt j dng|D]f}t |d|d|j d|jd |jd |jd |jd |jd|j d|j|j ^q|_tj||| dk r~t|d rn| |jksntn|j| ndS(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 the DDL for this constraint as part of the CREATE TABLE definition. Instead, generate it via an ALTER TABLE statement issued after the full collection of tables have been created, and drop it via an ALTER TABLE statement before the full collection of tables are dropped. The use of :paramref:`.ForeignKeyConstraint.use_alter` is particularly geared towards the case where two or more tables are established within a mutually-dependent foreign key constraint relationship; however, the :meth:`.MetaData.create_all` and :meth:`.MetaData.drop_all` methods will perform this resolution automatically, so the flag is normally not needed. .. versionchanged:: 1.0.0 Automatic resolution of foreign key cycles has been added, removing the need to use the :paramref:`.ForeignKeyConstraint.use_alter` in typical use cases. .. seealso:: :ref:`use_alter` :param match: Optional string. If set, emit MATCH when issuing DDL for this constraint. Typical values include SIMPLE, PARTIAL and FULL. :param info: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. .. versionadded:: 1.0.0 :param \**dialect_kw: Additional keyword arguments are dialect specific, and passed in the form ``_``. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. .. versionadded:: 0.9.2 RRRR2sOForeignKeyConstraint with duplicate source column references are not supported.s_ForeignKeyConstraint number of constrained columns must match the number of referenced columns.RRRRRRRN(R^RbRRRRRRRpRRRRRRRtdialect_kwargstelementsReRRRRR*(R+Rt refcolumnsRRRRRRRRRR2Rtrefcol((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRb s2V        s cC@s$|jj||jj|dS(N(RRRR(R+RR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR#_ scC@stjt|j|jS(N(Rt OrderedDicttzipt column_keysR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt _elementss scC@s x|jD] }|jSWdSdS(N(RRR(R+telem((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRx scC@s|jdjjS(s^The :class:`.Table` object to which this :class:`.ForeignKeyConstraint` references. This is a dynamically calculated attribute which may not be available if the constraint and/or parent table is not yet associated with a metadata collection that contains the referred table. .. versionadded:: 1.0.0 i(RRR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytreferred_table s cC@stg|jD]}|j^q }d|krt|dkrt|dd!\}}tjd|j|j ||fndS(NiiisJForeignKeyConstraint on %s(%s) refers to multiple remote tables: %s and %s( RpRR RRRRRRRxt_col_description(R+RRt table_keystelem0telem1((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR  s (cC@sXt|dr|jjSg|jD]*}t|trD|jn t|^q&SdS(sReturn a list of string keys representing the local columns in this :class:`.ForeignKeyConstraint`. This list is either the original string arguments sent to the constructor of the :class:`.ForeignKeyConstraint`, or if the constraint has been initialized with :class:`.Column` objects, is the string .key of each element. .. versionadded:: 1.0.0 RN(RRR{RgRR Rtstr(R+R!((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR s  cC@sdj|jS(Ns, (RR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR scC@stj||ytj||Wn6tk r\}tjd|j|jdfnXxRt|j |j D];\}}t |d s|j |k rs|j |qsqsW|j|dS(NsQCan't create ForeignKeyConstraint on table '%s': no column named '%s' is present.iR(R^RRytKeyErrorRRRRR,RRRRRR*R (R+RtkeR!R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR s"cK@s tg|jD]}|jj^q g|jD]N}|jd|d|dk rq|j|jjjkrq|jnd^q,d|jd|j d|j d|j d|j d|j d |jd |j}x0t|j|jD]\}}|j|qW|j|S( NRRRRRRRRRR(RRRRRRR RRRRRRRRRRR:(R+RR#R^RRtself_fktother_fk((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR7 s[        "N(R?R@RARBRRQRbR#RRRCRRRR RRRR7(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR s.     RtcB@sYeZdZdZdZdZdZdZedZ e j dZ RS(s A table-level PRIMARY KEY constraint. The :class:`.PrimaryKeyConstraint` object is present automatically on any :class:`.Table` object; it is assigned a set of :class:`.Column` objects corresponding to those marked with the :paramref:`.Column.primary_key` flag:: >>> my_table = Table('mytable', metadata, ... Column('id', Integer, primary_key=True), ... Column('version_id', Integer, primary_key=True), ... Column('data', String(50)) ... ) >>> my_table.primary_key PrimaryKeyConstraint( Column('id', Integer(), table=, primary_key=True, nullable=False), Column('version_id', Integer(), table=, primary_key=True, nullable=False) ) The primary key of a :class:`.Table` can also be specified by using a :class:`.PrimaryKeyConstraint` object explicitly; in this mode of usage, the "name" of the constraint can also be specified, as well as other options which may be recognized by dialects:: my_table = Table('mytable', metadata, Column('id', Integer), Column('version_id', Integer), Column('data', String(50)), PrimaryKeyConstraint('id', 'version_id', name='mytable_pk') ) The two styles of column-specification should generally not be mixed. An warning is emitted if the columns present in the :class:`.PrimaryKeyConstraint` don't match the columns that were marked as ``primary_key=True``, if both are present; in this case, the columns are taken strictly from the :class:`.PrimaryKeyConstraint` declaration, and those columns otherwise marked as ``primary_key=True`` are ignored. This behavior is intended to be backwards compatible with previous behavior. .. versionchanged:: 0.9.2 Using a mixture of columns within a :class:`.PrimaryKeyConstraint` in addition to columns marked as ``primary_key=True`` now emits a warning if the lists don't match. The ultimate behavior of ignoring those columns marked with the flag only is currently maintained for backwards compatibility; this warning may raise an exception in a future release. For the use case where specific options are to be specified on the :class:`.PrimaryKeyConstraint`, but the usual style of using ``primary_key=True`` flags is still desirable, an empty :class:`.PrimaryKeyConstraint` may be specified, which will take on the primary key column collection from the :class:`.Table` based on the flags:: my_table = Table('mytable', metadata, Column('id', Integer, primary_key=True), Column('version_id', Integer, primary_key=True), Column('data', String(50)), PrimaryKeyConstraint(name='mytable_pk', mssql_clustered=True) ) .. versionadded:: 0.9.2 an empty :class:`.PrimaryKeyConstraint` may now be specified for the purposes of establishing keyword arguments with the constraint, independently of the specification of "primary key" columns within the :class:`.Table` itself; columns marked as ``primary_key=True`` will be gathered into the empty constraint's column collection. tprimary_key_constraintcO@s2|jdt|_tt|j||dS(NRd(RPRQRdRoRtRb(R+RR^((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRb) scC@sLtt|j||j|k rT|jj|j||_|jj|ng|jD]}|jr^|^q^}|jr|rt |t |jj krt j d|j djd|Ddjd|jDdjd|jDfg|(nx#|jD]}t|_t|_qW|jj|dS(NsTable '%s' specifies columns %s as primary_key=True, not matching locally specified columns %s; setting the current primary key columns to %s. This warning may become an exception in a future releases, cs@s|]}d|jVqdS(s'%s'N(R(RR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys B scs@s|]}d|jVqdS(s'%s'N(R(RR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys C scs@s|]}d|jVqdS(s'%s'N(R(RR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys D s(RoRtRRRrRnRR RRptvaluesRRRRRuRQRtextend(R+RR t table_pks((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR- s( % !!   cC@sNx|D]}t|_qW|jj|tjj||j|jdS(sDrepopulate this :class:`.PrimaryKeyConstraint` given a set of columns. Existing columns in the table that are marked as primary_key=True are maintained. Also fires a new event. This is basically like putting a whole new :class:`.PrimaryKeyConstraint` object on the parent :class:`.Table` object without actually replacing the object. The ordering of the given list of columns is also maintained; these columns will be appended to the list of columns after any which are already present. N( RuRRRRtRt_resetR*R(R+RR!((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_reloadN s   cC@s$tjj||jj|dS(N(RtRRRR$(R+R!((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRl scC@sS|j}|dk rB|gg|jD]}||k r%|^q%St|jSdS(N(RRRR(R+tautoincR ((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytcolumns_autoinc_firstp s  -cC@sd}t|jdkrvt|jd}|jtkrQ||t|S|jdkr||tr|Snqd}xd|jD]Y}|jtkr||t|dk rtjd|j |j fq|}qqW|SdS(NcS@s|jjdks.t|jjtjj rZ|rStjd|j|fqtSnft |j tdt f r| rtS|j dk r| rtS|j r|jtdfkrtStS(NsGColumn type %s on column '%s' is not compatible with autoincrement=Truet ignore_fk(Rt_type_affinityRt issubclassRt INTEGERTYPERRRRQRRRRRvRRu(R!t autoinc_true((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_validate_autoinc{ s" iiRRsGOnly one Column may be marked autoincrement=True, found both %s and %s.(RR( RRRRRuRQRRRRR(R+RR!R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRy s*      ( R?R@RARBRbRRRRCRRRER(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRt sH  !   RcB@seZdZdZRS(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_constraint(R?R@RARB(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR sRcB@sVeZdZdZdZdZedZddZ ddZ dZ RS( sd A table-level INDEX. Defines a composite (one or more column) INDEX. E.g.:: sometable = Table("sometable", metadata, Column("name", String(50)), Column("address", String(100)) ) Index("some_index", sometable.c.name) For a no-frills, single column index, adding :class:`.Column` also supports ``index=True``:: sometable = Table("sometable", metadata, Column("name", String(50), index=True) ) For a composite index, multiple columns can be specified:: Index("some_index", sometable.c.name, sometable.c.address) Functional indexes are supported as well, typically by using the :data:`.func` construct in conjunction with table-bound :class:`.Column` objects:: Index("some_index", func.lower(sometable.c.name)) An :class:`.Index` can also be manually associated with a :class:`.Table`, either through inline declaration or using :meth:`.Table.append_constraint`. When this approach is used, the names of the indexed columns can be specified as strings:: Table("sometable", metadata, Column("name", String(50)), Column("address", String(100)), Index("some_index", "name", "address") ) To support functional or expression-based indexes in this form, the :func:`.text` construct may be used:: from sqlalchemy import text Table("sometable", metadata, Column("name", String(50)), Column("address", String(100)), Index("some_index", text("lower(name)")) ) .. versionadded:: 0.9.5 the :func:`.text` construct may be used to specify :class:`.Index` expressions, provided the :class:`.Index` is explicitly associated with the :class:`.Table`. .. seealso:: :ref:`schema_indexes` - General information on :class:`.Index`. :ref:`postgresql_indexes` - PostgreSQL-specific options available for the :class:`.Index` construct. :ref:`mysql_indexes` - MySQL-specific options available for the :class:`.Index` construct. :ref:`mssql_indexes` - MSSQL-specific options available for the :class:`.Index` construct. Rc O@s8d|_}g}g}xL|j|D];\}}} } | dk rW|j| n|j|q)W||_t||jdd|_|jdt|_ |jdt} d|kr|jd|_ nd|kr|jd}n|j |t j |d| ||dk r4|j|ndS(s~Construct an index object. :param name: The name of the index :param \*expressions: Column expressions to include in the index. The expressions are normally instances of :class:`.Column`, but may also be arbitrary SQL expressions which ultimately refer to a :class:`.Column`. :param unique=False: Keyword only argument; if True, create a unique index. :param quote=None: Keyword only argument; whether to apply quoting to the name of the index. Works in the same manner as that of :paramref:`.Column.quote`. :param info=None: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. .. versionadded:: 1.0.0 :param \**kw: Additional keyword arguments not mentioned above are dialect specific, and passed in the form ``_``. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. R5RRR2RN(RRRmRRRRPRRQRR2RReRbR( R+RRR^RRtprocessed_expressionsRRRjRlR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbs*       cC@stj|||jdk rY||jk rYtjd|j|jj|jfn||_|jj |gt j |j |j D]'\}}t|tr|n|^q|_ dS(NsKIndex '%s' is against table '%s', and cannot be associated with table '%s'.(ReRRRRRRRRRqRRt zip_longestRRRR (R+RRtcolexpr((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRMs" cC@s |jjS(s2Return the connectable associated with this Index.(RR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR`scC@s2|dkrt|}n|jtj||S(sIssue a ``CREATE`` statement for this :class:`.Index`, using the given :class:`.Connectable` for connectivity. .. seealso:: :meth:`.MetaData.create_all`. N(RRRRR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRfs cC@s2|dkrt|}n|jtj|dS(sIssue a ``DROP`` statement for this :class:`.Index`, using the given :class:`.Connectable` for connectivity. .. seealso:: :meth:`.MetaData.drop_all`. N(RRRRR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRus cC@sSddjt|jgg|jD]}t|^q"|jrJdgpMgS(Ns Index(%s)s, s unique=True(RRRRR(R+te((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR4sN( R?R@RARBRbRRCRRRRR4(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR sG E   six_%(column_0_label)stixtMetaDatacB@s4eZdZdZejdddedddddZdZ dZ dZ dZ d Z d Zd Zd Zd ZejddZeeeZdZdZedZddedeeedZejdddZddedZddedZRS(sA collection of :class:`.Table` objects and their associated schema constructs. Holds a collection of :class:`.Table` objects as well as an optional binding to an :class:`.Engine` or :class:`.Connection`. If bound, the :class:`.Table` objects in the collection and their columns may participate in implicit SQL execution. The :class:`.Table` objects themselves are stored in the :attr:`.MetaData.tables` dictionary. :class:`.MetaData` is a thread-safe object for read operations. Construction of new tables within a single :class:`.MetaData` object, either explicitly or via reflection, may not be completely thread-safe. .. seealso:: :ref:`metadata_describing` - Introduction to database metadata R_treflects0.8sThe :paramref:`.MetaData.reflect` flag is deprecated and will be removed in a future release. Please use the :meth:`.MetaData.reflect` method.cC@stj|_t|||_|r-|nt|_|rH||_nt|_ i|_ t j t |_||_|r|stjdn|jndS(sCreate a new MetaData object. :param 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. :param reflect: Optional, automatically load all tables from the bound database. Defaults to False. ``bind`` is required when this option is set. :param schema: The default schema to use for the :class:`.Table`, :class:`.Sequence`, and potentially other objects associated with this :class:`.MetaData`. Defaults to ``None``. When this value is set, any :class:`.Table` or :class:`.Sequence` which specifies ``None`` for the schema parameter will instead have this schema name defined. To build a :class:`.Table` or :class:`.Sequence` that still has ``None`` for the schema even when this parameter is present, use the :attr:`.BLANK_SCHEMA` symbol. .. note:: As referred above, the :paramref:`.MetaData.schema` parameter only refers to the **default value** that will be applied to the :paramref:`.Table.schema` parameter of an incoming :class:`.Table` object. It does not refer to how the :class:`.Table` is catalogued within the :class:`.MetaData`, which remains consistent vs. a :class:`.MetaData` collection that does not define this parameter. The :class:`.Table` within the :class:`.MetaData` will still be keyed based on its schema-qualified name, e.g. ``my_metadata.tables["some_schema.my_table"]``. The current behavior of the :class:`.ForeignKey` object is to circumvent this restriction, where it can locate a table given the table name alone, where the schema will be assumed to be present from this value as specified on the owning :class:`.MetaData` collection. However, this implies that a table qualified with BLANK_SCHEMA cannot currently be referred to by string name from :class:`.ForeignKey`. Other parts of SQLAlchemy such as Declarative may not have similar behaviors built in, however may do so in a future release, along with a consistent method of referring to a table in BLANK_SCHEMA. .. seealso:: :paramref:`.Table.schema` :paramref:`.Sequence.schema` :param quote_schema: Sets the ``quote_schema`` flag for those :class:`.Table`, :class:`.Sequence`, and other objects which make usage of the local ``schema`` name. :param info: Optional data dictionary which will be populated into the :attr:`.SchemaItem.info` attribute of this object. .. versionadded:: 1.0.0 :param naming_convention: a dictionary referring to values which will establish default naming conventions for :class:`.Constraint` and :class:`.Index` objects, for those objects which are not given a name explicitly. The keys of this dictionary may be: * a constraint or Index class, e.g. the :class:`.UniqueConstraint`, :class:`.ForeignKeyConstraint` class, the :class:`.Index` class * a string mnemonic for one of the known constraint classes; ``"fk"``, ``"pk"``, ``"ix"``, ``"ck"``, ``"uq"`` for foreign key, primary key, index, check, and unique constraint, respectively. * the string name of a user-defined "token" that can be used to define new naming tokens. The values associated with each "constraint class" or "constraint mnemonic" key are string naming templates, such as ``"uq_%(table_name)s_%(column_0_name)s"``, which describe how the name should be composed. The values associated with user-defined "token" keys should be callables of the form ``fn(constraint, table)``, which accepts the constraint/index object and :class:`.Table` as arguments, returning a string result. The built-in names are as follows, some of which may only be available for certain types of constraint: * ``%(table_name)s`` - the name of the :class:`.Table` object associated with the constraint. * ``%(referred_table_name)s`` - the name of the :class:`.Table` object associated with the referencing target of a :class:`.ForeignKeyConstraint`. * ``%(column_0_name)s`` - the name of the :class:`.Column` at index position "0" within the constraint. * ``%(column_0N_name)s`` - the name of all :class:`.Column` objects in order within the constraint, joined without a separator. * ``%(column_0_N_name)s`` - the name of all :class:`.Column` objects in order within the constraint, joined with an underscore as a separator. * ``%(column_0_label)s``, ``%(column_0N_label)s``, ``%(column_0_N_label)s`` - the label of either the zeroth :class:`.Column` or all :class:`.Columns`, separated with or without an underscore * ``%(column_0_key)s``, ``%(column_0N_key)s``, ``%(column_0_N_key)s`` - the key of either the zeroth :class:`.Column` or all :class:`.Columns`, separated with or without an underscore * ``%(referred_column_0_name)s``, ``%(referred_column_0N_name)s`` ``%(referred_column_0_N_name)s``, ``%(referred_column_0_key)s``, ``%(referred_column_0N_key)s``, ... column tokens which render the names/keys/labels of columns that are referenced by a :class:`.ForeignKeyConstraint`. * ``%(constraint_name)s`` - a special key that refers to the existing name given to the constraint. When this key is present, the :class:`.Constraint` object's existing name will be replaced with one that is composed from template string that uses this token. When this token is present, it is required that the :class:`.Constraint` is given an explicit name ahead of time. * user-defined: any additional token may be implemented by passing it along with a ``fn(constraint, table)`` callable to the naming_convention dictionary. .. versionadded:: 1.3.0 - added new ``%(column_0N_name)s``, ``%(column_0_N_name)s``, and related tokens that produce concatenations of names, keys, or labels for all columns referred to by a given constraint. .. seealso:: :ref:`constraint_naming_conventions` - for detailed usage examples. s8A bind must be supplied in conjunction with reflect=TrueN(Rt immutabledictRSRRtDEFAULT_NAMING_CONVENTIONtnaming_conventionR2Rpt_schemasRUt collectionst defaultdictRRRRRRR(R+RRRRaRR2((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbs       cC@s d|jS(NsMetaData(bind=%r)(R(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR4sscC@s+t|tjs|j}n||jkS(N(RRRRRS(R+t table_or_key((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRzvs cC@sBt||}tj|j|||r>|jj|ndS(N(Rtdictt __setitem__RSRR(R+RRRR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRX{scC@st||}tj|j|d}|dk rWx!|jD]}|j|q=Wn|jrtg|jj D]}|j dk rs|j ^qs|_ndS(N( RRRPRSRRvR"RRpRR(R+RRRtremovedRtt((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR\s  cC@s@i|jd6|jd6|jd6|jd6|jd6|jd6S(NRSRtschemast sequencestfk_memosR(RSRRRURR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt __getstate__s     cC@s[|d|_|d|_|d|_d|_|d|_|d|_|d|_dS(NRSRRRRR(RSRRRt_bindRURR(R+tstate((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt __setstate__s      cC@s |jdk S(s:True if this MetaData is bound to an Engine or Connection.N(RR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytis_boundscC@s|jS(s An :class:`.Engine` or :class:`.Connection` to which this :class:`.MetaData` is bound. Typically, a :class:`.Engine` is assigned to this attribute so that "implicit execution" may be used, or alternatively as a means of providing engine binding information to an ORM :class:`.Session` object:: engine = create_engine("someurl://") metadata.bind = engine .. seealso:: :ref:`dbengine_implicit` - background on "bound metadata" (R(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRsssqlalchemy.engine.urlcC@s>t|tj|jfr1tj||_n ||_dS(s;Bind this MetaData to an Engine, Connection, string or URL.N(RRRtURLt sqlalchemyt create_engineR(R+turlR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_bind_toscC@s.tj|j|jj|jjdS(s+Clear all Table objects from this MetaData.N(RtclearRSRR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs cC@s|j|j|jdS(s1Remove the given Table object from this MetaData.N(R\RR(R+R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRscC@s%tjt|jjddS(sReturns a list of :class:`.Table` objects sorted in order of foreign key dependency. The sorting will place :class:`.Table` objects that have dependencies first, before the dependencies themselves, representing the order in which they can be created. To get the order in which the tables would be dropped, use the ``reversed()`` Python built-in. .. warning:: The :attr:`.sorted_tables` accessor cannot by itself accommodate automatic resolution of dependency cycles between tables, which are usually caused by mutually dependent foreign key constraints. To resolve these cycles, either the :paramref:`.ForeignKeyConstraint.use_alter` parameter may be applied to those constraints, or use the :func:`.schema.sort_tables_and_constraints` function which will break out foreign key constraints involved in cycles separately. .. seealso:: :func:`.schema.sort_tables` :func:`.schema.sort_tables_and_constraints` :attr:`.MetaData.tables` :meth:`.Inspector.get_table_names` :meth:`.Inspector.get_sorted_table_and_fkc_names` RcS@s|jS(N(R(R((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRRc(Rt sort_tablesRRSR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt sorted_tabless#c K@s|dkrt|}n|j} itd6| d6|d6|d6|d6td6} | j||dkr|j}n|dk r|| d_``. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. .. versionadded:: 0.9.2 - Added :paramref:`.MetaData.reflect.**dialect_kwargs` to support dialect-level reflection options for all :class:`.Table` objects reflected. RfReRIRgRiRhRRs%s.%ss schema '%s'RcsACould not reflect: requested table(s) not available in %r%s: (%s)s, sSkipping table %s: %sN(RRtconnectRuRpRWRRt OrderedSettenginet table_namesRtget_view_namesRSRR2RRURRFtUnreflectableTableErrorR(R+RRtviewstonlyRIRgRiRtconnt reflect_optst availableRtavailable_w_schematcurrenttschnametloadtmissingtstuerr((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs^W        ) !%"  s0.7sthe :meth:`.MetaData.append_ddl_listener` method is deprecated and will be removed in a future release. Please refer to :class:`.DDLEvents`.c@s6fd}tj|d|jdd|dS(s<Append a DDL event listener to this ``MetaData``. c@s$|d}t||d|dS(NRS(R(RRR^RS(R(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs RcRRN(RRyR$(R+RRR((RsH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRs cC@s>|dkrt|}n|jtj|d|d|dS(syCreate all tables stored in this metadata. Conditional by default, will not attempt to recreate tables already present in the target database. :param bind: A :class:`.Connectable` used to access the database; if None, uses the existing bind on this ``MetaData``, if any. :param tables: Optional list of ``Table`` objects, which is a subset of the total tables in the ``MetaData`` (others are ignored). :param checkfirst: Defaults to True, don't issue CREATEs for tables already present in the target database. RRSN(RRRRR(R+RRSR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt create_alls cC@s>|dkrt|}n|jtj|d|d|dS(stDrop all tables stored in this metadata. Conditional by default, will not attempt to drop tables not present in the target database. :param bind: A :class:`.Connectable` used to access the database; if None, uses the existing bind on this ``MetaData``, if any. :param tables: Optional list of ``Table`` objects, which is a subset of the total tables in the ``MetaData`` (others are ignored). :param checkfirst: Defaults to True, only issue DROPs for tables confirmed to be present in the target database. RRSN(RRRRR(R+RRSR((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytdrop_alls (s0.8sThe :paramref:`.MetaData.reflect` flag is deprecated and will be removed in a future release. Please use the :meth:`.MetaData.reflect` method.N(R?R@RARBRRRRQRbRSR4RzRXR\RRRRRERRCRRRRuRRDRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRsJ          ) tThreadLocalMetaDatacB@s_eZdZdZdZdZejddZe eeZdZ dZ 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_cC@s2tjj|_i|_tt|jdS(s Construct a ThreadLocalMetaData.N(Rt threadingtlocaltcontextt_ThreadLocalMetaData__enginesRoRRb(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRbs cC@st|jddS(sThe 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(RRR(R+((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRsssqlalchemy.engine.urlcC@st|tj|jfrry|j||j_Wqtk rntj |}||j|<||j_qXn+||jkr||j|(tobjR<(R=R+(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pytschema_for_object6s t;c3@s#|]}d||fVqdS(s%s=%sN((RR(R=(sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pys ?sRi( R=RRRRRRRQRRRu(R+R=R((R=R+sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyRb2s   (   cC@s1|dkrtSt|tr#|St|SdS(N(Rt_default_schema_mapRR(R]R=((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyt_schema_getterGs  (R=RRR( R?R@RAt __slots__toperatort attrgetterRRbRxR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyR s   (DRAt __future__RRRRRcRRRtbaseRRRRRRR R R R R RRRRRRRRtsymbolRRORR't_self_inspectst VisitableR(RFRRRKR%R)RRRRtdeprecated_clsR]R^RcRdReRyRRRtRRRRRRRRRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/schema.pyts      :]h $w 3$ W  `Ic OC1