summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* fix spelling (#6926)William Maio2021-08-241-1/+1
|
* Fix has_table() to exclude other sessions' local temp tablesGord Thompson2021-08-231-3/+17
| | | | | Fixes: #6910 Change-Id: I9986566e1195d42ad7e9a01f0f84ef2074576257
* Merge "Deprecate scoped_session usage with async sessions"mike bayer2021-08-234-2/+24
|\
| * Deprecate scoped_session usage with async sessionsFederico Caselli2021-07-284-2/+24
| | | | | | | | | | | | | | | | | | Deprecate usage of :class:`_orm.scoped_session` with asyncio drivers. When using Asyncio the :class:`_asyncio.async_scoped_session` should be used instead. Fixes: #6746 Change-Id: I540d57a406f59efc37fc61f0e9dfe03f32fe2904
* | Merge "restore statement substitution to before_execute()"mike bayer2021-08-231-1/+6
|\ \
| * | restore statement substitution to before_execute()Mike Bayer2021-08-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the ability of the :meth:`_engine.ConnectionEvents.before_execute` method to alter the SQL statement object passed, returning the new object to be invoked, was inadvertently removed. This behavior has been restored. The refactor in a1939719a652774a437f69f8d4788b3f08650089 removed this feature for some reason and there were no tests in place to detect it. I don't see any indication this was planned. Fixes: #6913 Change-Id: Ia77ca08aa91ab9403f19a8eb61e2a0e41aad138a
* | | qualify compile_state updates for non-current entitiesMike Bayer2021-08-231-11/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in recently repaired ``Query.with_entities()`` method where the flag that determines automatic uniquing for legacy ORM ``Query`` objects only would be set to ``True`` inappropriately in cases where the ``with_entities()`` call would be setting the ``Query`` to return column-only rows, which are not uniqued. Fixes: #6924 Change-Id: I81120823914c989bb7a4d13ef2ec08809d8e5a4d
* | | update enable_baked_queries flag docMike Bayer2021-08-221-11/+7
| | | | | | | | | | | | | | | | | | | | | this flag is not relevant for ORM internals anymore and is overall legacy. Change-Id: I58ef7870881ff00b88d552af5eae6af11be6026c
* | | heads up that execute(query).first() can't apply LIMIT 1Mike Bayer2021-08-201-0/+11
|/ / | | | | | | | | Fixes: #6914 Change-Id: I5de9843dd3723c017b94b705fc009b883737ede1
* | Merge "CAST Oracle table_name, owner, others to VARCHAR(128)"mike bayer2021-08-191-11/+17
|\ \
| * | CAST Oracle table_name, owner, others to VARCHAR(128)Mike Bayer2021-08-181-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a CAST(VARCHAR2(128)) to the "table name", "owner", and other DDL-name parameters as used in reflection queries against Oracle system views such as ALL_TABLES, ALL_TAB_CONSTRAINTS, etc to better enable indexing to take place against these columns, as they previously would be implicitly handled as NVARCHAR2 due to Python's use of Unicode for strings; these columns are documented in all Oracle versions as being VARCHAR2 with lengths varying from 30 to 128 characters depending on server version. Additionally, test support has been enabled for Unicode-named DDL structures against Oracle databases. Fixes: #4486 Change-Id: I2787e3f8de1f656318692bd535d6a7f1cef1a841
* | | Version 1.4.24 placeholderMike Bayer2021-08-181-1/+1
|/ /
* | Merge "send user defined options from the current query"mike bayer2021-08-183-16/+26
|\ \
| * | send user defined options from the current queryMike Bayer2021-08-173-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised the means by which the :attr:`_orm.ORMExecuteState.user_defined_options` accessor receives :class:`_orm.UserDefinedOption` and related option objects from the context, with particular emphasis on the "selectinload" on the loader strategy where this previously was not working; other strategies did not have this problem. The objects that are associated with the current query being executed, and not that of a query being cached, are now propagated unconditionally. This essentially separates them out from the "loader strategy" options which are explicitly associated with the compiled state of a query and need to be used in relation to the cached query. The effect of this fix is that a user-defined option, such as those used by the dogpile.caching example as well as for other recipes such as defining a "shard id" for the horizontal sharing extension, will be correctly propagated to eager and lazy loaders regardless of whether a cached query was ultimately invoked. Fixes: #6887 Change-Id: Ieaae5b01c85de26ea732ebd625e6e5823a470492
* | | Merge "rewrite _extra_criteria in selectinload; propagate correctly to Load"mike bayer2021-08-184-11/+154
|\ \ \ | |/ /
| * | rewrite _extra_criteria in selectinload; propagate correctly to LoadMike Bayer2021-08-174-11/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in :func:`_orm.selectinload` where use of the new :meth:`_orm.PropComparator.and_` feature within options that were nested more than one level deep would fail to update bound parameter values that were in the nested criteria, as a side effect of SQL statement caching. Implementation adds a new step that rewrites the parameters inside of all _extra_criteria when invoking selectinload as well as subqueryload. Additionally, changed how Load() gets "extra_criteria", in that it pulls it from UnboundLoad._extra_criteria instead of re-fetching it from the path elements, which are not updated by this new step. This patch also builds upon the removal of lambda queries for use in loader strategies in #6889. lambdas made this issue much more difficult to diagnose. An attempt to reintroduce lambdas here after finally identifying the "extra_criteria" issue above showed that lambdas still impact the assertsql fixture, meaning we have a statement structure that upon calling .compile() still delivers stale data due to lambdas, even if caching is turned off, and the non-cached test was still failing due to stale data within the lambdas. This is basically the complexity that #6889 fixes and as there's no real performance gain to using lambdas in these strategies on top of the existing statement caching that does most of the work, it should be much less likely going forward to have as many deeply confusing issues as we've had within selectinload/lazyload in the 1.4 series. Fixes: #6881 Change-Id: I919c079d2ed06125def5f8d6d81f3f305e158c04
* | | Merge "honor NO_CACHE in lambdas"mike bayer2021-08-181-29/+70
|\ \ \ | |/ / |/| |
| * | honor NO_CACHE in lambdasMike Bayer2021-08-171-29/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in lambda caching system where an element of a query that produces no cache key, like a custom option or clause element, would still populate the expression in the "lambda cache" inappropriately. This was discovered as part of :ticket:`6887` but is a separate issue. References: #6887 Change-Id: I1665f4320254ddc63a0abf3088e9daeaffbd1840
* | | remove lambda caching from loader strategiesMike Bayer2021-08-177-198/+137
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted ORM loader internals to no longer use the "lambda caching" system that was added in 1.4, as well as repaired one location that was still using the previous "baked query" system for a query. The lambda caching system remains an effective way to reduce the overhead of building up queries that have relatively fixed usage patterns. In the case of loader strategies, the queries used are responsible for moving through lots of arbitrary options and criteria, which is both generated and sometimes consumed by end-user code, that make the lambda cache concept not any more efficient than not using it, at the cost of more complexity. In particular the problems noted by :ticket:`6881` and :ticket:`6887` are made considerably less complicated by removing this feature internally. Fixed an issue where the :class:`_orm.Bundle` construct would not create proper cache keys, leading to inefficient use of the query cache. This had some impact on the "selectinload" strategy and was identified as part of :ticket:`6889`. Added a Select._create_raw_select() method which essentially performs ``__new__`` and then populates ``__dict__`` directly, with no coercions. This saves most of the overhead time that the lambda caching system otherwise seeks to avoid. Includes removal of bakedquery from mapper->_subclass_load_via_in() which was overlooked from the 1.4 refactor. Fixes: #6079 Fixes: #6889 Change-Id: Ieac2d9d709b71ec4270e5c121fbac6ac870e2bb1
* | fix linter JOIN logic; fix PostgreSQL ARRAY op comparisonMike Bayer2021-08-152-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted the "from linter" warning feature to accommodate for a chain of joins more than one level deep where the ON clauses don't explicitly match up the targets, such as an expression such as "ON TRUE". This mode of use is intended to cancel the cartesian product warning simply by the fact that there's a JOIN from "a to b", which was not working for the case where the chain of joins had more than one element. this incurs a bit more compiler overhead that comes out in profiling but is not extensive. Added the "is_comparison" flag to the PostgreSQL "overlaps", "contained_by", "contains" operators, so that they work in relevant ORM contexts as well as in conjunction with the "from linter" feature. Fixes: #6886 Change-Id: I078dc3fe6d4f7871ffe4ebac3e71e62f3f213d12
* | Merge "Unify native and non-native valid values for ``Enum``"mike bayer2021-08-131-2/+3
|\ \
| * | Unify native and non-native valid values for ``Enum``Federico Caselli2021-04-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify behaviour :class:`_schema.Enum` in native and non-native implementations regarding the accepted values for an enum with aliased elements. When :paramref:`_schema.Enum.omit_aliases` is ``False`` all values, alias included, are accepted as valid values. When :paramref:`_schema.Enum.omit_aliases` is ``True`` only non aliased values are accepted as valid values. Fixes: #6146 Change-Id: I6f40789c1ca56e533990882deadcc6a377d4fc40
* | | Merge "limit greenlet dependency to pypi-listed platforms"mike bayer2021-08-111-0/+12
|\ \ \
| * | | limit greenlet dependency to pypi-listed platformsMike Bayer2021-08-111-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The setup requirements have been modified such ``greenlet`` is a default requirement only for those platforms that are well known for ``greenlet`` to be installable and for which there is already a pre-built binary on pypi; the current list is ``x86_64 aarch64 ppc64le amd64 win32``. For other platforms, greenlet will not install by default, which should enable installation and test suite running of SQLAlchemy 1.4 on platforms that don't support ``greenlet``, excluding any asyncio features. In order to install with the ``greenlet`` dependency included on a machine architecture outside of the above list, the ``[asyncio]`` extra may be included by running ``pip install sqlalchemy[asyncio]`` which will then attempt to install ``greenlet``. Additionally, the test suite has been repaired so that tests can complete fully when greenlet is not installed, with appropriate skips for asyncio-related tests. Fixes: #6136 Change-Id: I8f3a1c00a4a8b6a273484af1da1f7aaadf588ae7
* | | | Merge "cx_oracle patches"mike bayer2021-08-111-18/+99
|\ \ \ \
| * | | | cx_oracle patchesMike Bayer2021-07-291-18/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | provided by cx_oracle developers Change-Id: Ie30b0993d0da2ee1359042816d77d08f762c6b13
* | | | | Merge "create concise + deterministic cache key for unboundload.options"mike bayer2021-08-101-14/+95
|\ \ \ \ \
| * | | | | create concise + deterministic cache key for unboundload.optionsMike Bayer2021-08-091-14/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in loader strategies where the use of the :meth:`_orm.Load.options` method, particularly when nesting multiple calls, would generate an overly long and more importantly non-deterministic cache key, leading to very large cache keys which were also not allowing efficient cache usage, both in terms of total memory used as well as number of entries used in the cache itself. Fixes: #6869 Change-Id: I42bd3564d55a5fb95a21d0e7eef30d50c1274da0
* | | | | | Merge "add columns_clause_froms and related use cases"mike bayer2021-08-093-11/+137
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | add columns_clause_froms and related use casesMike Bayer2021-08-073-11/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new attribute :attr:`_sql.Select.columns_clause_froms` that will retrieve the FROM list implied by the columns clause of the :class:`_sql.Select` statement. This differs from the old :attr:`_sql.Select.froms` collection in that it does not perform any ORM compilation steps, which necessarily deannotate the FROM elements and do things like compute joinedloads etc., which makes it not an appropriate candidate for the :meth:`_sql.Select.select_from` method. Additionally adds a new parameter :paramref:`_sql.Select.with_only_columns.maintain_column_froms` that transfers this collection to :meth:`_sql.Select.select_from` before replacing the columns collection. In addition, the :attr:`_sql.Select.froms` is renamed to :meth:`_sql.Select.get_final_froms`, to stress that this collection is not a simple accessor and is instead calculated given the full state of the object, which can be an expensive call when used in an ORM context. Additionally fixes a regression involving the :func:`_orm.with_only_columns` function to support applying criteria to column elements that were replaced with either :meth:`_sql.Select.with_only_columns` or :meth:`_orm.Query.with_entities` , which had broken as part of :ticket:`6503` released in 1.4.19. Fixes: #6808 Change-Id: Ib5d66cce488bbaca06dab4f68fb5cdaa73e8823e
* | | | | | Merge "Dispatch independent ctes on compound select"mike bayer2021-08-081-0/+6
|\ \ \ \ \ \
| * | | | | | Dispatch independent ctes on compound selectEric Masseran2021-08-081-0/+6
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix issue in :class:`_sql.CTE` where new :meth:`_sql.HasCTE.add_cte` method added in version 1.4.21 / :ticket:`6752` failed to function correctly for "compound select" structures such as :func:`_sql.union`, :func:`_sql.union_all`, :func:`_sql.except`, etc. Pull request courtesy Eric Masseran. Fixes: #6752 Closes: #6849 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6849 Pull-request-sha: 1c4b4d72b2789cf89ff5043ca964ebdd6c9a6617 Change-Id: I49a16a4fc2af8299502011f3a02d8a2ad93255e3
* | | | | | Merge "dont qualify literal_binds with literal_execute"mike bayer2021-08-071-1/+1
|\ \ \ \ \ \
| * | | | | | dont qualify literal_binds with literal_executeMike Bayer2021-08-071-1/+1
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this appears to be unnecessary and prevents end-user literal_binds case from working. Fixed issue where the ``literal_binds`` compiler flag, as used externally to render bound parameters inline, would fail to work when used with a certain class of parameters known as "literal_execute", which covers things like LIMIT and OFFSET values for dialects where the drivers don't allow a bound parameter, such as SQL Server's "TOP" clause. The issue locally seemed to affect only the MSSQL dialect. Fixes: #6863 Change-Id: Ia74cff5b0107b129a11b9b965883552b2962e449
* | | | | | Merge "Refactor mypy plugin"mike bayer2021-08-076-312/+410
|\ \ \ \ \ \
| * | | | | | Refactor mypy pluginBryan Forbes2021-08-076-312/+410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A major refactor of the mypy plugin Closes: #6764 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6764 Pull-request-sha: 3e2295b2da7b57a6669f26db0df78f6409934184 Change-Id: I067d56dcfbc998ddd1b22a448f756859428b9e31
* | | | | | | Merge "Modernize tests - dml_values"mike bayer2021-08-071-2/+0
|\ \ \ \ \ \ \
| * | | | | | | Modernize tests - dml_valuesGord Thompson2021-07-261-2/+0
| | |_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | Change-Id: Ida86ed40c43d91813151621b847376976773a5f9
* | | | | | | Merge "Modernize tests - remaining core SQL"mike bayer2021-08-071-8/+0
|\ \ \ \ \ \ \
| * | | | | | | Modernize tests - remaining core SQLGord Thompson2021-07-231-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I7d8c1f451c32dea28173b2206e66db1d0927fccf
* | | | | | | | Merge "accommodate for untracked boundparam lambda in offline_string"mike bayer2021-08-071-8/+8
|\ \ \ \ \ \ \ \
| * | | | | | | | accommodate for untracked boundparam lambda in offline_stringMike Bayer2021-08-051-8/+8
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed an issue in the ``CacheKey.to_offline_string()`` method used by the dogpile.caching example where attempting to create a proper cache key from the special "lambda" query generated by the lazy loader would fail to include the parameter values, leading to an incorrect cache key. Fixes: #6858 Change-Id: Ice27087583c6f3ff79cf7d5b879e5dd0a4e58158
* | | | | | | | Provide default for implicitly_named_constraintsGord Thompson2021-08-031-0/+6
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | … so third-party dialect testing won't fail with: "AttributeError: 'Requirements' object has no attribute 'implicitly_named_constraints'" Change-Id: Iafa3e36f3dd169c338dd6eaee21c73aa35e854cc
* | | | | | | Merge "accommodate for cloned bindparams w/ maintain_key"mike bayer2021-07-291-2/+8
|\ \ \ \ \ \ \
| * | | | | | | accommodate for cloned bindparams w/ maintain_keyMike Bayer2021-07-291-2/+8
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where a bound parameter object that was "cloned" would cause a name conflict in the compiler, if more than one clone of this parameter were used at the same time in a single statement. This could occur in particular with things like ORM single table inheritance queries that indicated the same "discriminator" value multiple times in one query. Fixes: #6824 Change-Id: Iba7a786fc5a2341ff7d07fc666d24ed790ad4fe8
* | | | | | | Merge "Support generics in code to allow Column[int] etc"mike bayer2021-07-294-1/+12
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | |
| * | | | | | Support generics in code to allow Column[int] etcFederico Caselli2021-07-274-1/+12
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #6804 Fixes: #6759 Change-Id: Ie7f32c38a22dbfa059b5709b883ff464b16031ae
* | | | | | accommodate plain core textual statementsMike Bayer2021-07-271-3/+5
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the horizontal sharding extension would not correctly accommodate for a plain textual SQL statement passed to :meth:`_orm.Session.execute`. Fixes: #6816 Change-Id: Ie2b71b06d10793443dbd5e1b271c56cbf9431bb3
* | | | | Modernize tests - dml_whereclauseGord Thompson2021-07-263-7/+10
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the unit of work would internally use a 2.0-deprecated SQL expression form, emitting a deprecation warning when SQLALCHEMY_WARN_20 were enabled. Fixes: #6812 Change-Id: I0a031e728527a1c3382848b6ddc793939362b128
* | | | Version 1.4.23 placeholderMike Bayer2021-07-211-1/+1
| |/ / |/| |