id&NdZddlmZddlmZddlmZddlmZddlmZddlm Z ddl m Z dd l m Z dd l m Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl%m&Z&ddl%m'Z'ddl%m(Z(dd l%m)Z)dd!l%m*Z*dd"l%m+Z+dd#lm,Z,dd$l-m.Z.dd%l-m/Z/dd&l-m0Z0dd'l-m1Z1dd(l-m2Z2dd)l-m3Z3dd*l-m4Z4dd+l-m5Z5d,d-lm6Z7d,d.lm-Z8d,d/l9m:Z:dFd1Z;e:e!d2Ze:ed5Z?e:e d6Z@d7ZAd8ZBe7jCfd9ZDe:ed:Ze:e d;ZEe:e d<ZFe8jGd=d>?d@ZHdAZIejJjKZJejJjLZMejNjKZNejOjKZOejPjKZPejQjKZQejRjKZRejSjKZSejTjKZTejUjLZUejVjKZVejWjLZWejXjKZXejYjLZYejZjKZZej[jKZ[ej\jKZ\ej]jKZ]ej^jKZ^dBZ_dCZ`e:edDZadEZbebecd0S)Gz Functional constructs for ORM configuration. See the SQLAlchemy object relational tutorial and mapper configuration documentation for an overview of how this module is used. )exc)mapper)strategy_options)AttributeExtension)MapperExtension)SessionExtension)ComparableProperty)CompositeProperty)SynonymProperty) EXT_CONTINUE)EXT_SKIP)EXT_STOP)PropComparator)_mapper_registry) class_mapperconfigure_mappers)Mapper) reconstructor) validatesColumnProperty) AliasOption)Bundle)Query)foreign)RelationshipProperty)remote)scoped_session)close_all_sessions)make_transient)make_transient_to_detached)object_session)Session) sessionmaker)Load)aliased)join) object_mapper) outerjoin)polymorphic_union) was_deleted) with_parent)with_polymorphic)sqlutil)public_factoryNc |dd|dd|ddtdd|i|S)aCreate a new :class:`.Session` with no automation enabled by default. This function is used primarily for testing. The usual route to :class:`.Session` creation is via its constructor or the :func:`.sessionmaker` function. :param bind: optional, a single Connectable to use for all database access in the created :class:`~sqlalchemy.orm.session.Session`. :param \*\*kwargs: optional, passed through to the :class:`.Session` constructor. :returns: an :class:`~sqlalchemy.orm.session.Session` instance The defaults of create_session() are the opposite of that of :func:`sessionmaker`; ``autoflush`` and ``expire_on_commit`` are False, ``autocommit`` is True. In this sense the session acts more like the "classic" SQLAlchemy 0.3 session with these. Usage:: >>> from sqlalchemy.orm import create_session >>> session = create_session() It is recommended to use :func:`sessionmaker` instead of create_session(). autoflushF autocommitTexpire_on_commitbind) setdefaultr$)r8kwargss L/opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/orm/__init__.pycreate_sessionr=?s`> k5))) lD))) (%000  ' ' ' ' ''z.orm.relationshipct|i|S)z#A synonym for :func:`relationship`. relationship)argkws r<relationrDgs  # # ##r>c &d|d<t|fi|S)aiConstruct a dynamically-loading mapper property. This is essentially the same as using the ``lazy='dynamic'`` argument with :func:`relationship`:: dynamic_loader(SomeClass) # is the same as relationship(SomeClass, lazy="dynamic") See the section :ref:`dynamic_relationship` for more details on dynamic loading. dynamiclazyr@)argumentrCs r<dynamic_loaderrIms# BvJ  ' 'B ' ''r>z.orm.column_propertyz.orm.compositec ||fS)aCreate a back reference with explicit keyword arguments, which are the same arguments one can send to :func:`relationship`. Used with the ``backref`` keyword argument to :func:`relationship` in place of a string argument, e.g.:: 'items':relationship( SomeItem, backref=backref('parent', lazy='subquery')) .. seealso:: :ref:`relationships_backref` r9)namer;s r<backrefrLs &>r>ct|ddi|S)aIndicate a column-based mapped attribute that by default will not load unless accessed. :param \*columns: columns to be mapped. This is typically a single :class:`_schema.Column` object, however a collection is supported in order to support multiple columns mapped under the same attribute. :param \**kw: additional keyword arguments passed to :class:`.ColumnProperty`. .. seealso:: :ref:`deferred` deferredTr)columnsrCs r<rNrNs" ' 84 8R 8 88r>c2t|}d|_|S)aIndicate an attribute that populates from a query-time SQL expression. :param default_expr: Optional SQL expression object that will be used in all cases if not assigned later with :func:`_orm.with_expression`. E.g.:: from sqlalchemy.sql import literal class C(Base): #... my_expr = query_expression(literal(1)) .. versionadded:: 1.3.18 .. versionadded:: 1.2 .. seealso:: :ref:`mapper_querytime_expression` ))query_expressionT)r strategy_key) default_exprprops r<rQrQs. , ' 'D5D Kr>z .orm.mapperz .orm.synonymz.orm.comparable_propertyz0.7zv:func:`.compile_mappers` is deprecated and will be removed in a future release. Please use :func:`.configure_mappers`)messagec"tdS)zZInitialize the inter-mapper relationships of all mappers that have been defined. Nrr9r>r<compile_mappersrWsr>cZtj trC tj\}}|n#t $rYnwxYwtCtjdS#tjwxYw)aRemove all mappers from all classes. This function removes all instrumentation from classes and disposes of their associated mappers. Once called, the classes are unmapped and can be later re-mapped with new mappers. :func:`.clear_mappers` is *not* for normal use, as there is literally no valid usage for it outside of very specific testing scenarios. Normally, mappers are permanent structural components of user-defined classes, and are never discarded independently of their class. If a mapped class itself is garbage collected, its mapper is automatically disposed of as well. As such, :func:`.clear_mappers` is only for usage in test suites that re-use the same classes with different mappings, which is itself an extremely rare use case - the only such use case is in fact SQLAlchemy's own test suite, and possibly the test suites of other ORM extension libraries which intend to test various combinations of mapper construction upon a fixed set of classes. N) mapperlib_CONFIGURE_MUTEXacquirerpopitemdisposeKeyErrorrelease)rbs r< clear_mappersras(&&((( -  ,466            "**,,,,, "**,,,,s.B *AB  A B A  B B*ct|i|S)z#A synonym for :func:`joinedload()`.) joinedloadargsr;s r< eagerloadrfs t &v & &&r>ct|i|S)z&A synonym for :func:`joinedload_all()`)joinedload_allrds r< eagerload_allris 4 *6 * **r>z.orm.contains_aliascddlm}ddlm}ddlm}ddlm}ddlt fd|Datj d tj d dS) Nr/r1r)rF)events)loadingc3vK|]3\}}|d|/|V4dS)_N) startswithismodule).0rKobj_inspects r< z__go..)se D#$$)1(9(9#(>(> r>zsqlalchemy.ormzsqlalchemy.ext) r2rFrkrlinspectsorteditems__all___sa_util dependencies resolve_all)lclssa_utilrFrkrlrts @r<__gor!s""""""G  %%&6777 %%&677777r>)N)d__doc__rvrrrYrdeprecated_interfacesrrrdescriptor_propsr r r interfacesr r rrrrrrrr propertiesrqueryrrr relationshipsrrrscopingrsessionr r!r"r#r$r%r&r2r'r(r)r*r+r,r-r.r0_sqlr{util.langhelpersr3r=rArDrIcolumn_property compositerLrNnullrQsynonymcomparable_property deprecatedrWrarc _unbound_fn_unbound_all_fnrhcontains_eagerdeferundefer undefer_groupwith_expression load_onlylazyload lazyload_all subqueryloadsubqueryload_all selectinloadselectinload_all immediateloadnoload raiseload defaultloadselectin_polymorphicrfricontains_aliasrlocalsr9r>r<rs!!!!!!555555222222333333000000//////------$$$$$$ &&&&&&$$$$$$ %%%%%%!!!!!!&&&&&&""""""//////!!!!!!######''''''######//////######!!!!!!""""""######""""""------"("("("(J~24GHH $$$ ((((!.1GHH N,.> ? ? &999(#,$)++8  . . .. 9 9$n2   B   ---B ( 4 !,<!0<*  " . .: "2>  & 2  $ 0,< ,8 #4D,8 #4D .:  ,  & 2 *6 '<H''' +++   -BCC888$VVXXr>