]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Convert execution to move through Session
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 27 Apr 2020 16:58:12 +0000 (12:58 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 25 May 2020 17:56:37 +0000 (13:56 -0400)
commit6930dfc032c3f9f474e71ab4e021c0ef8384930e
tree34b919a3c34edaffda1750f161a629fc5b9a8020
parentdce8c7a125cb99fad62c76cd145752d5afefae36
Convert execution to move through Session

This patch replaces the ORM execution flow with a
single pathway through Session.execute() for all queries,
including Core and ORM.

Currently included is full support for ORM Query,
Query.from_statement(), select(), as well as the
baked query and horizontal shard systems.  Initial
changes have also been made to the dogpile caching
example, which like baked query makes use of a
new ORM-specific execution hook that replaces the
use of both QueryEvents.before_compile() as well
as Query._execute_and_instances() as the central
ORM interception hooks.

select() and Query() constructs alike can be passed to
Session.execute() where they will return ORM
results in a Results object.   This API is currently
used internally by Query.   Full support for
Session.execute()->results to behave in a fully
2.0 fashion will be in later changesets.

bulk update/delete with ORM support will also
be delivered via the update() and delete()
constructs, however these have not yet been adapted
to the new system and may follow in a subsequent
update.

Performance is also beginning to lag as of this
commit and some previous ones.   It is hoped that
a few central functions such as the coercions
functions can be rewritten in C to re-gain
performance.  Additionally, query caching
is now available and some subsequent patches
will attempt to cache more of the per-execution
work from the ORM layer, e.g. column getters
and adapters.

This patch also contains initial "turn on" of the
caching system enginewide via the query_cache_size
parameter to create_engine(). Still defaulting at
zero for "no caching".   The caching system still
needs adjustments in order to gain adequate performance.

Change-Id: I047a7ebb26aa85dc01f6789fac2bff561dcd555d
71 files changed:
doc/build/orm/extensions/baked.rst
doc/build/orm/session_api.rst
examples/dogpile_caching/advanced.py
examples/dogpile_caching/caching_query.py
examples/dogpile_caching/environment.py
examples/dogpile_caching/helloworld.py
examples/dogpile_caching/local_session_caching.py
examples/performance/short_selects.py
lib/sqlalchemy/cextension/resultproxy.c
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/create.py
lib/sqlalchemy/engine/cursor.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/result.py
lib/sqlalchemy/ext/baked.py
lib/sqlalchemy/ext/horizontal_shard.py
lib/sqlalchemy/future/selectable.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/annotation.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/dml.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/functions.py
lib/sqlalchemy/sql/roles.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/sql/traversals.py
lib/sqlalchemy/sql/visitors.py
lib/sqlalchemy/testing/profiling.py
lib/sqlalchemy/util/_collections.py
test/aaa_profiling/test_memusage.py
test/aaa_profiling/test_orm.py
test/base/test_result.py
test/ext/test_baked.py
test/ext/test_horizontal_shard.py
test/orm/inheritance/test_polymorphic_rel.py
test/orm/test_bind.py
test/orm/test_cache_key.py
test/orm/test_core_compilation.py
test/orm/test_expire.py
test/orm/test_froms.py
test/orm/test_loading.py
test/orm/test_mapper.py
test/orm/test_query.py
test/orm/test_subquery_relations.py
test/orm/test_transaction.py
test/orm/test_versioning.py
test/perf/orm2010.py
test/profiles.txt
test/sql/test_compare.py
test/sql/test_compiler.py
test/sql/test_deprecations.py
test/sql/test_resultset.py