summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
Commit message (Collapse)AuthorAgeFilesLines
* prevent float tests from running on asyncmyMike Bayer2023-02-272-4/+16
| | | | | | | | | asyncmy 0.2.7 has had a loss in float precision for even very low numbers of significant digits. Change-Id: Iec6d2650943eeaa8e854f21990f6565d73331f8c References: https://github.com/long2ice/asyncmy/issues/56 (cherry picked from commit 8855656626202e541bd2c95bc023e820a022322f)
* fix incorrect use of testing.future()Mike Bayer2023-01-251-3/+2
| | | | | | | | this has been emitting a warning probably for a long time Change-Id: I44a6766b5e92d14ce6bbb5a90ab52648f877afc2 (cherry picked from commit 74aabce5190449ba2af65c180ebe67fe444193fb)
* fix stringify for CreateSchemaMike Bayer2023-01-241-0/+2
| | | | | | | | | Fixed stringify for a the :class:`.CreateSchema` DDL construct, which would fail with an ``AttributeError`` when stringified without a dialect. Fixes: #7664 Change-Id: Ifc1769604bc5219c060f5112f7bdea0f780f1a1c (cherry picked from commit 90f4b5d84f248d95f3df38e74be92b23fd880e42)
* fix ORM support for column-named bindparam() in crud .values()Mike Bayer2023-01-112-21/+67
| | | | | | | | | | | | | | | | | | | | | | | Fixed bug / regression where using :func:`.bindparam()` with the same name as a column in the :meth:`.Update.values` method of :class:`.Update`, as well as the :meth:`.Insert.values` method of :class:`.Insert` in 2.0 only, would in some cases silently fail to honor the SQL expression in which the parameter were presented, replacing the expression with a new parameter of the same name and discarding any other elements of the SQL expression, such as SQL functions, etc. The specific case would be statements that were constructed against ORM entities rather than plain :class:`.Table` instances, but would occur if the statement were invoked with a :class:`.Session` or a :class:`.Connection`. :class:`.Update` part of the issue was present in both 2.0 and 1.4 and is backported to 1.4. For 1.4, also backports the sqlalchemy.testing.Variation update to the variation() API. Fixes: #9075 Change-Id: Ie954bc1f492ec6a566163588182ef4910c7ee452 (cherry picked from commit b5b864e0fe50243a94c0ef04fddda6fa446c1524)
* happy new year 2023Mike Bayer2023-01-0317-17/+17
| | | | Change-Id: I14db8e9c69a832b0f5dae8036db3c0a70bb49edd
* add uber warning for 1.4Mike Bayer2023-01-021-0/+2
| | | | | | | | | | | | | | | | As we don't have any automatic deprecation warning for 2.0 unless SQLALCHEMY_WARN_20 is set, applications that are not being monitored for deprecations have no way to guard against 2.0 being released on pypi unless they add a requirements rule. make sure we are putting out a major warning for people who may have not noticed that SQLAlchemy 2.0 will break compatibility with legacy use patterns. Fixes: #8983 Change-Id: I7d50db52c9a0fe3165b0131aab2fce9af80d51dd
* add exclusion for unusual chars in column namesMike Bayer2022-12-192-0/+12
| | | | | | | | | | | | | Added new exclusion rule for third party dialects called ``unusual_column_name_characters``, which can be "closed" for third party dialects that don't support column names with unusual characters such as dots, slashes, or percent signs in them, even if the name is properly quoted. Fixes: #9002 Change-Id: I44b765df4c73ce5ec1907d031fd9c89761fd99d1 References: #8993 (cherry picked from commit 946058ec6070ab4db9fdfab612ec4543fea9cd1c)
* Specify view columns in HasTableTestGord Thompson2022-12-091-4/+7
| | | | | | | | | | Fixes: #8960 Avoid test errors on databases that do not support CREATE VIEW vv AS SELECT * FROM Change-Id: Ic9e892aa4466030b9b325c11228dad15cf59a258 (cherry picked from commit 7e9b1450b6899c82c9362cbc92fcc0f01c97b043)
* add spaces, leading underscore to oracle checksMike Bayer2022-12-021-3/+63
| | | | | | | | | | | | | Expand the test suite from #8708 which unfortunately did not exercise the bound parameter codepaths completely. Continued fixes for Oracle fix :ticket:`8708` released in 1.4.43 where bound parameter names that start with underscores, which are disallowed by Oracle, were still not being properly escaped in all circumstances. Fixes: #8708 Change-Id: Ic389c09bd7c53b773e5de35f1a18ef20769b92a7 (cherry picked from commit 2886412438de072b4925818ac746e56a2067bee3)
* Fix positional compiling bugsFederico Caselli2022-12-011-3/+61
| | | | | | | | | | | | Fixed a series of issues regarding positionally rendered bound parameters, such as those used for SQLite, asyncpg, MySQL and others. Some compiled forms would not maintain the order of parameters correctly, such as the PostgreSQL ``regexp_replace()`` function as well as within the "nesting" feature of the :class:`.CTE` construct first introduced in :ticket:`4123`. Fixes: #8827 Change-Id: I9813ed7c358cc5c1e26725c48df546b209a442cb (cherry picked from commit 0f2baae6bf72353f785bad394684f2d6fa53e0ef)
* add partial index predicate to SQLiteDialect.get_indexes() resultTobias Pfeiffer2022-11-281-5/+8
| | | | | | | | | | | | | | Added support for reflection of expression-oriented WHERE criteria included in indexes on the SQLite dialect, in a manner similar to that of the PostgreSQL dialect. Pull request courtesy Tobias Pfeiffer. Fixes: #8804 Closes: #8806 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8806 Pull-request-sha: 539dfcb372360911b69aed2a804698bb1a2220b1 Change-Id: I0e34d47dbe2b9c1da6fce531363084843e5127a3 (cherry picked from commit ed39e846cd8ae2714c47fc3d563582f72483df0c)
* add new variation helperMike Bayer2022-11-262-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm using a lot of @testing.combinations with either a boolean True/False, or a series of string names, each indicating some case to switch on. I want a descriptive name in the test run (not True/False) and I don't want to compare strings. So make a new helper around @combinations that provides an object interface that has booleans inside of it, prints nicely in the test output, raises an error if you name the case incorrectly. Before: test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-False-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-False-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-False-name] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-True-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-True-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[False-True-name] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-False-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-False-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-False-name] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-True-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-True-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[True-True-name] PASSED After: test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-deferred-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-deferred-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-deferred-name] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-not_deferred-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-not_deferred-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[not_use_add_property-not_deferred-name] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-deferred-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-deferred-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-deferred-name] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-not_deferred-both] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-not_deferred-key] PASSED test/orm/declarative/test_typed_mapping.py::MappedColumnTest::test_separate_name[use_add_property-not_deferred-name] PASSED Change-Id: Idde87632581ee69e0f47360966758583dfd8baab (cherry picked from commit 3ffa8dccc224d7b7d604bdfb684c437f4cb42f92)
* assert unique constraints received backMike Bayer2022-11-241-0/+2
| | | | | | | | in #8867 we can see our existing uq reflection test is broken, not detecting a failure to detect constraints Change-Id: Icada02bc0547c5a3d8c471b80a78a2e72f02647d (cherry picked from commit f99300c4e8d1317a94cbfeaec6fe22de8f1159f7)
* Repair test in 32bit python builds.Federico Caselli2022-11-121-0/+4
| | | | | Change-Id: I8287f3e1a975534c8a01a41c9dcc7e5e9f08bb52 (cherry picked from commit 9f4ac8d155f58b59cf314cfbc73195ed51a0c146)
* Merge "ensure anon_map is passed for most annotated traversals" into rel_1_4mike bayer2022-11-113-0/+76
|\
| * ensure anon_map is passed for most annotated traversalsMike Bayer2022-11-113-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can cache the annotated cache key for Table, but for selectables it's not safe, as it fails to pass the anon_map along and creates many redudant structures in observed test scenario. It is likely safe for a Column that's mapped to a Table also, however this is not implemented here. Will have to see if that part needs adjusting. Fixed critical memory issue identified in cache key generation, where for very large and complex ORM statements that make use of lots of ORM aliases with subqueries, cache key generation could produce excessively large keys that were orders of magnitude bigger than the statement itself. Much thanks to Rollo Konig Brock for their very patient, long term help in finally identifying this issue. Also within TypeEngine objects, when we generate elements for instance variables, skip the None elements at least. this also saves on tuple complexity. Fixes: #8790 Change-Id: I448ddbfb45ae0a648815be8dad4faad7d1977427 (cherry picked from commit 88c240d907a9ae3b5caf766009edd196a30cece3)
* | repair --disable-asyncio parameterMike Bayer2022-11-112-1/+5
|/ | | | | | | | | | | | Fixed issue where the ``--disable-asyncio`` parameter to the test suite would fail to not actually run greenlet tests and would also not prevent the suite from using a "wrapping" greenlet for the whole suite. This parameter now ensures that no greenlet or asyncio use will occur within the entire run when set. Fixes: #8793 Change-Id: I87b510846b2cc24413cd54e7b7136e91aad3c309 (cherry picked from commit 7f7e961f46aeff5895bd34fec9e2e208862d7a6b)
* use only object_id() function for temp tablesMike Barry2022-10-282-13/+69
| | | | | | | | | | | | | | | | | | | Fixed issue with :meth:`.Inspector.has_table` when used against a temporary table for the SQL Server dialect would fail an invalid object name error on some Azure variants, due to an unnecessary information schema query that is not supported on those server versions. Pull request courtesy Mike Barry. the patch also fills out test support for has_table() against temp tables, temp views, adding to the has_table() support just added for views in #8700. Fixes: #8714 Closes: #8716 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8716 Pull-request-sha: e2ac7a52e2b09a349a703ba1e1a2911f4d3c0912 Change-Id: Ia73e4e9e977a2d6b7e100abd2f81a8c8777dc9bb (cherry picked from commit 2af33d79eddc696c0fb1ef749999fa5d0d33f214)
* add Oracle-specific parameter escapes for expanding paramsMike Bayer2022-10-241-0/+9
| | | | | | | | | | | | | | | Fixed issue where bound parameter names, including those automatically derived from similarly-named database columns, which contained characters that normally require quoting with Oracle would not be escaped when using "expanding parameters" with the Oracle dialect, causing execution errors. The usual "quoting" for bound parameters used by the Oracle dialect is not used with the "expanding parameters" architecture, so escaping for a large range of characters is used instead, now using a list of characters/escapes that are specific to Oracle. Fixes: #8708 Change-Id: I90c24e48534e1b3a4c222b3022da58159784d91a (cherry picked from commit b1cd6e4295b07e01983deb2845f6e22a059f5b76)
* test support for has_table()->view; backport to 1.4Mike Bayer2022-10-231-0/+43
| | | | | | | | | | | | | | | | | | | | For 1.4 only; in 2.0 this just refines the test suite a bit. Fixed regression which occurred throughout the 1.4 series where the :meth:`.Inspector.has_table` method, which historically reported on views as well, stopped working for SQL Server. The method never worked for Oracle in this way, so for compatibility within the 1.4 series, Oracle's dialect remains returning False for ``has_table()`` against a view within the 1.4 series. The issue is not present in the 2.0 series which uses a different reflection architecture, where has_table() reports True for views on all backends including SQL Server and Oracle. Test support is added within the 1.4 series to ensure ``has_table()`` remains working per spec re: views. Fixes: #8700 Change-Id: I119a91ec07911edb08cf0799234827fec9ea1195 (cherry picked from commit c02f6b744d304578fe67da2e13d2c02ab71140d2)
* `aggregate_order_by` now supports cache generation.Federico Caselli2022-09-251-0/+108
| | | | | | | | | | also adjusted CacheKeyFixture to be a general purpose fixture so that sub-components / dialects can run their own cache key tests. Fixes: #8574 Change-Id: I6c66107856aee11e548d357cea77bceee3e316a0 (cherry picked from commit 7980b677085fc759a0406f6778b9729955f3c7f6)
* Update to flake8 5.Federico Caselli2022-07-311-3/+2
| | | | | Change-Id: I5a241a70efba68bcea9819ddce6aebc25703e68d (cherry picked from commit f8c4dba4e9f130c18ce00597c036bc26ae7abf90)
* repair yield_per for non-SS dialects and add new optionsMike Bayer2022-07-011-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented new :paramref:`_engine.Connection.execution_options.yield_per` execution option for :class:`_engine.Connection` in Core, to mirror that of the same :ref:`yield_per <orm_queryguide_yield_per>` option available in the ORM. The option sets both the :paramref:`_engine.Connection.execution_options.stream_results` option at the same time as invoking :meth:`_engine.Result.yield_per`, to provide the most common streaming result configuration which also mirrors that of the ORM use case in its usage pattern. Fixed bug in :class:`_engine.Result` where the usage of a buffered result strategy would not be used if the dialect in use did not support an explicit "server side cursor" setting, when using :paramref:`_engine.Connection.execution_options.stream_results`. This is in error as DBAPIs such as that of SQLite and Oracle already use a non-buffered result fetching scheme, which still benefits from usage of partial result fetching. The "buffered" strategy is now used in all cases where :paramref:`_engine.Connection.execution_options.stream_results` is set. Added :meth:`.FilterResult.yield_per` so that result implementations such as :class:`.MappingResult`, :class:`.ScalarResult` and :class:`.AsyncResult` have access to this method. Fixes: #8199 Change-Id: I6dde3cbe483a1bf81e945561b60f4b7d1c434750 (cherry picked from commit e5a0cdb2eaa1d7f381e93d0529a7f8e6d5888877)
* handle non-mapped mixins for with_loader_criteria reduceMike Bayer2022-06-091-0/+10
| | | | | | | | | | special handling is needed for a with_loader_criteria() against a non-mapped mixin class. added that to test coverage Fixes: #8109 Change-Id: Ia599361c8faab008e92095eb4607d02820f590d5 (cherry picked from commit 6f93f88b5ee683141c81ecd434a4c0818e08dbd9)
* Merge "remove "deannotate" from column_property expression" into rel_1_4mike bayer2022-05-291-0/+4
|\
| * remove "deannotate" from column_property expressionMike Bayer2022-05-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where using a :func:`_orm.column_property` construct containing a subquery against an already-mapped column attribute would not correctly apply ORM-compilation behaviors to the subquery, including that the "IN" expression added for a single-table inherits expression would fail to be included. This fix involves a few tweaks in the ORM adaptation logic, including a missing "parententity" adaptation on the mapper side. The specific mechanics here have a lot of moving parts so we will continue to add tests to assert these cases. In particular a more complete test for issue #2316 is added that was relying upon the deannotate happening here. Fixes: #8064 Change-Id: Ia85dd12dcf6e7c002b30de4a27d7aa66cb3cd20e (cherry picked from commit 8c5cc8ae255a7580e2ff339659cf66cd2c6e02c1)
* | move bindparam quote application from compiler to defaultMike Bayer2022-05-291-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in 296c84313ab29bf9599634f3 for #5653 we generalized Oracle's parameter escaping feature into the compiler, so that it could also work for PostgreSQL. The compiler used quoted names within parameter dictionaries, which then led to the complexity that all functions which interpreted keys from the compiled_params dict had to also quote the param names to use the dictionary. This extra complexity was not added to the ORM peristence.py however, which led to the versioning id feature being broken as well as other areas where persistence.py relies on naming schemes present in context.compiled_params. It also was not added to the "processors" lookup which led to #8053, that added this escaping to that part of the compiler. To both solve the whole problem as well as simplify the compiler quite a bit, move the actual application of the escaped names to be as late as possible, when default.py builds the final list of parameters. This is more similar to how it worked previously where OracleExecutionContext would be late-applying these escaped names. This re-establishes context.compiled_params as deterministically named regardless of dialect in use and moves out the complexity of the quoted param names to be only at the cursor.execute stage. Fixed bug, likely a regression from 1.3, where usage of column names that require bound parameter escaping, more concretely when using Oracle with column names that require quoting such as those that start with an underscore, or in less common cases with some PostgreSQL drivers when using column names that contain percent signs, would cause the ORM versioning feature to not work correctly if the versioning column itself had such a name, as the ORM assumes certain bound parameter naming conventions that were being interfered with via the quotes. This issue is related to :ticket:`8053` and essentially revises the approach towards fixing this, revising the original issue :ticket:`5653` that created the initial implementation for generalized bound-parameter name quoting. Fixes: #8056 Change-Id: I57b064e8f0d070e328b65789c30076f6a0ca0fef (cherry picked from commit a48b597d0cafa1dd7fc46be99eb808fd4cb0a347)
* enable pg8000 for 1.29.1 and aboveMike Bayer2022-05-241-1/+9
| | | | | | | | | | | | ROLLBACK TO SAVEPOINT is re-enabled in https://github.com/tlocke/pg8000/issues/111. we still have to add savepoint support to our fixture that deletes from tables without checking for them. this is inconvenient but not incorrect. Change-Id: I2f4a0a3e18db93c3e6794ade9b0fee33d2e4b7dc (cherry picked from commit c0612f8166b7cd07895e7302bb59192abbb68c43)
* adjust log stacklevel for py3.11.0b1; enable greenletMike Bayer2022-05-151-0/+4
| | | | | | | | | | | | | | | | | Fixed issue where support for logging "stacklevel" implemented in :ticket:`7612` required adjustment to work with recently released Python 3.11.0b1, also repairs the unit tests which tested this feature. Install greenlet from a py311 compat patch. re: the stacklevel thing, this is going to be very inconvenient if we have to keep hardcoding numbers everywhere for every new python version Change-Id: I0c8f7293e98c0ca5cc544538284bfd1d3020cb1f References: https://github.com/python-greenlet/greenlet/issues/288 Fixes: #8019 (cherry picked from commit 43ff5b82dc0d91cacd625ac8943622ab340958c5)
* Revert "search for pickle failures"Mike Bayer2022-05-131-8/+0
| | | | | | This reverts commit 48ccecbe69795753baac1ca6d351c1af5ebcdd7b. not being careful w/ the commandline as I eat breakfast today
* search for pickle failuresMike Bayer2022-05-131-0/+8
| | | | | | | this is not for merge, trying to locate what might be the problem at #8000 Change-Id: I3ee7bf85f42eca861d32fc402b69796d518934d1
* Use tuple instead of raw url in string formatting (#7987)dzcode2022-05-031-3/+5
| | | | | | | | * Fixes: #7902 - Use tuple instead of raw url in string formatting * Fix lint error (cherry picked from commit 675c3e17f7fcccb7534c46adb56529fc3ddd8dbf)
* update flake8 noqa skips with proper syntaxFederico Caselli2022-04-111-1/+1
| | | | | Change-Id: I42ed77f559e3ee5b8c600d98457ee37803ef0ea6 (cherry picked from commit 139c6ec0fb1f930be9b64545262d2580f6cbc83e)
* add sane_rowcount to SimpleUpdateDeleteTestMike Bayer2022-04-091-0/+1
| | | | | | | | | | For third party dialects, repaired a missing requirement for the ``SimpleUpdateDeleteTest`` suite test which was not checking for a working "rowcount" function on the target dialect. Fixes: #7919 Change-Id: I2bc68132131eb36c43b8dabec0fac86272e26df5 (cherry picked from commit f3a65eb9033397fbf746fbf71df19ca9d1fce2f4)
* maintain complete cloned_set for BindParameterMike Bayer2022-04-061-0/+7
| | | | | | | | | | | | Fixed regression caused by :ticket:`7823` which impacted the caching system, such that bound parameters that had been "cloned" within ORM operations, such as polymorphic loading, would in some cases not acquire their correct execution-time value leading to incorrect bind values being rendered. Fixes: #7903 Change-Id: I61c802749b859bebeb127d24e66d6e77d13ce57a (cherry picked from commit 2168a64affb2e299b9a37079af7b2a8d4ae0ff64)
* fix quotes regexp for SQLite CHECK constraintsMike Bayer2022-03-281-2/+4
| | | | | | | | | | Fixed bug where the name of CHECK constraints under SQLite would not be reflected if the name were created using quotes, as is the case when the name uses mixed case or special characters. Fixes: #5463 Change-Id: Ic3b1e0a0385fb9e727b0880e90815ea2814df313 (cherry picked from commit cb52b934000047278dbb63d0cfffdb4eae1f669c)
* test sqlite w/ savepoint workaround in session fixture testMike Bayer2022-03-071-0/+14
| | | | | | Fixes: #7795 Change-Id: Ib790581555656c088f86c00080c70d19ca295a03 (cherry picked from commit fbacb1991585202a5bf22acb0d36b5c979bcfad8)
* update zimportsMike Bayer2022-02-091-1/+3
| | | | | | | | | includes new fix for formatting like black does. also runs black on a few outliers. Change-Id: I67446660a6bc10b73eb710389ae6d3f122af9302 (cherry picked from commit 2579ed2b8f295c7e0ad3d875bf57535623f8df0d)
* dont test squelched warnings against the filterMike Bayer2022-01-231-0/+2
| | | | | | | | | | | | I spent days on Ibcf09af25228d39ee5a943fda82d8a9302433726 reading it over and over again and noticed this slight inaccuracy 10 seconds after I merged it. the assert_warns_message() and assert_warns() functions should not consider a mismatched warning class as valid for a match. Change-Id: Ib8944dd95bcec1a7e4963917a5f4829e2ba27732 (cherry picked from commit f653d5eb169e3d0371eae388aecb0db0cb0b8c11)
* dont use exception catches for warnings; modernize xdist detectionMike Bayer2022-01-224-34/+78
| | | | | | | | | | | | | | | | | | | | | Improvements to the test suite's integration with pytest such that the "warnings" plugin, if manually enabled, will not interfere with the test suite, such that third parties can enable the warnings plugin or make use of the ``-W`` parameter and SQLAlchemy's test suite will continue to pass. Additionally, modernized the detection of the "pytest-xdist" plugin so that plugins can be globally disabled using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 without breaking the test suite if xdist were still installed. Warning filters that promote deprecation warnings to errors are now localized to SQLAlchemy-specific warnings, or within SQLAlchemy-specific sources for general Python deprecation warnings, so that non-SQLAlchemy deprecation warnings emitted from pytest plugins should also not impact the test suite. Identified a bit of cleanup for the PostgreSQL provisioning as a result. Fixes: #7599 Change-Id: Ibcf09af25228d39ee5a943fda82d8a9302433726 (cherry picked from commit a0f1914b903de6c130ab1c3267138b8ad208e144)
* Remove dispose warning on async engines when running testsFederico Caselli2022-01-211-1/+6
| | | | | | Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: Ia3357959ed286dc7d2ce264b5ddcadf309351ff7 (cherry picked from commit 9b2cd1ede5951fff7180d64bb39aa3a601ec1900)
* re-enable tests for asyncmy; fix BinaryMike Bayer2022-01-201-0/+39
| | | | | | | | | | Fixed regression in asyncmy dialect caused by :ticket:`7567` where removal of the PyMySQL dependency broke binary columns, due to the asyncmy dialect not being properly included within CI tests. Fixes: #7593 Change-Id: Iefc1061c24c75fcb9ca1a02d0b5e5f43970ade17 (cherry picked from commit da128e11ff5fcaafbf80704dc0aa8da0a901fb3e)
* Merge "implement second-level type resolution for literals" into rel_1_4mike bayer2022-01-112-0/+62
|\
| * implement second-level type resolution for literalsMike Bayer2022-01-112-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added additional rule to the system that determines ``TypeEngine`` implementations from Python literals to apply a second level of adjustment to the type, so that a Python datetime with or without tzinfo can set the ``timezone=True`` parameter on the returned :class:`.DateTime` object, as well as :class:`.Time`. This helps with some round-trip scenarios on type-sensitive PostgreSQL dialects such as asyncpg, psycopg3 (2.0 only). Improved support for asyncpg handling of TIME WITH TIMEZONE, which was not fully implemented. Fixes: #7537 Change-Id: Icdb07db85af5f7f39f1c1ef855fe27609770094b (cherry picked from commit 3b2e28bcb5ba32446a92b62b6862b7c11dabb592)
* | happy new year 2022Mike Bayer2022-01-0617-17/+17
|/ | | | Change-Id: Ic38dbc640aa0fe8a784a5b5e57c45a41eb0ea01b
* Reflect included columns as dialect_optionsGord Thompson2021-12-271-0/+14
| | | | | | | | | | | | Fixed reflection of covering indexes to report ``include_columns`` as part of the ``dialect_options`` entry in the reflected index dictionary, thereby enabling round trips from reflection->create to be complete. Included columns continue to also be present under the ``include_columns`` key for backwards compatibility. Fixes: #7382 Change-Id: I4f16b65caed3a36d405481690a3a92432b5efd62 (cherry picked from commit 52e352a190af750c3c28a5390b2ad55b20d1b752)
* Warn when caching is disabled / documentMike Bayer2021-12-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds new warnings for all elements that don't indicate their caching behavior, including user-defined ClauseElement subclasses and third party dialects. it additionally adds new documentation to discuss an apparent performance degradation in 1.4 when caching is disabled as a result in the significant expense incurred by ORM lazy loaders, which in 1.3 used BakedQuery so were actually cached. As a result of adding the warnings, a fair degree of lesser used SQL expression objects identified that they did not define caching behavior so would have been producing ``[no key]``, including PostgreSQL constructs ``hstore`` and ``array``. These have been amended to use inherit cache where appropriate. "on conflict" constructs in PostgreSQL, MySQL, SQLite still explicitly don't generate a cache key at this time. The change also adds a test for all constructs via assert_compile() to assert they will not generate cache warnings. Fixes: #7394 Change-Id: I85958affbb99bfad0f5efa21bc8f2a95e7e46981 (cherry picked from commit 22deafe15289d2be55682e1632016004b02b62c0)
* adapt pytest plugin to support pytest v7Federico Caselli2021-11-294-73/+91
| | | | | | | | | | | | | Implemented support for the test suite to run correctly under Pytest 7. Previously, only Pytest 6.x was supported for Python 3, however the version was not pinned on the upper bound in tox.ini. Pytest is not pinned in tox.ini to be lower than version 8 so that SQLAlchemy versions released with the current codebase will be able to be tested under tox without changes to the environment. Much thanks to the Pytest developers for their help with this issue. Change-Id: I3b12166199be2b913ee16e78b3ebbff415654396 (cherry picked from commit 7f84297c9947ff8d52b091aedb2a46035791763c)
* qualify asyncpg API tests for python 3.8Mike Bayer2021-11-101-0/+6
| | | | | | | | | | | Getting TypeError: object MagicMock can't be used in 'await' expression for Python 3.7 and earlier. this test is not needed on all platforms it's confirming that two methods are present. Change-Id: If918add023c98c062ea0c1cd132a999647a2d35f (cherry picked from commit 2c41cd99d8a4d8bb27c975f5e2511ab2bf261110)
* change the POSTCOMPILE/ SCHEMA symbols to not conflict w mssql quotingMike Bayer2021-11-092-2/+17
| | | | | | | | | | | | | | | | | | | Adjusted the compiler's generation of "post compile" symbols including those used for "expanding IN" as well as for the "schema translate map" to not be based directly on plain bracketed strings with underscores, as this conflicts directly with SQL Server's quoting format of also using brackets, which produces false matches when the compiler replaces "post compile" and "schema translate" symbols. The issue created easy to reproduce examples both with the :meth:`.Inspector.get_schema_names` method when used in conjunction with the :paramref:`_engine.Connection.execution_options.schema_translate_map` feature, as well in the unlikely case that a symbol overlapping with the internal name "POSTCOMPILE" would be used with a feature like "expanding in". Fixes: #7300 Change-Id: I6255c850b140522a4aba95085216d0bca18ce230 (cherry picked from commit b919a0a85afd5066f9188b20ef06ee1b4af884a9)