summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* use full context manager flow for future.Engine.begin()Mike Bayer2021-11-011-4/+37
| | | | | | | | | | | | | | | Fixed issue in future :class:`_future.Engine` where calling upon :meth:`_future.Engine.begin` and entering the context manager would not close the connection if the actual BEGIN operation failed for some reason, such as an event handler raising an exception; this use case failed to be tested for the future version of the engine. Note that the "future" context managers which handle ``begin()`` blocks in Core and ORM don't actually run the "BEGIN" operation until the context managers are actually entered. This is different from the legacy version which runs the "BEGIN" operation up front. Fixes: #7272 Change-Id: I9667ac0861a9e007c4b3dfcf0fcf0829038a8711
* remove case_sensitive create_engine parameterMike Bayer2021-11-011-133/+0
| | | | | | | | | | | | Removed the previously deprecated ``case_sensitive`` parameter from :func:`_sa.create_engine`, which would impact only the lookup of string column names in Core-only result set rows; it had no effect on the behavior of the ORM. The effective behavior of what ``case_sensitive`` refers towards remains at its default value of ``True``, meaning that string names looked up in ``row._mapping`` will match case-sensitively, just like any other Python mapping. Change-Id: I0dc4be3fac37d30202b1603db26fa10a110b618d
* Merge "2.0 removals: LegacyRow, connectionless execution, close_with_result" ↵mike bayer2021-10-319-1784/+509
|\ | | | | | | into main
| * 2.0 removals: LegacyRow, connectionless execution, close_with_resultMike Bayer2021-10-319-1784/+509
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in order to remove LegacyRow / LegacyResult, we have to also lose close_with_result, which connectionless execution relies upon. also includes a new profiles.txt file that's all against py310, as that's what CI is on now. some result counts changed by one function call which was enough to fail the low-count result tests. Replaces Connectable as the common interface between Connection and Engine with EngineEventsTarget. Engine is no longer Connectable. Connection and MockConnection still are. References: #7257 Change-Id: Iad5eba0313836d347e65490349a22b061356896a
* | Merge "Remove deprecated dialects and drivers" into mainmike bayer2021-10-3124-329/+44
|\ \ | |/ |/|
| * Remove deprecated dialects and driversFederico Caselli2021-10-3124-329/+44
| | | | | | | | | | Fixes: #7258 Change-Id: I3577f665eca04f2632b69bcb090f0a4ec9271db9
* | remove ORM autocommit and public-facing subtransactions conceptMike Bayer2021-10-3014-834/+107
| | | | | | | | | | | | | | | | | | In order to do LegacyRow we have to do Connection, which means we lose close_with_result (hooray) which then means we have to get rid of ORM session autocommit which relies on it, so let's do that first. Change-Id: I115f614733b1d0ba19f320ffa9a49f0d762db094
* | initial 2.0 setupMike Bayer2021-10-302-14/+0
|/ | | | | | | Adapted from 55e64f857daeb6057b85ff67297a774b when we previously started a 2.0 branch. Change-Id: Ib5af75df94b23104eebe0e918adcf979d798ea3b
* warnings removal, merge_resultMike Bayer2021-10-292-68/+101
| | | | | | | | | | | this is the last warning to remove. Also fixes some mistakes I made with the new Base20DeprecationWarning and LegacyAPIWarning classes created, where functions in deprecations.py were still hardcoded to RemovedIn20Warning. Change-Id: I9a6045ac9b813fd2f9668c4bc518c46a7774c6ef
* Merge "warnings: session.autocommit, subtransactions" into mainmike bayer2021-10-299-409/+105
|\
| * warnings: session.autocommit, subtransactionsMike Bayer2021-10-299-418/+613
| | | | | | | | Change-Id: I7eb7c87c9656f8043ea90d53897958afad2b8fe9
* | warnings: with_polymorphic()Mike Bayer2021-10-299-408/+2168
|/ | | | | | | | Also clarifies a behavior of None/False for the selectable parameter to with_polymorphic() Fixes: #7262 Change-Id: I58c4004e0af227d3995e9ae2461470440f97f252
* Merge "Modernize tests - session_query_get" into mainmike bayer2021-10-2940-518/+596
|\
| * Modernize tests - session_query_getGord Thompson2021-10-2840-518/+596
| | | | | | | | | | Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I92013aad471baf32df1b51b756e86d95449b5cfd
* | warnings: cascade_backrefsMike Bayer2021-10-2812-180/+470
| | | | | | | | | | | | | | this one is a little different in that the thing changing is the detection of a behavior, not an explicit API. Change-Id: Id142943a2b901b39fe9053d0120c1e820dc1a6d0
* | Merge "Improve array support on pg8000" into mainmike bayer2021-10-281-9/+19
|\ \ | |/ |/|
| * Improve array support on pg8000Federico Caselli2021-10-271-9/+19
| | | | | | | | | | | | References: #6023 Change-Id: I0f6cbc34b3c0bfc0b8c86b3ebe4531e23039b6c0
* | Merge "deprecation warnings: with_parent, aliased, from_joinpoint" into mainmike bayer2021-10-2711-248/+610
|\ \
| * | deprecation warnings: with_parent, aliased, from_joinpointMike Bayer2021-10-2711-248/+610
| | | | | | | | | | | | | | | | | | | | | | | | | | | most of the work for aliased / from_joinpoint has been done already as I added all new tests for these and moved most aliased/from_joinpoint to test/orm/test_deprecations.py already Change-Id: Ia23e332dec183de17b2fb9d89d946af8d5e89ae7
* | | Merge "consider "inspect(_of_type)" to be the entity of a comparator" into mainmike bayer2021-10-271-0/+67
|\ \ \ | |_|/ |/| |
| * | consider "inspect(_of_type)" to be the entity of a comparatorMike Bayer2021-10-271-0/+67
| |/ | | | | | | | | | | | | | | | | | | | | Fixed 1.4 regression where :meth:`_orm.Query.filter_by` would not function correctly when :meth:`_orm.Query.join` were joined to an entity which made use of :meth:`_orm.PropComparator.of_type` to specify an aliased version of the target entity. The issue also applies to future style ORM queries constructed with :func:`_sql.select`. Fixes: #7244 Change-Id: Ied28a03ce93201f932c7172d283cd4297be4d592
* | Merge "Remove depractions:" into mainmike bayer2021-10-265-42/+140
|\ \ | |/ |/|
| * Remove depractions:Federico Caselli2021-10-265-42/+140
| | | | | | | | | | | | | | - Passing bind arguments to Session.execute - This Session located a target engine via bound metadata Change-Id: I916c8c4cff344ee5652fceac4dfd241dd8160f7b
* | dont pull filter_by from from_obj, entity is hopefully sufficientMike Bayer2021-10-262-0/+107
| | | | | | | | | | | | | | | | | | Fixed 1.4 regression where :meth:`_orm.Query.filter_by` would not function correctly on a :class:`_orm.Query` that was produced from :meth:`_orm.Query.union`, :meth:`_orm.Query.from_self` or similar. Fixes: #7239 Change-Id: I3a0c3fd71180b1bfb6bf855f436a29c729664082
* | warnings: select_entity_from()Mike Bayer2021-10-256-265/+1004
| | | | | | | | Change-Id: I8c259e61134c38a1fa907c308068337473c82914
* | deprecation warnings: strings in loader options, join, with_parentMike Bayer2021-10-2530-825/+1765
|/ | | | | | | | | | | | | Repairs one in-library deprecation warning regarding mapper propagation of options raises maxfail to 250, as 25 is too low when we are trying to address many errors at once. the 25 was originally due to the fact that our fixtures would be broken after that many failures in most cases, which today should not be the case nearly as often. Change-Id: I26affddf42e2cae2aaf9561633e9b8cd431eb189
* Merge "use correct entity in path for aliased class relationship" into mainmike bayer2021-10-221-5/+49
|\
| * use correct entity in path for aliased class relationshipMike Bayer2021-10-221-5/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in "relationship to aliased class" feature introduced at :ref:`relationship_aliased_class` where it was not possible to create a loader strategy option targeting an attribute on the target using the :func:`_orm.aliased` construct directly in a second loader option, such as ``selectinload(A.aliased_bs).joinedload(aliased_b.cs)``, without explicitly qualifying using :meth:`_orm.PropComparator.of_type` on the preceding element of the path. Additionally, targeting the non-aliased class directly would be accepted (inappropriately), but would silently fail, such as ``selectinload(A.aliased_bs).joinedload(B.cs)``; this now raises an error referring to the typing mismatch. Fixes: #7224 Change-Id: I40857c7275667dcb64f1d1fd0c8072e48758e678
* | Merge "fix: Update reserved words list of MySQL / MariaDB dialect" into mainmike bayer2021-10-202-13/+102
|\ \ | |/ |/|
| * fix: Update reserved words list of MySQL / MariaDB dialectKevin Kirsche2021-10-202-13/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorganized the list of reserved words into two separate lists, one for MySQL and one for MariaDB, so that these diverging sets of words can be managed more accurately; adjusted the MySQL/MariaDB dialect to switch among these lists based on either explicitly configured or server-version-detected "MySQL" or "MariaDB" backend. Added all current reserved words through MySQL 8 and current MariaDB versions including recently added keywords like "lead" . Pull request courtesy Kevin Kirsche. 1. Move reserved words to it's own file. 2. Add missing reserved words from https://mariadb.com/kb/en/reserved-words/ * Note: this only adds MariaDB though links to MySQL, it also does not include the reserved words for Oracle mode, as listed in the link. Fixes: #7167 Supercedes: #7197 Closes: #7207 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7207 Pull-request-sha: 5a682e331069520ccad9e6bf3cc5e4a77a889ef0 Change-Id: Ib25be8148568899f56b5c9b42d4f530ade8a04e3
* | remove _resolve_label and related attributesMike Bayer2021-10-202-0/+14
|/ | | | | | | | | | | | | these seem to date back to 0.9 and revs like #3148 but none of it seems to be affecting things now, try removing it all and seeing what fails. we've noted that _resolve_label does not appear to be needed, however allow_label_resolve remains relevant both for non-column elements like text() as well as that it is used explicitly by the joined eager loader. Change-Id: Ic8a5d8001ef2a4133360f51a92a6f7b0cc389095
* process bulk_update_tuples before cache key or compilationMike Bayer2021-10-196-8/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where the use of a :class:`_orm.hybrid_property` attribute or a mapped :func:`_orm.composite` attribute as a key passed to the :meth:`_dml.Update.values` method for an ORM-enabled :class:`_dml.Update` statement, as well as when using it via the legacy :meth:`_orm.Query.update` method, would be processed for incoming ORM/hybrid/composite values within the compilation stage of the UPDATE statement, which meant that in those cases where caching occurred, subsequent invocations of the same statement would no longer receive the correct values. This would include not only hybrids that use the :meth:`_orm.hybrid_property.update_expression` method, but any use of a plain hybrid attribute as well. For composites, the issue instead caused a non-repeatable cache key to be generated, which would break caching and could fill up the statement cache with repeated statements. The :class:`_dml.Update` construct now handles the processing of key/value pairs passed to :meth:`_dml.Update.values` and :meth:`_dml.Update.ordered_values` up front when the construct is first generated, before the cache key has been generated so that the key/value pairs are processed each time, and so that the cache key is generated against the individual column/value pairs that will ultimately be used in the statement. Fixes: #7209 Change-Id: I08f248d1d60ea9690b014c21439b775d951fb9e5
* use coercions for label element, ensure propagate_attrsMike Bayer2021-10-181-0/+36
| | | | | | | | | | Fixed bug where the ORM "plugin", necessary for features such as :func:`_orm.with_loader_criteria` to work correctly, would not be applied to a :func:`_sql.select` which queried from an ORM column expression if it made use of the :meth:`_sql.ColumnElement.label` modifier. Fixes: #7205 Change-Id: I72b84442e14df8b5ece33916f3c51ca3f358864b
* Merge "fix with_loader_criteria for select(A).join(B)" into mainmike bayer2021-10-151-0/+20
|\
| * fix with_loader_criteria for select(A).join(B)Mike Bayer2021-10-151-0/+20
| | | | | | | | | | | | | | | | | | | | Also revise the contains_eager() note that was just added in fec2b6560c14bb28ee7f, as I mistakenly forgot that WLC also affects elements of the query that are there as part of the normal entites/criteria. Fixes: #7189 Change-Id: Ibd8a1826aaee8e91ab6704173df5fccb56b7e785
* | Merge "support bind expressions w/ expanding IN; apply to psycopg2" into mainmike bayer2021-10-153-41/+215
|\ \ | |/ |/|
| * support bind expressions w/ expanding IN; apply to psycopg2Mike Bayer2021-10-153-41/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where "expanding IN" would fail to function correctly with datatypes that use the :meth:`_types.TypeEngine.bind_expression` method, where the method would need to be applied to each element of the IN expression rather than the overall IN expression itself. Fixed issue where IN expressions against a series of array elements, as can be done with PostgreSQL, would fail to function correctly due to multiple issues within the "expanding IN" feature of SQLAlchemy Core that was standardized in version 1.4. The psycopg2 dialect now makes use of the :meth:`_types.TypeEngine.bind_expression` method with :class:`_types.ARRAY` to portably apply the correct casts to elements. The asyncpg dialect was not affected by this issue as it applies bind-level casts at the driver level rather than at the compiler level. as part of this commit the "bind translate" feature has been simplified and also applies to the names in the POSTCOMPILE tag to accommodate for brackets. Fixes: #7177 Change-Id: I08c703adb0a9bd6f5aeee5de3ff6f03cccdccdc5
* | Merge "Fix reflection of FK against a unique index" into mainmike bayer2021-10-152-3/+58
|\ \
| * | Fix reflection of FK against a unique indexGord Thompson2021-10-142-3/+58
| |/ | | | | | | | | | | | | | | Also implement reflection of ON DELETE, ON UPDATE as the data is right there. Fixes: #7160 Change-Id: Ifff871a8cb1d1bea235616042e16ed3b5c5f19f9
* | repair fetch after session close for mssql+pyodbcMike Bayer2021-10-152-1/+16
|/ | | | | | | this test relies upon a cursor that can do fetchall() after connection.rollback() was called. Change-Id: I8c19a67bad97019375671c69d6ed7fa4f4e6872f
* Merge "Reflect table can reflect table with no columns" into mainmike bayer2021-10-141-0/+5
|\
| * Reflect table can reflect table with no columnsSumit Khanna2021-10-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The :meth:`_engine.Inspector.reflect_table` method now supports reflecting tables that do not have user defined columns. This allows :meth:`_schema.MetaData.reflect` to properly complete reflection on databases that contain such tables. Currently, only PostgreSQL is known to support such a construct among the common database backends. Fixes: #3247 Closes: #7118 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7118 Pull-request-sha: cb8ce01957e9a1453290a7c2728af8c60ef55fa1 Change-Id: I906cebe17d13554d79086b92f3e1e51ffba3e818
* | Merge "Pickling fixes for ORM / Core" into mainmike bayer2021-10-132-27/+60
|\ \
| * | Pickling fixes for ORM / CoreMike Bayer2021-10-132-27/+60
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where ORM loaded objects could not be pickled in cases where loader options making use of ``"*"`` were used in certain combinations, such as combining the :func:`_orm.joinedload` loader strategy with ``raiseload('*')`` of sub-elements. Fixes: #7134 Fixed issue where SQL queries using the :meth:`_functions.FunctionElement.within_group` construct could not be pickled, typically when using the ``sqlalchemy.ext.serializer`` extension but also for general generic pickling. Fixes: #6520 Change-Id: Ib73fd49c875e6da9898493c190f610e68b88ec72
* | Merge "Fix has_table() false negative for #temp tables" into mainmike bayer2021-10-131-0/+47
|\ \
| * | Fix has_table() false negative for #temp tablesGord Thompson2021-10-121-0/+47
| |/ | | | | | | | | | | | | | | | | | | | | Fixed issue with :meth:`.Inspector.has_table` where it would return False if a local temp table with the same name from a different session happened to be returned first when querying tempdb. This is a continuation of :ticket:`6910` which accounted for the temp table existing only in the alternate session and not the current one. Fixes: #7168 Change-Id: I19dbb71a63184c6d41822b0e882b7b284ac83786
* | Fix recursive CTE to support nestingEric Masseran2021-10-122-20/+153
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Repaired issue in new :paramref:`_sql.HasCTE.cte.nesting` parameter introduced with :ticket:`4123` where a recursive :class:`_sql.CTE` using :paramref:`_sql.HasCTE.cte.recursive` in typical conjunction with UNION would not compile correctly. Additionally makes some adjustments so that the :class:`_sql.CTE` construct creates a correct cache key. Pull request courtesy Eric Masseran. Fixes: #4123 > This has not been caught by the tests because the nesting recursive queries there did not union against itself, eg there was only the i root clause... - Now tests are real recursive queries - Add tests on aliased nested CTEs (recursive or not) - Adapt the `_restates` attribute to use it as a reference - Add some docs around to explain some variables usage Closes: #7133 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7133 Pull-request-sha: 2633f34f7f5336a4a85bd3f71d07bca33ce27a2c Change-Id: I15512c94e1bc1f52afc619d82057ca647d274e92
* rename elements to mainMike Bayer2021-10-112-10/+10
| | | | | | | There are still some SQLite / MySQL specific occurrences of "master" but this is most of it. Change-Id: I0144c992e2f0207777e20e058b63a11c031986b9
* fixes for usage of the null() and similar constantsMike Bayer2021-10-087-36/+260
| | | | | | | | | | | | | | | | | | | | | | | | Adjusted the "column disambiguation" logic that's new in 1.4, where the same expression repeated gets an "extra anonymous" label, so that the logic more aggressively deduplicates those labels when the repeated element is the same Python expression object each time, as occurs in cases like when using "singleton" values like :func:`_sql.null`. This is based on the observation that at least some databases (e.g. MySQL, but not SQLite) will raise an error if the same label is repeated inside of a subquery. Related to :ticket:`7153`, fixed an issue where result column lookups would fail for "adapted" SELECT statements that selected for "constant" value expressions most typically the NULL expression, as would occur in such places as joined eager loading in conjunction with limit/offset. This was overall a regression due to issue :ticket:`6259` which removed all "adaption" for constants like NULL, "true", and "false", but this broke the case where the same adaption logic were used to match the constant to a labeled expression referring to the constant in a subquery. Fixes: #7153 Fixes: #7154 Change-Id: I43823343721b9e70524ea3f5e8f39dd543a3e92b
* block asyncmy 0.2.1Mike Bayer2021-10-081-1/+0
| | | | | Change-Id: I0c95e20be01846ed2c705e54d8d5a8395031ff03 References: https://github.com/long2ice/asyncmy/issues/18