oxJdZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd l m Z Gd d eZ Gddee ZGddeZGddeZGddeZGddeZGddeZGddeZGdde ZGddeZGd d!eZGd"d#eZGd$d%eZGd&d'eZGd(d)eZGd*d+eZGd,d-eZGd.d/eZGd0d1eZGd2d3eZ Gd4d5eZ!Gd6d7e!Z"Gd8d9e!Z# d>d;Z$ d?d=Z%d:S)@zq Provides the hierarchy of DDL-defining schema items as well as routines to invoke them for a create/drop call. )_bind_or_error) _generative) Executable) SchemaVisitor) ClauseElement)event)exc)util) topologicalceZdZdZdS) _DDLCompilesc |j||fi|S)zNReturn a compiler appropriate for this ClauseElement, given a Dialect.) ddl_compiler)selfdialectkws /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py _compilerz_DDLCompiles._compilers!$w#GT88R888N)__name__ __module__ __qualname__rrrrrs#99999rrc eZdZdZejddiZdZdZdZ dZ dZ ddZ e jddd Zed Zedd Zd Zd ZdZdZdZdZeeeZdZdS) DDLElementaBase class for DDL expression constructs. This class is the base for the general purpose :class:`.DDL` class, as well as the various create/drop clause constructs such as :class:`.CreateTable`, :class:`.DropTable`, :class:`.AddConstraint`, etc. :class:`.DDLElement` integrates closely with SQLAlchemy events, introduced in :ref:`event_toplevel`. An instance of one is itself an event receiving callable:: event.listen( users, 'after_create', AddConstraint(constraint).execute_if(dialect='postgresql') ) .. seealso:: :class:`.DDL` :class:`.DDLEvents` :ref:`event_toplevel` :ref:`schema_ddl_sequences` autocommitTNc0||||SN) _execute_ddl)r connection multiparamsparamss r_execute_on_connectionz!DDLElement._execute_on_connectionGs&&t[&AAArc|t|}|||r(|||S|jjddS)a1Execute this DDL immediately. Executes the DDL statement in isolation using the supplied :class:`.Connectable` or :class:`.Connectable` assigned to the ``.bind`` property, if not supplied. If the DDL has a conditional ``on`` criteria, it will be invoked with None as the event. :param bind: Optional, an ``Engine`` or ``Connection``. If not supplied, a valid :class:`.Connectable` must be present in the ``.bind`` property. :param target: Optional, defaults to None. The target :class:`_schema.SchemaItem` for the execute call. Will be passed to the ``on`` callable if any, and may also provide string expansion data for the statement. See ``execute_at`` for more information. Nz(DDL execution skipped, criteria not met.)r_should_executeexecuteagainstengineloggerinfo)rbindtargets rr'zDDLElement.executeJsm, <!$''D    - - P<< V 4 455 5 K  # #$N O O O O Or0.7zThe :meth:`.DDLElement.execute_at` method is deprecated and will be removed in a future release. Please use the :class:`.DDLEvents` listener interface in conjunction with the :meth:`.DDLElement.execute_if` method.cpfd}tj|dddz|dS)a_Link execution of this DDL to the DDL lifecycle of a SchemaItem. Links this ``DDLElement`` to a ``Table`` or ``MetaData`` instance, executing it when that schema item is created or dropped. The DDL statement will be executed using the same Connection and transactional context as the Table create/drop itself. The ``.bind`` property of this statement is ignored. :param event: One of the events defined in the schema item's ``.ddl_events``; e.g. 'before-create', 'after-create', 'before-drop' or 'after-drop' :param target: The Table or MetaData instance for which this DDLElement will be associated with. A DDLElement instance can be linked to any number of schema items. ``execute_at`` builds on the ``append_ddl_listener`` interface of :class:`_schema.MetaData` and :class:`_schema.Table` objects. Caveat: Creating or dropping a Table in isolation will also trigger any DDL set to ``execute_at`` that Table's MetaData. This may change in a future release. cxj||fi|r(||SdSr)_should_execute_deprecatedr'r()r-r!r event_namers r call_eventz)DDLElement.execute_at..call_events].t.FJ24 @"))$,,v*>*>??? @ @r-_N)r listenreplace)rr2r-r3s`` r execute_atzDDLElement.execute_athsZF @ @ @ @ @ @  VR*"4"4S#">">> KKKKKrc||_dS)z9Return a copy of this DDL against a specific schema item.N)r-)rr-s rr(zDDLElement.againsts rc0||_||_||_dS)aReturn a callable that will execute this DDLElement conditionally. Used to provide a wrapper for event listening:: event.listen( metadata, 'before_create', DDL("my_ddl").execute_if(dialect='postgresql') ) :param dialect: May be a string, tuple or a callable predicate. If a string, it will be compared to the name of the executing database dialect:: DDL('something').execute_if(dialect='postgresql') If a tuple, specifies multiple dialect names:: DDL('something').execute_if(dialect=('postgresql', 'mysql')) :param callable\_: A callable, which will be invoked with four positional arguments as well as optional keyword arguments: :ddl: This DDL element. :target: The :class:`_schema.Table` or :class:`_schema.MetaData` object which is the target of this event. May be None if the DDL is executed explicitly. :bind: The :class:`_engine.Connection` being used for DDL execution :tables: Optional keyword argument - a list of Table objects which are to be created/ dropped within a MetaData.create_all() or drop_all() method call. :state: Optional keyword argument - will be the ``state`` argument passed to this function. :checkfirst: Keyword argument, will be True if the 'checkfirst' flag was set during the call to ``create()``, ``create_all()``, ``drop()``, ``drop_all()``. If the callable returns a True value, the DDL statement will be executed. :param state: any value which will be passed to the callable\_ as the ``state`` keyword argument. .. seealso:: :class:`.DDLEvents` :ref:`event_toplevel` N)r callable_state)rrr<r=s r execute_ifzDDLElement.execute_ifsD " rc ^|j|jd||fi|sdSt|jtjr|j|jjkrdSn %ndn &$/ / &*j/ 46/ / %5trc |jdSt|jtjr|j|jjkSt|jt ttfr|jj|jvS|j||||fi|SNT) r@rAr rBr)rCrDrErF)rr r-r,rs rr1z%DDLElement._should_execute_deprecateds 7?4 !2 3 3 <7dk.. . %s!3 4 4 <;#tw. .474;;;; ;rc t|j||fi|r(|||SdS)z"Execute the DDL as a ddl_listener.N)r&r'r(rGs r__call__zDDLElement.__call__sK 4  3 3 3 3 6<< V 4 455 5 6 6rc|lt|tjttt fzs?tj|s-tjdt|j zdSdSdS)NzjExpected the name of a database dialect, a tuple of names, or a callable for 'on' criteria, got type '%s'.) rAr rBrDrErFcallabler ArgumentErrortyper)rr@s r _check_ddl_onzDDLElement._check_ddl_onsw >2t0E43EEFF M"%% #026r((2CD  >>>>>rc"|jr|jSdSr_bindrs rr,zDDLElement.bind s : :   rc||_dSrrR)rr,s r _set_bindzDDLElement._set_binds  rc|j|j}|j|_|Sr) __class____new____dict__copy)rss r _generatezDDLElement._generates3 N " "4> 2 2]'')) rNNNNN)rrr__doc__r_execution_optionsunionr-r@rr<r$r'r deprecatedr9rr(r>r&r1rKrPr,rVpropertyr]rrrrr su:$6<< tF BGIBBBPPPP<T_  1"L"L"LH[ CCC[CJ&<<<666    8D) $ $DrrcReZdZdZdZejdddZdZdS) DDLaAA literal DDL statement. Specifies literal SQL DDL to be executed by the database. DDL objects function as DDL event listeners, and can be subscribed to those events listed in :class:`.DDLEvents`, using either :class:`_schema.Table` or :class:`_schema.MetaData` objects as targets. Basic templating support allows a single DDL instance to handle repetitive tasks for multiple tables. Examples:: from sqlalchemy import event, DDL tbl = Table('users', metadata, Column('uid', Integer)) event.listen(tbl, 'before_create', DDL('DROP TRIGGER users_trigger')) spow = DDL('ALTER TABLE %(table)s SET secretpowers TRUE') event.listen(tbl, 'after_create', spow.execute_if(dialect='somedb')) drop_spow = DDL('ALTER TABLE users SET secretpowers FALSE') connection.execute(drop_spow) When operating on Table events, the following ``statement`` string substitutions are available:: %(table)s - the Table name, with any required quoting applied %(schema)s - the schema name, with any required quoting applied %(fullname)s - the Table name including schema, quoted if needed The DDL's "context", if any, will be combined with the standard substitutions noted above. Keys present in the context will override the standard substitutions. ddl)r.zThe :paramref:`.DDL.on` parameter is deprecated and will be removed in a future release. Please refer to :meth:`.DDLElement.execute_if`.)r@Nct|tjstjd|z||_|pi|_||||_||_ dS)a)Create a DDL statement. :param statement: A string or unicode string to be executed. Statements will be processed with Python's string formatting operator. See the ``context`` argument and the ``execute_at`` method. A literal '%' in a statement must be escaped as '%%'. SQL bind parameters are not available in DDL statements. :param on: Optional filtering criteria. May be a string, tuple or a callable predicate. If a string, it will be compared to the name of the executing database dialect:: DDL('something', on='postgresql') If a tuple, specifies multiple dialect names:: DDL('something', on=('postgresql', 'mysql')) If a callable, it will be invoked with four positional arguments as well as optional keyword arguments: :ddl: This DDL element. :event: The name of the event that has triggered this DDL, such as 'after-create' Will be None if the DDL is executed explicitly. :target: The ``Table`` or ``MetaData`` object which is the target of this event. May be None if the DDL is executed explicitly. :connection: The ``Connection`` being used for DDL execution :tables: Optional keyword argument - a list of Table objects which are to be created/ dropped within a MetaData.create_all() or drop_all() method call. If the callable returns a true value, the DDL statement will be executed. :param context: Optional dictionary, defaults to None. These values will be available for use in string substitutions on the DDL statement. :param bind: Optional. A :class:`.Connectable`, used by default when ``execute()`` is invoked without a bind argument. .. seealso:: :class:`.DDLEvents` :ref:`event_toplevel` z4Expected a string or unicode SQL statement, got '%r'N) rAr rBr rN statementcontextrPr@rS)rrir@rjr,s r__init__z DDL.__init__BstV)T%677 #F  #}"  2 rc dtjdtddt jgfddDzdS)N<@z; , cZg|]'}t||dt|(S)=)getattr).0keyrs r z DDL.__repr__..sOtS))"ssGD#$6$6$67r)r@rj>)rOridjoinreprrirTs`r__repr__z DDL.__repr__s JJ    tHHHH IIdn%%&0      rr_) rrrr`__visit_name__r deprecated_paramsrkrzrrrrfrfst!!FNT NNNN`      rrfc eZdZdZddZdZdS)_CreateDropBasezBase class for DDL constructs that represent CREATE and DROP or equivalents. The common theme of _CreateDropBase is a single ``element`` attribute which refers to the element to be created or dropped. NcZ||_||||_||_dSr)elementrPr@r,)rrr@r,s rrkz_CreateDropBase.__init__s/  2 rcdS)zAllow disable of _create_rule using a callable. Pass to _create_rule using util.portable_instancemethod(self._create_rule_disable) to retain serializability. Fr)rcompilers r_create_rule_disablez$_CreateDropBase._create_rule_disables urr^)rrrr`rkrrrrr~r~sA rr~c(eZdZdZdZdfd ZxZS) CreateSchemazcRepresent a CREATE SCHEMA statement. The argument here is the string name of the schema. create_schemaNc X||_tt|j|fi|dS)z.Create a new :class:`.CreateSchema` construct.N)quotesuperrrk)rrCrrrXs rrkzCreateSchema.__init__s7 *lD!!*466266666rrrrrr`r{rk __classcell__rXs@rrrsN %N7777777777rrc(eZdZdZdZdfd ZxZS) DropSchemazaRepresent a DROP SCHEMA statement. The argument here is the string name of the schema. drop_schemaNFc f||_||_tt|j|fi|dS)z,Create a new :class:`.DropSchema` construct.N)rcascaderrrk)rrCrrrrXs rrkzDropSchema.__init__s>  (j$(4444444rNFrrs@rrrsN #N5555555555rrc*eZdZdZdZ dfd ZxZS) CreateTablez#Represent a CREATE TABLE statement. create_tableNctt||||d|jD|_||_dS)aZCreate a :class:`.CreateTable` construct. :param element: a :class:`_schema.Table` that's the subject of the CREATE :param on: See the description for 'on' in :class:`.DDL`. :param bind: See the description for 'bind' in :class:`.DDL`. :param include_foreign_key_constraints: optional sequence of :class:`_schema.ForeignKeyConstraint` objects that will be included inline within the CREATE construct; if omitted, all foreign key constraints that do not specify use_alter=True are included. .. versionadded:: 1.0.0 )r@r,c,g|]}t|Sr) CreateColumn)rscolumns rruz(CreateTable.__init__..s KKK V,,KKKrN)rrrkcolumnsinclude_foreign_key_constraints)rrr@r,rrXs rrkzCreateTable.__init__sO" k4  ))'bt)DDDKK7?KKK /N,,,rr_rrs@rrrsY--#NLPOOOOOOOOOOrrceZdZdZdZdS) _DropViewzSemi-public 'DROP VIEW' construct. Used by the test suite for dialect-agnostic drops of views. This object will eventually be part of a public "view" API. drop_viewNrrrr`r{rrrrrs!NNNrrceZdZdZdZdZdS)raRepresent a :class:`_schema.Column` as rendered in a CREATE TABLE statement, via the :class:`.CreateTable` construct. This is provided to support custom column DDL within the generation of CREATE TABLE statements, by using the compiler extension documented in :ref:`sqlalchemy.ext.compiler_toplevel` to extend :class:`.CreateColumn`. Typical integration is to examine the incoming :class:`_schema.Column` object, and to redirect compilation if a particular flag or condition is found:: from sqlalchemy import schema from sqlalchemy.ext.compiler import compiles @compiles(schema.CreateColumn) def compile(element, compiler, **kw): column = element.element if "special" not in column.info: return compiler.visit_create_column(element, **kw) text = "%s SPECIAL DIRECTIVE %s" % ( column.name, compiler.type_compiler.process(column.type) ) default = compiler.get_column_default_string(column) if default is not None: text += " DEFAULT " + default if not column.nullable: text += " NOT NULL" if column.constraints: text += " ".join( compiler.process(const) for const in column.constraints) return text The above construct can be applied to a :class:`_schema.Table` as follows:: from sqlalchemy import Table, Metadata, Column, Integer, String from sqlalchemy import schema metadata = MetaData() table = Table('mytable', MetaData(), Column('x', Integer, info={"special":True}, primary_key=True), Column('y', String(50)), Column('z', String(20), info={"special":True}) ) metadata.create_all(conn) Above, the directives we've added to the :attr:`_schema.Column.info` collection will be detected by our custom compilation scheme:: CREATE TABLE mytable ( x SPECIAL DIRECTIVE INTEGER NOT NULL, y VARCHAR(50), z SPECIAL DIRECTIVE VARCHAR(20), PRIMARY KEY (x) ) The :class:`.CreateColumn` construct can also be used to skip certain columns when producing a ``CREATE TABLE``. This is accomplished by creating a compilation rule that conditionally returns ``None``. This is essentially how to produce the same effect as using the ``system=True`` argument on :class:`_schema.Column`, which marks a column as an implicitly-present "system" column. For example, suppose we wish to produce a :class:`_schema.Table` which skips rendering of the PostgreSQL ``xmin`` column against the PostgreSQL backend, but on other backends does render it, in anticipation of a triggered rule. A conditional compilation rule could skip this name only on PostgreSQL:: from sqlalchemy.schema import CreateColumn @compiles(CreateColumn, "postgresql") def skip_xmin(element, compiler, **kw): if element.element.name == 'xmin': return None else: return compiler.visit_create_column(element, **kw) my_table = Table('mytable', metadata, Column('id', Integer, primary_key=True), Column('xmin', Integer) ) Above, a :class:`.CreateTable` construct will generate a ``CREATE TABLE`` which only includes the ``id`` column in the string; the ``xmin`` column will be omitted, but only against the PostgreSQL backend. create_columnc||_dSr)r)rrs rrkzCreateColumn.__init__ts  rN)rrrr`r{rkrrrrr s7ddL%NrrceZdZdZdZdS) DropTablez!Represent a DROP TABLE statement. drop_tableNrrrrrrx++!NNNrrceZdZdZdZdS)CreateSequencez&Represent a CREATE SEQUENCE statement.create_sequenceNrrrrrr~s00&NNNrrceZdZdZdZdS) DropSequencez$Represent a DROP SEQUENCE statement. drop_sequenceNrrrrrrs..$NNNrrceZdZdZdZdS) CreateIndexz#Represent a CREATE INDEX statement. create_indexNrrrrrrs--#NNNrrceZdZdZdZdS) DropIndexz!Represent a DROP INDEX statement. drop_indexNrrrrrrrrrc&eZdZdZdZfdZxZS) AddConstraintz2Represent an ALTER TABLE ADD CONSTRAINT statement.add_constraintctt|j|g|Ri|tj|j|_dSr)rrrkr portable_instancemethodr _create_rule)rrargsrrXs rrkzAddConstraint.__init__sQ+mT""+GAdAAAbAAA#;  %  rrrs@rrrsC<<%N         rrc(eZdZdZdZdfd ZxZS)DropConstraintz3Represent an ALTER TABLE DROP CONSTRAINT statement.drop_constraintFc ||_tt|j|fi|t j|j|_dSr)rrrrkr rrr)rrrrrXs rrkzDropConstraint.__init__sP ,nd##,W;;;;;#;  %  rFrrs@rrrsH==&N          rrceZdZdZdZdS)SetTableCommentz*Represent a COMMENT ON TABLE IS statement.set_table_commentNrrrrrrs44(NNNrrceZdZdZdZdS)DropTableCommentzfRepresent a COMMENT ON TABLE '' statement. Note this varies a lot across database backends. drop_table_commentNrrrrrrs *NNNrrceZdZdZdZdS)SetColumnCommentz+Represent a COMMENT ON COLUMN IS statement.set_column_commentNrrrrrrs55)NNNrrceZdZdZdZdS)DropColumnCommentz0Represent a COMMENT ON COLUMN IS NULL statement.drop_column_commentNrrrrrrs::*NNNrrceZdZdZdS)DDLBasec||_dSr)r!)rr!s rrkzDDLBase.__init__s $rN)rrrrkrrrrrs#%%%%%rrcVeZdZ d fd ZdZdZdZ d dZdZd d Z d Z xZ S)SchemaGeneratorFNc tt|j|fi|||_||_|j|_||_i|_dSr) rrrk checkfirsttablesidentifier_preparerpreparerrmemorrr!rrkwargsrXs rrkzSchemaGenerator.__init__sT .ot$$-jCCFCCC$ 3   rc |j|j|j|}|r|j||j p'|j|j|j| SN)schemarvalidate_identifierrCr!schema_for_objectr has_tablertableeffective_schemas r_can_create_tablez!SchemaGenerator._can_create_tables ((444?< > >?" $,*@*@ OUZ0@+A+ + '  rc|j|}|jjoD|jj s|j o/|j p'|j|j|j| Sr r!rrsupports_sequencessequences_optionaloptionalr has_sequencerCrsequencers r_can_create_sequencez$SchemaGenerator._can_create_sequences}?<g|]}||Sr)rrstrs rruz2SchemaGenerator.visit_metadata..s, < < <1$"8"8";"; .s>   xD$=$=a$@$@ rcg|] \}}|| Srrrsrfkss rruz2SchemaGenerator.visit_metadata..JJJ(1cAMAMMMrrr _ddl_runnerT) create_ok)rr_is_metadata_operation) rrEvaluessort_tables_and_constraints _sequencesdispatch before_creater!rtraverse_single after_create) rmetadatar collectionseq_collevent_collectionseqrfkcsfkcs ` rvisit_metadatazSchemaGenerator.visit_metadatas ; "[FF(/002233F0 < < < < < < <      (//11    KJjJJJ''  O# (    6 6C   5 5 5 5% . .KE4 $$"48+/ % ..C((----. &&  O# '     rc|s||sdS|j||j|j|||jD]#}|j||j$|jj sd}|j t||t|dr|j D]}|||jjrr|jjsf|j'|j t#||jD]0}|j'|j t%|1|j||j|j||dS)Nrrr)rindexes)rrrr!rrdefaultrrsupports_alterr'rhasattrr supports_commentsinline_commentscommentrrr)rrrrrrindexs r visit_tablezSchemaGenerator.visit_table!s !7!7!>!>  F $$  O#9 %   m 5 5F~)$$V^444|* 3.2 +  3       5) $ $ , , ,$$U++++ < ) F$,2N F}(''(>(>???- F F>-O++,g|]}||Sr)_can_drop_tablers rruz0SchemaDropper.visit_metadata..ys,LLLQD4H4H4K4KLqLLLrc2jjr|jdndSr)rr rC)rrs rz.SchemaDropper.visit_metadata..~s)#|:6"%?26;U"r) filter_fna4Can't sort tables for DROP; an unresolvable foreign key dependency exists between tables: %s; and backend does not support ALTER. To restore at least a partial sort, apply use_alter=True to ForeignKey and ForeignKeyConstraint objects involved in the cycle to mark these as known cycles that will be ignored.rocg|] }|j Srfullnamersrs rruz0SchemaDropper.visit_metadata..s(I(I(I(I(I(Ircg|]}|dfS)rrr*s rruz0SchemaDropper.visit_metadata..s???!q"g???rzCan't sort tables for DROP; an unresolvable foreign key dependency exists between tables: %s. Please ensure that the ForeignKey and ForeignKeyConstraint objects involved in the cycle have names so that they can be dropped using DROP CONSTRAINT.cg|] }|j Srr(r*s rruz0SchemaDropper.visit_metadata..s'H'H'Hq 'H'H'Hr)msg)from_c>g|]}||Sr)_can_drop_sequencers rruz0SchemaDropper.visit_metadata..s=   &&q))    rcg|] \}}|| Srrrs rruz0SchemaDropper.visit_metadata..rrrT)drop_okr_ignore_sequences)r3)rrErreversedrr CircularDependencyErrorrr r warnrxsortedcyclesraise_redgesrr before_dropr!rrr after_drop) rrrunsorted_tablesrerr2rrrrrrs ` rrzSchemaDropper.visit_metadatars ; "[FF(/002233F/ LLLL&LLLO/'#"#"#"#"  JJ*" " " <.!  3yy(I(IT[(I(I(I!J!JKKM   @????  / !   +!II &'H'HDK'H'H'H I I  "%" H    (//11    KJjJJJ%%  O# &   & . .KE4 $$ +/&. % ..C((----. B BC  cjD.@ A A A A$$  O# %     s > >?" dl&<&< OUZ0@'=' '  rc|j|}|jjoC|jj s|j o.|j p&|j|j|j|Srrrs rr1z SchemaDropper._can_drop_sequencesx?<._skip_fn]s7l  72;; 44 trcg|] \}}|| Srr)rsrrs rruzsort_tables..gs-    Q =  ==rT)r&extra_dependencies_warn_for_cycles)r)rrJrMrKs ` r sort_tablesrOsm~        4 1!        rFc  t}t}|||t |D]jD]j}|jdur |!r%|}|dur |H|j}|ur||fk|fdjD ttj | ||d} n #tj $r} |rGtjddt!d| jDd| jD]g} | |vra| d | jvrfd jD} | | D]$}|j}|ur||f%httj | ||d} Yd} ~ nd} ~ wwxYw fd | Ddt fgzS) aSort a collection of :class:`_schema.Table` / :class:`_schema.ForeignKeyConstraint` objects. This is a dependency-ordered sort which will emit tuples of ``(Table, [ForeignKeyConstraint, ...])`` such that each :class:`_schema.Table` follows its dependent :class:`_schema.Table` objects. Remaining :class:`_schema.ForeignKeyConstraint` objects that are separate due to dependency rules not satisfied by the sort are emitted afterwards as ``(None, [ForeignKeyConstraint ...])``. Tables are dependent on another based on the presence of :class:`_schema.ForeignKeyConstraint` objects, explicit dependencies added by :meth:`_schema.Table.add_is_dependent_on`, as well as dependencies stated here using the :paramref:`~.sort_tables_and_constraints.skip_fn` and/or :paramref:`~.sort_tables_and_constraints.extra_dependencies` parameters. :param tables: a sequence of :class:`_schema.Table` objects. :param filter_fn: optional callable which will be passed a :class:`_schema.ForeignKeyConstraint` object, and returns a value based on whether this constraint should definitely be included or excluded as an inline constraint, or neither. If it returns False, the constraint will definitely be included as a dependency that cannot be subject to ALTER; if True, it will **only** be included as an ALTER result at the end. Returning None means the constraint is included in the table-based result unless it is detected as part of a dependency cycle. :param extra_dependencies: a sequence of 2-tuples of tables which will also be considered as dependent on each other. .. versionadded:: 1.0.0 .. seealso:: :func:`.sort_tables` NTc3 K|]}|fV dSrr)rsparentrs r z.sort_tables_and_constraints..s8" " &VUO" " " " " " r)deterministic_orderzLCannot correctly sort tables; there are unresolvable cycles between tables "roc3$K|] }|jV dSrr(r*s rrSz.sort_tables_and_constraints..s$#C#C1AJ#C#C#C#C#C#Crz", which is usually caused by mutually dependent foreign key constraints. Foreign key constraints involving these tables will not be considered; this warning may raise an error in a future release.rc2g|]} |du|Srr)rsrr&s rruz/sort_tables_and_constraints..s; (IIcNN%,G,G,G,G,GrcHg|]}||jfSr)foreign_key_constraints difference)rsrremaining_fkcss rruz/sort_tables_and_constraints..s?     -88HHI   r)rFupdaterX use_alteraddreferred_table_extra_dependenciesrEr sortrbr r6r r7rxr8r9r;discard)rr&rMrNfixed_dependenciesmutable_dependenciesrfiltered dependent_oncandidate_sorterredge can_removerZrs ` @@rrrss2`55%!!"4555UUN  0 @ @C}$$""3''' $9S>>t##"&&s+++-L5(($((,)>???!!" " " " */*C" " "     '   "(()=>>$(       &     II 99V#C#C #C#C#CCCDDDD G   I L LD+++Q **$< %%j111%LLC#L#500,44lE5JKKK  "(()=>>$(     3 B    #    ^$$ %& ''s#7DH$+C/HH$r^)NNF)&r`baserrrrrHrr4r r r r rrrfr~rrrrrrrrrrrrrrrrrrrrOrrrrrks ! ######99999=999yyyyy\yyyxJ J J J J *J J J Zj6 7 7 7 7 7? 7 7 7 55555555"OOOOO/OOO6!!!!!!!!jjjjj<jjjZ"""""""" '''''_''' %%%%%?%%% $$$$$/$$$ """"""""      O          _    )))))o))) **************** ++++++++ %%%%%m%%% T4T4T4T4T4gT4T4T4nr8r8r8r8r8Gr8r8r8n TTTTpGLx'x'x'x'x'x'r