mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Проверка 09.02.2025
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# orm/scoping.py
|
||||
# Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
|
||||
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
|
||||
# <see AUTHORS file>
|
||||
#
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
@@ -280,11 +280,13 @@ class scoped_session(Generic[_S]):
|
||||
|
||||
Session = scoped_session(sessionmaker())
|
||||
|
||||
|
||||
class MyClass:
|
||||
query: QueryPropertyDescriptor = Session.query_property()
|
||||
|
||||
|
||||
# after mappers are defined
|
||||
result = MyClass.query.filter(MyClass.name=='foo').all()
|
||||
result = MyClass.query.filter(MyClass.name == "foo").all()
|
||||
|
||||
Produces instances of the session's configured query class by
|
||||
default. To override and use a custom implementation, provide
|
||||
@@ -730,9 +732,8 @@ class scoped_session(Generic[_S]):
|
||||
E.g.::
|
||||
|
||||
from sqlalchemy import select
|
||||
result = session.execute(
|
||||
select(User).where(User.id == 5)
|
||||
)
|
||||
|
||||
result = session.execute(select(User).where(User.id == 5))
|
||||
|
||||
The API contract of :meth:`_orm.Session.execute` is similar to that
|
||||
of :meth:`_engine.Connection.execute`, the :term:`2.0 style` version
|
||||
@@ -962,10 +963,7 @@ class scoped_session(Generic[_S]):
|
||||
|
||||
some_object = session.get(VersionedFoo, (5, 10))
|
||||
|
||||
some_object = session.get(
|
||||
VersionedFoo,
|
||||
{"id": 5, "version_id": 10}
|
||||
)
|
||||
some_object = session.get(VersionedFoo, {"id": 5, "version_id": 10})
|
||||
|
||||
.. versionadded:: 1.4 Added :meth:`_orm.Session.get`, which is moved
|
||||
from the now legacy :meth:`_orm.Query.get` method.
|
||||
@@ -1228,7 +1226,7 @@ class scoped_session(Generic[_S]):
|
||||
|
||||
This method retrieves the history for each instrumented
|
||||
attribute on the instance and performs a comparison of the current
|
||||
value to its previously committed value, if any.
|
||||
value to its previously flushed or committed value, if any.
|
||||
|
||||
It is in effect a more expensive and accurate
|
||||
version of checking for the given instance in the
|
||||
|
Reference in New Issue
Block a user