summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
Commit message (Collapse)AuthorAgeFilesLines
* flake8 refactor - test_dialectMike Bayer2019-01-051-1/+0
| | | | | | | | | | | | A full rewrite of all imports and pep8 formatting using zimports, black, commits are broken into sections. Directories included in this commit: test/dialect/ Change-Id: Iec0231a43eb00122fcaaec942f1528ac4a33e59d (cherry picked from commit e88e29bb8e1aced6898d2aa7105c6e9eae528291)
* - flake8 for lib passesMike Bayer2019-01-053-3/+1
| | | | Change-Id: I0d7f5105f838a0275f3c240441bdcdc9ae7444d0
* - imports in lib pass flake8Mike Bayer2019-01-051-4/+0
| | | | Change-Id: Ia661822e9d1792da8f965fe3cbb00cce288c8739
* flake8 refactor - utilMike Bayer2019-01-0522-136/+217
| | | | | | | | | | | | A full rewrite of all imports and pep8 formatting using zimports, black, commits are broken into sections. Directories included in this commit: lib/sqlalchemy/testing/ lib/sqlalchemy/util/ Change-Id: Ia686b88e8b334874716de0be5e383c7b2abe5643 (cherry picked from commit 40ba6aca86362f54a27ae3380cb453ec6fd4448f)
* partial cherry-pick of master flake8. clean cherrypick for lib and test,Mike Bayer2019-01-053-8/+15
| | | | | | | manually merged exaples. Change-Id: I9532d3b13d13f2769e6ca48eea23dd7d4041f68f (cherry picked from commit e3bdd80c6661c0e95fb67998c57540be667ce761)
* - do a broken zimports run on libMike Bayer2019-01-0528-212/+218
|
* step 1, straight black -l 79 runMike Bayer2019-01-0533-2033/+2320
| | | | includes adjustment to setup.py to recognize __version__ correctly
* rework the exclusions spec expressionMike Bayer2018-12-311-12/+18
| | | | | | | | The expression was expecting spaces which means we were skipping Postgresql window function tests and possibly other things. Change-Id: I57c4aed558f4011f2f7b882a2d9b1fee210f9eaf (cherry picked from commit 1eaf9dc7776b9833a9fb62fe630b4b9ac63a31f4)
* commit 1b774808c926665047bf353222ecd191679a95d1Lele Gaifax2018-12-301-1/+1
| | | | | | | | | | | | | | | | Author: Lele Gaifax <lele@metapensiero.it> Date: Tue Dec 25 12:35:41 2018 +0100 Consistently use "PostgreSQL", fixing also a few doc glitches commit 0e382aaee4427193926f0dc10ad29056bc12c85e Author: Lele Gaifax <lele@metapensiero.it> Date: Tue Dec 25 12:08:49 2018 +0100 Remove duplicated words Change-Id: Iaa586b9412f46a50fe6ff3bbb92e07d6cb1905c8 (cherry picked from commit c0f9708fde39175c8695fdd87873464f516fdf98)
* Don't call rollback on DBAPI connection that's "closed"Mike Bayer2018-10-141-0/+6
| | | | | | | | | | | Use the existence of ConnectionRecord.connection to estimate that this connection is likely closed, and if so, don't try to call "rollback" on it. This rollback is normally harmless but is causing segfaults in mysqlclient due to https://github.com/PyMySQL/mysqlclient-python/issues/270. Change-Id: I1d7c5f5a520527d8268b6334795c2051f7ceeea6 (cherry picked from commit a8781b51b4039eee56791b9dbfdee183f7a5b797)
* MariaDB 10.3 updatesMike Bayer2018-08-301-2/+2
| | | | | | | | | | MariaDB seems to handle some additional UPDATE/DELETE FROM syntaxes as well as some forms of INTERSECT and EXCEPT. Open up tests that expect failure for MySQL to allow success for MariaDB 10.3. Change-Id: Ia9341a82485ef7201bb8130d8dbf4a9b6976035a (cherry picked from commit 081d4275cf5c3e6842c8e0198542ff89617eaa96)
* Bind Integers to int for cx_OracleMike Bayer2018-08-011-1/+35
| | | | | | | | | | For cx_Oracle, Integer datatypes will now be bound to "int", per advice from the cx_Oracle developers. Previously, using cx_Oracle.NUMBER caused a loss in precision within the cx_Oracle 6.x series. Change-Id: I4c6b2cca490aff5b98b7ceff3414715202881c89 Fixes: #4309 (cherry picked from commit 75d48e65eaac9e97283bb14fdec54a143d9997f1)
* Add unique_constraint_name to MSSQL FK reflectionSean Dunn2018-06-291-0/+1
| | | | | | | | | | | | Fixed bug in MSSQL reflection where when two same-named tables in different schemas had same-named primary key constraints, foreign key constraints referring to one of the tables would have their columns doubled, causing errors. Pull request courtesy Sean Dunn. Fixes: #4228 Change-Id: I7dabaaee0944e1030048826ba39fc574b0d63031 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/457 (cherry picked from commit ca94ea8ab583f8ab366ee5971bfc1bdd96e54cc9)
* Use utf8mb4 (or utf8mb3) for all things MySQLMike Bayer2018-06-253-4/+15
| | | | | | | | | | | | | | | | | | Fixed bug in MySQLdb dialect and variants such as PyMySQL where an additional "unicode returns" check upon connection makes explicit use of the "utf8" character set, which in MySQL 8.0 emits a warning that utf8mb4 should be used. This is now replaced with a utf8mb4 equivalent. Documentation is also updated for the MySQL dialect to specify utf8mb4 in all examples. Additional changes have been made to the test suite to use utf8mb3 charsets and databases (there seem to be collation issues in some edge cases with utf8mb4), and to support configuration default changes made in MySQL 8.0 such as explicit_defaults_for_timestamp as well as new errors raised for invalid MyISAM indexes. Change-Id: Ib596ea7de4f69f976872a33bffa4c902d17dea25 Fixes: #4283 Fixes: #4192 (cherry picked from commit c99345ee9994c3ea2a5e6536cc3365f18d017cc1)
* render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQLMike Bayer2018-06-184-1/+206
| | | | | | | | | | | | | | | | | Fixed INSERT FROM SELECT with CTEs for the Oracle and MySQL dialects, where the CTE was being placed above the entire statement as is typical with other databases, however Oracle and MariaDB 10.2 wants the CTE underneath the "INSERT" segment. Note that the Oracle and MySQL dialects don't yet work when a CTE is applied to a subquery inside of an UPDATE or DELETE statement, as the CTE is still applied to the top rather than inside the subquery. Also adds test suite support CTEs against backends. Change-Id: I8ac337104d5c546dd4f0cd305632ffb56ac8bf90 Fixes: #4275 Fixes: #4230 (cherry picked from commit 3619edcb8aa3ceef2a44925b85315fc0e90c5982)
* Add Query.lazy_load_from attribute for shardingMike Bayer2018-06-041-0/+15
| | | | | | | | | | | | | | | | | | | Added new attribute :attr:`.Query.lazy_loaded_from` which is populated with an :class:`.InstanceState` that is using this :class:`.Query` in order to lazy load a relationship. The rationale for this is that it serves as a hint for the horizontal sharding feature to use, such that the identity token of the state can be used as the default identity token to use for the query within id_chooser(). Also repaired an issue in the :meth:`.Result.with_post_criteria` method added in I899808734458e25a023142c2c5bb37cbed869479 for :ticket:`4128` where the "unbake subquery loaders" version was calling the post crtieria functions given the :class:`.Result` as the argument rather than applying them to the :class:`.Query`. Change-Id: I3c0919ce7fd151b80fe2f9b5f99f60df31c2d73d Fixes: #4243 (cherry picked from commit a574b409296ef793cec8e1d00f1f7be48f15325e)
* Default server_version_info to (0, )Mike Bayer2018-05-112-2/+4
| | | | | | | | | | Fixed a bug in the test suite where if an external dialect returned ``None`` for ``server_version_info``, the exclusion logic would raise an ``AttributeError``. Change-Id: I9124d3ac5484941081127274e6eb71f392fb94f7 Fixes: #4249 (cherry picked from commit 29ce87273e3f66797d87edc9673fd3868e28249a)
* SQL Server is not native boolean; add new flag for CHECK constraintMike Bayer2018-05-101-0/+42
| | | | | | | | | | | | | | | Fixed a 1.2 regression caused by :ticket:`4061` where the SQL Server "BIT" type would be considered to be "native boolean". The goal here was to avoid creating a CHECK constraint on the column, however the bigger issue is that the BIT value does not behave like a true/false constant and cannot be interpreted as a standalone expression, e.g. "WHERE <column>". The SQL Server dialect now goes back to being non-native boolean, but with an extra flag that still avoids creating the CHECK constraint. Change-Id: I4765d2a2a00b0d14f50282603cc4d48d4739dac1 Fixes: #4250 (cherry picked from commit bd1d6012dcbe5fbc6d1097a79d85b972b0d4fd8a)
* Fix - Order of records is not guaranteedPat Buxton2018-04-161-3/+3
| | | | | | | | | | * Causes intermittent failure against Greenplum cluster * Tested using Greenplum dialact: https://github.com/PlaidCloud/sqlalchemy-greenplum Change-Id: I6387e98f17a3667612fdaaadb27a08f79ec46398 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/440 (cherry picked from commit 5d5b9fe63d6d416bf21969bd1c27c1e1a754a2d3)
* Correct join for FKs with schema in SQL ServerMike Bayer2018-04-111-1/+74
| | | | | | | | | | | | | | Fixed 1.2 regression caused by :ticket:`4060` where the query used to reflect SQL Server cross-schema foreign keys was limiting the criteria incorrectly. Additionally, added some rework of the inter-schema reflection tests so that MySQL, MSSQL can be included, breaking out some of the Postgresql-specific behaviors into separate requirements. Fixes: #4234 Change-Id: I20c8e70707075f1767b79127c2c27d4b313c6515 (cherry picked from commit 9d5e117f6fcc38d8773bc943c615888dc8a3a819)
* Ensure all visit_sequence accepts **kw argsMike Bayer2018-04-041-1/+23
| | | | | | | | | | | Fixed issue where the compilation of an INSERT statement with the "literal_binds" option that also uses an explicit sequence and "inline" generation, as on Postgresql and Oracle, would fail to accommodate the extra keyword argument within the sequence processing routine. Change-Id: Ibdab7d340aea7429a210c9535ccf1a3e85f074fb Fixes: #4231 (cherry picked from commit b4eb29253cb29a069973503f36d1103d4a18311c)
* Remove erroneous skip messageMike Bayer2018-02-161-18/+14
| | | | | | | | | The logic here seems to try to say something different when __backend__ is True but it produces a nonsensical message, since __only_on__ doesn't tell us about the implementation we are actually running. Change-Id: I14e20cadcba975f8efe8fdefa439c8b8c480b3ed
* Support foreign key option reflection for OracleMiroslav Shubernetskiy2018-02-052-5/+16
| | | | | | | | | The ON DELETE options for foreign keys are now part of Oracle reflection. Oracle does not support ON UPDATE cascades. Pull request courtesy Miroslav Shubernetskiy. Change-Id: I135cd6cd3436354a86b2c1e1437c3785c38eed26 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/418
* Normalize check constraints even more radicallyFlorian Apolloner2018-01-171-4/+7
| | | | | | | | | | | | | This is the only way I could get this test pass on informix, basically I strip every whitespace. The sql text as recorded in informix is: ``` ((a > 1 ) AND (a < 5 ) ) ((a = 1 ) OR ((a > 2 ) AND (a <5 ) ) ) ``` Yes, this is absolutely bonkers, but that is what I get :( Change-Id: I936e860f2b75b521e5560c05c452dbe72f0d3812 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/413
* Merge "Make column-level collation quoting dialect-specific"mike bayer2018-01-122-0/+54
|\
| * Make column-level collation quoting dialect-specificMike Bayer2018-01-122-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression in 1.2 where newly repaired quoting of collation names in :ticket:`3785` breaks SQL Server, which explicitly does not understand a quoted collation name. Whether or not mixed-case collation names are quoted or not is now deferred down to a dialect-level decision so that each dialect can prepare these identifiers directly. Change-Id: Iaf0a8123d9bf4711219e320896bb28c5d2649304 Fixes: #4154
* | happy new yearMike Bayer2018-01-1218-18/+18
| | | | | | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* | Merge "Turn on testing for JSON under Mariadb 10.2.7 and greater"mike bayer2018-01-121-11/+14
|\ \
| * | Turn on testing for JSON under Mariadb 10.2.7 and greaterMike Bayer2018-01-121-11/+14
| |/ | | | | | | | | | | | | | | | | | | | | MariaDB adds a JSON alias for the LONGTEXT datatype and all the same json functions work against it in any case. What doesn't work is reflection, since it's just an alias, and also the CAST we were using in one of our tests doesn't seem to work for JSON which is probably also because it's not a real datatype. Change-Id: I44e5503db29ca2f04de8e521527978f34675a5e0
* | Re-enable setinputsizes for Oracle TIMESTAMPMike Bayer2018-01-082-2/+16
|/ | | | | | | | | Fixed regression where the removal of most setinputsizes rules from cx_Oracle dialect impacted the TIMESTAMP datatype's ability to retrieve fractional seconds. Fixes: #4157 Change-Id: Ic53109fd199aea8b9c4da14355e125849b8b198f
* Merge "Add rule to prevent "GROUP BY <expr>" in tests"mike bayer2018-01-042-0/+12
|\
| * Add rule to prevent "GROUP BY <expr>" in testsMike Bayer2018-01-042-0/+12
| | | | | | | | | | | | | | | | Added a new exclusion rule group_by_complex_expression which disables tests that use "GROUP BY <expr>", which seems to be not viable for at least two third party dialects. Change-Id: I47284513382ae93f5a3d12c734b3a44643147c99
* | Remove cx_oracle test rule from requirementsMike Bayer2018-01-041-1/+0
|/ | | | | | | | Removed an oracle-specific requirements rule from the public test suite that was interfering with third party dialect suites. Change-Id: Iebae510edcb8ef908dcd9be9222888e12caed97d
* Open up all cx_Oracle numeric tests, finish infinity supportMike Bayer2017-12-171-16/+0
| | | | | | | | | | | | Added some additional rules to fully handle ``Decimal('Infinity')``, ``Decimal('-Infinity')`` values with cx_Oracle numerics when using ``asdecimal=True``. Allow remaining cx_Oracle numeric tests that were waiting for the refactor to be finished and forgot to get enabled. Change-Id: I1e2365176e34559c0230c84f800a7cfe0a034ed5 Fixes: #4064
* Allow delete where clause to refer multiple tables.inytar2017-12-051-0/+5
| | | | | | | | | | | | | | | | | | | | | Implemented "DELETE..FROM" syntax for Postgresql, MySQL, MS SQL Server (as well as within the unsupported Sybase dialect) in a manner similar to how "UPDATE..FROM" works. A DELETE statement that refers to more than one table will switch into "multi-table" mode and render the appropriate "USING" or multi-table "FROM" clause as understood by the database. Pull request courtesy Pieter Mulder. For SQL syntaxes see: Postgresql: https://www.postgresql.org/docs/current/static/sql-delete.html MySQL: https://dev.mysql.com/doc/refman/5.7/en/delete.html#multiple-table_syntax MSSQL: https://docs.microsoft.com/en-us/sql/t-sql/statements/delete-transact-sql Sybase: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00801.1510/html/iqrefso/X315721.htm Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I6dfd57b49e44a095d076dc493cd2360bb5d920d3 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/392 Fixes: #959
* Rework autoescape to be a simple boolean; escape the escape characterMike Bayer2017-10-241-0/+105
| | | | | | | | | | | | Reworked the new "autoescape" feature introduced in :ref:`change_2694` in 1.2.0b2 to be fully automatic; the escape character now defaults to a forwards slash ``"/"`` and is applied to percent, underscore, as well as the escape character itself, for fully automatic escaping. The character can also be changed using the "escape" parameter. Change-Id: I74894a2576983c0f6eb89480c9e5727f49fa9c25 Fixes: #2694
* Merge "Don't commit failed transaction"mike bayer2017-10-201-1/+5
|\
| * Don't commit failed transactionMike Bayer2017-10-181-1/+5
| | | | | | | | | | | | | | | | | | | | The test here commits even though integrityerror was raised due to the fixture. Postgresql seems to allow this even though it's usually strict about this. remove the requirement that a database needs to be able to commit after an integrity error was raised. Change-Id: I437faadb04ff7a9c3f624c68646b4f4f504b504a
* | add order_by clause to make tests stableJan2017-10-171-2/+2
|/ | | | | | | I observed test runs that failed on 'test_bound_in_scalar' due to arbitrary ordering of the result set. The assertion not only tests for the elements to be present, but also for the correct ordering. Hence, the proposal to add an order_by clause to the select statements. Change-Id: If1fbb864761e77dfd2a42ef857801c8aaf893bee Pull-request: https://github.com/zzzeek/sqlalchemy/pull/389
* Take schema name into account when querying sqlite_masterMike Bayer2017-09-282-0/+50
| | | | | | | | | | | Fixed bug where SQLite CHECK constraint reflection would fail if the referenced table were in a remote schema, e.g. on SQLite a remote database referred to by ATTACH. Also add suite support for general CHECK constraint reflection. Change-Id: I073a72cb47dc4f8c5683000d708768523759332f Fixes: #4099
* Fix noseplugin to accept `zeroarg_callback` for `--dbs` optionIryna Shcherbina2017-09-261-1/+1
| | | ./sqla_nose.py --dbs works fine with zero arguments, so `zeroarg_callback` should be treated as `callback`.
* Refactor for cx_Oracle version 6oracle_numericMike Bayer2017-09-113-4/+2
| | | | | | | | | Drops support for cx_Oracle prior to version 5.x, reworks numeric and binary support. Fixes: #4064 Change-Id: Ib9ae9aba430c15cd2a6eeb4e5e3fd8e97b5fe480
* - skip oracle tests until we can merge refactorMike Bayer2017-09-081-0/+18
| | | | Change-Id: Ie9bec6e8f51d52349dcbd8009981818e459e88b8
* Add SQL Server CI coverageMike Bayer2017-08-313-38/+142
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* Add new sane_rowcount_w_returning flagMike Bayer2017-08-311-0/+23
| | | | | | | | | | | | | | | | | Added a new class of "rowcount support" for dialects that is specific to when "RETURNING", which on SQL Server looks like "OUTPUT inserted", is in use, as the PyODBC backend isn't able to give us rowcount on an UPDATE or DELETE statement when OUTPUT is in effect. This primarily affects the ORM when a flush is updating a row that contains server-calcluated values, raising an error if the backend does not return the expected row count. PyODBC now states that it supports rowcount except if OUTPUT.inserted is present, which is taken into account by the ORM during a flush as to whether it will look for a rowcount. ORM tests are implicit in existing tests run against PyODBC Fixes: #4062 Change-Id: Iff17cbe4c7a5742971ed85a4d58660c18cc569c2
* Generalize autocommit testingMike Bayer2017-08-292-0/+48
| | | | | | | To support adding AUTOCOMMIT to more dialects, add a suite test Change-Id: I585dcce19fcdce70e8cf21aea4edaa97d7bf2bb9
* Apply percent sign escaping to literal binds, commentsMike Bayer2017-08-252-4/+13
| | | | | | | | | | | | | | Fixed bug in new percent-sign support (e.g. :ticket:`3740`) where a bound parameter rendered with literal_binds would fail to escape percent-signs for relevant dialects. In addition, ensured new table / column comment support feature also fully makes use of literal-rendered parameters so that this percent sign support takes place with table / column comment DDL as well, allowing percent sign support for the mysql / psycopg2 backends that require escaping of percent signs. Change-Id: Ia4136a300933e9bc6a01a7b9afd5c7b9a3fee4e3 Fixes: #4054 Fixes: #4052
* Deactivate transaction if rollback failsMike Bayer2017-08-221-2/+2
| | | | | | | | | | | | Fixed regression introduced in 1.2.0b1 due to :ticket:`3934` where the :class:`.Session` would fail to "deactivate" the transaction, if a rollback failed (the target issue is when MySQL loses track of a SAVEPOINT). This would cause a subsequent call to :meth:`.Session.rollback` to raise an error a second time, rather than completing and bringing the :class:`.Session` back to ACTIVE. Fixes: #4050 Change-Id: Id245e8dd3487cb006b2d6631c8bd513b5ce81abe
* - allow a separate template database to be used forMike Bayer2017-08-222-5/+11
| | | | | | | PG CREATE DATABASE. as nobody will connect to it that would solve the contention issue here Change-Id: I00a4d52091876e120faff4a8a5493c53280d96f1
* - repair --dbsMike Bayer2017-08-222-1/+21
| | | | | Change-Id: I69e39d2368f50b126c369ecc35e01799fd013254 (cherry picked from commit 3fc6f32ddc5fbbf439acff42c2fdae9e910154be)