summaryrefslogtreecommitdiff
path: root/test/dialect
Commit message (Collapse)AuthorAgeFilesLines
* flake8 refactor - test_dialectMike Bayer2019-01-058-21/+192
| | | | | | | | | | | | 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)
* partial cherry-pick of master flake8. clean cherrypick for lib and test,Mike Bayer2019-01-051-1/+1
| | | | | | | manually merged exaples. Change-Id: I9532d3b13d13f2769e6ca48eea23dd7d4041f68f (cherry picked from commit e3bdd80c6661c0e95fb67998c57540be667ce761)
* zimports for all of test/Mike Bayer2019-01-0527-717/+680
|
* step 1, straight black -l 79 runMike Bayer2019-01-0527-8324/+10652
| | | | includes adjustment to setup.py to recognize __version__ correctly
* Handle PostgreSQL enums in remote schemasMike Bayer2018-12-212-32/+120
| | | | | | | | | | | | | | | | | | | Fixed issue where a :class:`.postgresql.ENUM` or a custom domain present in a remote schema would not be recognized within column reflection if the name of the enum/domain or the name of the schema required quoting. A new parsing scheme now fully parses out quoted or non-quoted tokens including support for SQL-escaped quotes. Fixed issue where multiple :class:`.postgresql.ENUM` objects referred to by the same :class:`.MetaData` object would fail to be created if multiple objects had the same name under different schema names. The internal memoization the Postgresql dialect uses to track if it has created a particular :class:`.postgresql.ENUM` in the database during a DDL creation sequence now takes schema name into account. Fixes: #4416 Change-Id: I8cf03069e10b12f409e9b6796e24fc5850979955 (cherry picked from commit 0b0a4c8ba2465fce5fa1954a0d31b44840f1b4b8)
* Merge "Move CRUDTest, InlineDefaultTest from test_compiler" into rel_1_2mike bayer2018-12-041-0/+29
|\
| * Move CRUDTest, InlineDefaultTest from test_compilerMike Bayer2018-12-011-0/+29
| | | | | | | | | | | | | | | | | | | | | | test_compiler is mostly related to SELECT statements as well as smaller SQL elements. While it still has some DDL related tests, move out all the remaining insert/update tests into the already present test_insert.py, test_update.py Fixes: #2630 Change-Id: I4167618543fd1235d12d1717c8c629d2374b325a (cherry picked from commit 87cdda008673e01e2c32049f103e9cdebd2a5d77)
* | Fix PostgreSQL reflection of domains expressed as arraysJakub Synowiec2018-12-011-2/+19
|/ | | | | | | | | | Fixed issue where reflection of a PostgreSQL domain that is expressed as an array would fail to be recognized. Pull request courtesy Jakub Synowiec. Fixes: #4377 Change-Id: I252c79ca435b87d4d9172b1c84e0e74e789ef676 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4380 (cherry picked from commit 46f9c3c7d4d2c31f3f1627dcf777bd3215e13e3d)
* Add the write_timeout option for mysql.jun923.gu2018-11-301-0/+1
| | | | | | | | | | | As MySQLdb support read_timeout and write_timeout option, and sqlalchemy just support read_timeout option. So sqlalchemy need to add write_timeout option. Fixes: #4381 Change-Id: I2bea80bdd6f20fafc72b48fa0e5d795626d9d9b9 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4385 (cherry picked from commit 6a8454ded311010927af04db30a57d683cf67dd4)
* Add a test harness for MySQL connect argsMike Bayer2018-11-281-0/+22
| | | | | | | This is to assist with #4381. Change-Id: I5ebfc0da906a13edc4fb3f0ca7ab2d843d43bb00 (cherry picked from commit 6837e875a3367b466e2ce04ca16c7bff8fa5c575)
* Use case insensitive matching on lower_case_table_names=1,2Mike Bayer2018-11-091-16/+88
| | | | | | | | | | | | | | Fixed regression caused by :ticket:`4344` released in 1.2.13, where the fix for MySQL 8.0's case sensitivity problem with referenced column names when reflecting foreign key referents is worked around using the ``information_schema.columns`` view. The workaround was failing on OSX / ``lower_case_table_names=2`` which produces non-matching casing for the ``information_schema.columns`` vs. that of ``SHOW CREATE TABLE``, so in case-insensitive SQL modes case-insensitive matching is now used. Fixes: #4361 Change-Id: I748549bc4c27fad6394593f8ec93fc22bfd01f6c (cherry picked from commit af159c56957b26c523e7fe324edf7d17882f88be)
* - get the "now" date for this test in terms of the database to accommodateMike Bayer2018-10-121-2/+2
| | | | | | | for local timezone doesn't match that of the DB Change-Id: I0899d9294e8a2bd8f7f2c3e66cf396e2e8bd4bcc (cherry picked from commit 7405392299492c83e6fa1546d3b36f52042e3c5e)
* Perform additional retrieval of correct column namesMike Bayer2018-10-031-1/+45
| | | | | | | | | | | | | Added a workaround for a MySQL bug #88718 introduced in the 8.0 series, where the reflection of a foreign key constraint is not reporting the correct case sensitivity for the referred column, leading to errors during use of the reflected constraint such as when using the automap extension. The workaround emits an additional query to the information_schema tables in order to retrieve the correct case sensitive name. Fixes: #4344 Change-Id: I08020d6eec43cbe8a56316660380d3739a0b45f7 (cherry picked from commit 56fb68ca8620a211ca29b3d47d649dfa332d354a)
* Accept multiple expressions for aggregate_order_by order_byMike Bayer2018-09-251-0/+25
| | | | | | | | | Added support for the :class:`.aggregate_order_by` function to receive multiple ORDER BY elements, previously only a single element was accepted. Fixes: #4337 Change-Id: I411ac31697a0d65b568ad65ce5b5181717afbd65 (cherry picked from commit b7ba3f0d9395236cbf05f830d82f6494163d1dfb)
* Propagate **kw in postgresql distinct on compilationMike Bayer2018-08-221-0/+7
| | | | | | | | | | Fixed bug in PostgreSQL dialect where compiler keyword arguments such as ``literal_binds=True`` were not being propagated to a DISTINCT ON expression. Fixes: #4325 Change-Id: I9949387dceb7fabe889799f42e92423572368b29 (cherry picked from commit 469931514a1517dde82ba56f780c3007c66d5943)
* Pass desired array type from pg.array_agg to functions.array_aggMike Bayer2018-08-221-0/+37
| | | | | | | | | | | | Fixed the :func:`.postgresql.array_agg` function, which is a slightly altered version of the usual :func:`.functions.array_agg` function, to also accept an incoming "type" argument without forcing an ARRAY around it, essentially the same thing that was fixed for the generic function in 1.1 in :ticket:`4107`. Fixes: #4324 Change-Id: I399a29f59c945a217cdd22c65ff0325edea8ea65 (cherry picked from commit 52a3f5b7635583ae6feb084b1db654b9c65caec2)
* Strip quotes from format_type in addition to other charactersMike Bayer2018-08-211-0/+35
| | | | | | | | | | | Fixed bug in PostgreSQL ENUM reflection where a case-sensitive, quoted name would be reported by the query including quotes, which would not match a target column during table reflection as the quotes needed to be stripped off. Fixes: #4323 Change-Id: I668f3acccc578e58f23b70c82d31d5c1ec194913 (cherry picked from commit 32ce703a98eba8a7685e609b4a7ca86b79dd0904)
* Bind Integers to int for cx_OracleMike Bayer2018-08-011-4/+2
| | | | | | | | | | 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)
* Fix quoting schemas in _get_table_sql for the SQLite backendPhillip Cloud2018-07-181-0/+25
| | | | | | | | | | Fixed issue where the "schema" name used for a SQLite database within table reflection would not quote the schema name correctly. Pull request courtesy Phillip Cloud. Change-Id: I2770788c1f094a7743209250ec26b5ef5fb2d9e8 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/463 (cherry picked from commit 893eac06e511f3765c0c89bab76d7933d83ffccc)
* Add unique_constraint_name to MSSQL FK reflectionSean Dunn2018-06-291-0/+44
| | | | | | | | | | | | 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)
* Reflect ASC/DESC in MySQL index columnsMike Bayer2018-06-281-1/+64
| | | | | | | | | | | Fixed bug in index reflection where on MySQL 8.0 an index that includes ASC or DESC in an indexed column specfication would not be correctly reflected, as MySQL 8.0 introduces support for returning this information in a table definition string. Change-Id: I21f64984ade690aac8c87dbe3aad0c1ee8e9727f Fixes: #4293 (cherry picked from commit 9d2dc7911b7767b97814479d228072b6f566a864)
* Add do_setinputsizes event for cx_OracleMike Bayer2018-06-271-0/+15
| | | | | | | | | | | | | | Added a new event currently used only by the cx_Oracle dialect, :meth:`.DialectEvents.setiputsizes`. The event passes a dictionary of :class:`.BindParameter` objects to DBAPI-specific type objects that will be passed, after conversion to parameter names, to the cx_Oracle ``cursor.setinputsizes()`` method. This allows both visibility into the setinputsizes process as well as the ability to alter the behavior of what datatypes are passed to this method. Change-Id: I43b97c8e3c840cad6f01edb274dc9cfed19cb5fc Fixes: #4290 (cherry picked from commit c270efdfb38a266ac042be2a0d11b6ff7e5ee619)
* Merge "fix TypeReflectionTest for sqlite 3.24" into rel_1_2mike bayer2018-06-251-1/+1
|\
| * fix TypeReflectionTest for sqlite 3.24Nils Philippsen2018-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | Fixed issue in test suite where SQLite 3.24 added a new reserved word that conflicted with a usage in TypeReflectionTest. Pull request courtesy Nils Philippsen. Change-Id: I396562cecb5ca774f29e9234845bcc6a399fc5cb Pull-request: https://github.com/zzzeek/sqlalchemy/pull/452 (cherry picked from commit 40a5d0a4b006780167976b296984eb9790f3df7f)
* | Fix UnboundLocalError in mssql during isolation level grabMike Bayer2018-06-251-2/+61
|/ | | | | | | | | | | | | Fixed issue within the SQL Server dialect under Python 3 where when running against a non-standard SQL server database that does not contain either the "sys.dm_exec_sessions" or "sys.dm_pdw_nodes_exec_sessions" views, leading to a failure to fetch the isolation level, the error raise would fail due to an UnboundLocalError. Fixes: #4273 Co-authored-by: wikiped <wikiped@yandex.ru> Change-Id: I39877c1f65f9cf8602fb1dceaf03072357759564 (cherry picked from commit e2913f65c4e5720394105584c69e7b9e8c2d373c)
* Use utf8mb4 (or utf8mb3) for all things MySQLMike Bayer2018-06-252-14/+24
| | | | | | | | | | | | | | | | | | 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)
* Turn oracle BINARY_DOUBLE, BINARY_FLOAT, DOUBLE_PRECISION into floatsMike Bayer2018-05-252-21/+147
| | | | | | | | | | | | | | | | | | The Oracle BINARY_FLOAT and BINARY_DOUBLE datatypes now participate within cx_Oracle.setinputsizes(), passing along NATIVE_FLOAT, so as to support the NaN value. Additionally, :class:`.oracle.BINARY_FLOAT`, :class:`.oracle.BINARY_DOUBLE` and :class:`.oracle.DOUBLE_PRECISION` now subclass :class:`.Float`, since these are floating point datatypes, not decimal. These datatypes were already defaulting the :paramref:`.Float.asdecimal` flag to False in line with what :class:`.Float` already does. Added reflection capabilities for the :class:`.oracle.BINARY_FLOAT`, :class:`.oracle.BINARY_DOUBLE` datatypes. Change-Id: Id99b912e83052654a17d07dc92b4dcb958cb7600 Fixes: #4264 (cherry picked from commit 28c7450b61beeb0bfb3d082cfcd12493c182e0ee)
* call setinputsizes() for integer typesMike Bayer2018-05-181-1/+82
| | | | | | | | | | | | | | | | Altered the Oracle dialect such that when an :class:`.Integer` type is in use, the cx_Oracle.NUMERIC type is set up for setinputsizes(). In SQLAlchemy 1.1 and earlier, cx_Oracle.NUMERIC was passed for all numeric types unconditionally, and in 1.2 this was removed to allow for better numeric precision. However, for integers, some database/client setups will fail to coerce boolean values True/False into integers which introduces regressive behavior when using SQLAlchemy 1.2. Overall, the setinputsizes logic seems like it will need a lot more flexibility going forward so this is a start for that. Change-Id: Ida80cc2c2c37ffc0e05da4b5df2dadfab55a01f2 Fixes: #4259 (cherry picked from commit c7ae04d1c5c4aa6c6099584ae386d6ab9ef7b290)
* Reflect Oracle NUMBER(NULL, 0) as INTEGERKent Bower2018-04-121-2/+46
| | | | | | | | | | The Oracle NUMBER datatype is reflected as INTEGER if the precision is NULL and the scale is zero, as this is how INTEGER values come back when reflected from Oracle's tables. Pull request courtesy Kent Bower. Change-Id: I4627febd46cab7085299c0a5700ee0f0bdca513c Pull-request: https://github.com/zzzeek/sqlalchemy/pull/437 (cherry picked from commit a3473c08d35e2cce32b014519df5f774c0166cf1)
* Use base __ne__ implementation for range types w/ NoneMike Bayer2018-04-031-67/+138
| | | | | | | | | | | | | Fixed bug where the special "not equals" operator for the Postgresql "range" datatypes such as DATERANGE would fail to render "IS NOT NULL" when compared to the Python ``None`` value. Also break up range tests into backend round trip and straight compilation suites. Change-Id: Ibaee132b1ea7dac8b799495a27f98f82a7d9c028 Fixes: #4229 (cherry picked from commit e1ac5dc63cc13cfbabe0ec7fbb3521bfb1b7b750)
* Add postgresl.REGCLASS type for casting table names to OIDs and vice versaSebastian Bank2018-04-031-0/+40
| | | | | | | Fixes: #4160 Change-Id: Id0bdbad1be3a0950dc8f35895ee13d9264244722 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/435 (cherry picked from commit 9f986ce10c6755af3f347a56f9ea03e0e2c5943e)
* Merge "Add support for declarative partitioning in PostgreSQL 10" into rel_1_2mike bayer2018-03-301-0/+20
|\
| * Add support for declarative partitioning in PostgreSQL 10Vsevolod Solovyov2018-03-301-0/+20
| | | | | | | | | | | | | | | | | | | | Added support for "PARTITION BY" in Postgresql table definitions, using "postgresql_partition_by". Pull request courtesy Vsevolod Solovyov. Change-Id: Id74d6882d7193fae1e5fd44b6e12d6852866fcc4 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/430 (cherry picked from commit 0174d698a8ed155b51cc44c503b10bc67b16dfc9)
* | Filter non-integer characters from pyodbc SQL Server versionMike Bayer2018-03-301-0/+31
|/ | | | | | | | | | | Adjusted the SQL Server version detection for pyodbc to only allow for numeric tokens, filtering out non-integers, since the dialect does tuple- numeric comparisons with this value. This is normally true for all known SQL Server / pyodbc drivers in any case. Change-Id: I4ab18a07e19231091b5e877ba1fccd5eda72a992 Fixes: #4227 (cherry picked from commit f55c4f6bd2cb2f2b18e62159361ce7ecb5897396)
* Raise cx_Oracle minimum version to 5.2Mike Bayer2018-03-071-1/+18
| | | | | | | | | | The minimum cx_Oracle version supported is 5.2 (June 2015). Previously, the dialect asserted against version 5.0 but as of 1.2.2 we are using some symbols that did not appear until 5.2. Change-Id: I6fa4238f1722789924f4a6473fdce6f524333825 Fixes: #4211 (cherry picked from commit 4982a250a9b22795b47caf5fc42225689c1da919)
* Add values_callable feature to EnumJon Snyder2018-02-071-6/+47
| | | | | | | | | | | | Added support for :class:`.Enum` to persist the values of the enumeration, rather than the keys, when using a Python pep-435 style enumerated object. The user supplies a callable function that will return the string values to be persisted. This allows enumerations against non-string values to be value-persistable as well. Pull request courtesy Jon Snyder. Pull-request: https://github.com/zzzeek/sqlalchemy/pull/410 Fixes: #3906 Change-Id: Id385465d215d1e5baaad68368b168afdd846b82c
* Convert dialect modules to relative imports and testMike Bayer2018-02-051-0/+18
| | | | | | | | For some reason the dialects were not consistently converted to relative imports. Also added a test to ensure that __all__ is functioning within each dialect. Change-Id: I8450ed724473be7e17678e9aba7ba0f661fdf134
* Adjust tests for pyodbc 4.0.22Mike Bayer2018-01-241-11/+38
| | | | | | | | | | | | pyodbc 4.0.22 is no longer allowing a datetime to be truncated into a date, and additionally is asserting that numeric truncation is not occurring; previously, it looks like we could send a decimal of -1E-25 through the driver but we were only getting back -1E-20, the test failed to check this. Not clear if the larger precision worked fully at some point, but in any case, it doesn't work now so just remove those values from the test. Change-Id: I66c7863b1708eb72f48173083b4ef78c93893b52
* Merge "Make column-level collation quoting dialect-specific"mike bayer2018-01-121-0/+14
|\
| * Make column-level collation quoting dialect-specificMike Bayer2018-01-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Turn on testing for JSON under Mariadb 10.2.7 and greaterMike Bayer2018-01-121-0/+1
|/ | | | | | | | | | | 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
* Merge "Add TRUNCATE to postgres autocommit regexp"mike bayer2017-12-181-0/+3
|\
| * Add TRUNCATE to postgres autocommit regexpJacob Hayes2017-12-181-0/+3
| | | | | | | | | | | | | | Extends AUTOCOMMIT_REGEXP for the postgres dialect to include `TRUNCATE`. Change-Id: I315e03674b89bb89aae669b8655481e4d890491e Pull-request: https://github.com/zzzeek/sqlalchemy/pull/407
* | Open up all cx_Oracle numeric tests, finish infinity supportMike Bayer2017-12-171-7/+46
|/ | | | | | | | | | | | 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-054-0/+67
| | | | | | | | | | | | | | | | | | | | | 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
* Fix regexp for expanding INMike Bayer2017-12-011-0/+10
| | | | | | | | | Fixed bug in new "expanding bind parameter" feature whereby if multiple params were used in one statement, the regular expression would not match the parameter name correctly. Change-Id: Ifaf7d627aac4ead2a13c8dddccb5c515253d88e6 Fixes: #4140
* Add postgresql.MONEYCleber J Santos2017-11-161-0/+1
| | | | | Change-Id: I2b40faf583a84bc5b416e1ad3aa812896ea67a8c Pull-request: https://github.com/zzzeek/sqlalchemy/pull/395
* Propagate kwargs for mysql concat, matchMike Bayer2017-11-131-1/+17
| | | | | | | | | | | Fixed bug where the MySQL "concat" and "match" operators failed to propagate kwargs to the left and right expressions, causing compiler options such as "literal_binds" to fail. Also adds non-interpreted **kw for visit_create_index, visit_typeclause Change-Id: Iaf54ac18949cc6a54f50678125f010b4f12c5673 Fixes: #4136
* Merge "Test for EXCLUDE constraint duplicated index"mike bayer2017-10-251-1/+33
|\
| * Test for EXCLUDE constraint duplicated indexMike Bayer2017-10-251-1/+33
| | | | | | | | | | | | | | | | | | An EXCLUDE constraint makes an index just like a UNIQUE does; get_indexes() will receive this. Test that this works out the same way as it does for a UNIQUE. Change-Id: I02ac7cbbb1ca0d1fcdcdbe9a8b8bd1ffee3e496c Fixes: #4122