summaryrefslogtreecommitdiff
path: root/test/dialect
Commit message (Collapse)AuthorAgeFilesLines
* Make a common approach for "emulated" typesMike Bayer2017-09-252-0/+10
| | | | | | | | | | | | | | Internal refinements to the :class:`.Enum`, :class:`.Interval`, and :class:`.Boolean` types, which now extend a common mixin :class:`.Emulated` that indicates a type that provides Python-side emulation of a DB native type, switching out to the DB native type when a supporting backend is in use. The Postgresql :class:`.INTERVAL` type when used directly will now include the correct type coercion rules for SQL expressions that also take effect for :class:`.sqltypes.Interval` (such as adding a date to an interval yields a datetime). Change-Id: Ifb9f9d7cbd9f5990dcb2abb583193e9e92b789ad Fixes: #4088
* Merge "Ensure (+) is rendered for all right-hand members"mike bayer2017-09-131-0/+49
|\
| * Ensure (+) is rendered for all right-hand membersticket_4076Mike Bayer2017-09-131-0/+49
| | | | | | | | | | | | | | | | | | | | Fixed bug where Oracle 8 "non ansi" join mode would not add the ``(+)`` operator to expressions that used an operator other than the ``=`` operator. The ``(+)`` needs to be on all columns that are part of the right-hand side. Change-Id: I952e2369f11b78f5b918456ae3a5b0768d9761ec Fixes: #4076
* | use the stack to get the insert statement in on conflictticket_4074Mike Bayer2017-09-121-0/+24
|/ | | | | | | | | Fixed bug in Postgresql :meth:`.postgresql.dml.Insert.on_conflict_do_update` which would prevent the insert statement from being used as a CTE, e.g. via :meth:`.Insert.cte`, within another statement. Change-Id: Ie20972a05e194290bc9d92819750845872949ecc Fixes: #4074
* Refactor for cx_Oracle version 6oracle_numericMike Bayer2017-09-116-2316/+2431
| | | | | | | | | Drops support for cx_Oracle prior to version 5.x, reworks numeric and binary support. Fixes: #4064 Change-Id: Ib9ae9aba430c15cd2a6eeb4e5e3fd8e97b5fe480
* Rename MySQL dml.insert().values to .insertedMike Bayer2017-09-082-13/+14
| | | | | | | | | | | Changed the name of the ``.values`` attribute of the new MySQL INSERT..ON DUPLICATE KEY UPDATE construct to ``.inserted``, as :class:`.Insert` already has a method called :meth:`.Insert.values`. The ``.inserted`` attribute ultimately renders the MySQL ``VALUES()`` function. Change-Id: I8da8e30a3077698385a4b77e2c2032e2d1ff10b2 Fixes: #4072
* Add SQL Server CI coverageMike Bayer2017-08-313-31/+37
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* Apply percent sign escaping to literal binds, commentsMike Bayer2017-08-251-2/+4
| | | | | | | | | | | | | | 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
* - this test doesn't work in strict mode, not that importantMike Bayer2017-08-201-0/+1
| | | | Change-Id: I3ed361af5c9f0c7acbeb8b534966828949f4958b
* Enable uuid for pg8000Mike Bayer2017-08-081-4/+2
| | | | | | | | | Enabled UUID support for the pg8000 driver, which supports native Python uuid round trips for this datatype. Arrays of UUID are still not supported, however. Change-Id: I44ca323c5d9f2cd87327210233bc36a3556eb050 Fixes: #4016
* Add quoted_name to pg8000 py_typesMike Bayer2017-08-081-1/+16
| | | | | | | | | | | Fixed bug where the pg8000 driver would fail if using :meth:`.MetaData.reflect` with a schema name, since the schema name would be sent as a "quoted_name" object that's a string subclass, which pg8000 doesn't recognize. The quoted_name type is added to pg8000's py_types collection on connect. Change-Id: Id0f838320cb66563685e094e4eae2d5116100d27 Fixes: #4041
* Implement MySQL's ON DUPLICATE KEY UPDATEMichael Doronin2017-07-032-3/+104
| | | | | | | | | | | Added support for MySQL's ON DUPLICATE KEY UPDATE MySQL-specific :class:`.mysql.dml.Insert` object. Pull request courtesy Michael Doronin. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Resolves: #4009 Change-Id: Ic71424f3c88af6082b48a910a2efb7fbfc0a7eb4 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/365
* Handle SHOW VARIABLES returning no rowMike Bayer2017-06-161-1/+19
| | | | | | | | | | | MySQL 5.7 has introduced permission limiting for the "SHOW VARIABLES" command; the MySQL dialect will now handle when SHOW returns no row, in particular for the initial fetch of SQL_MODE, and will emit a warning that user permissions should be modified to allow the row to be present. Change-Id: I98e7a69230da397b17eae07b7e9d024fa7aeeb26 Fixes: #4007
* Render ARRAY index embedded between type and COLLATEMike Bayer2017-06-081-0/+23
| | | | | | | | | | | | | | | | Fixed bug where using :class:`.ARRAY` with a string type that features a collation would fail to produce the correct syntax within CREATE TABLE. The "COLLATE" must appear to the right of the array dimensions, so we are using regexp substitution to insert the brackets in the appropriate place. A more heavyweight solution would be that datatypes know how to split up their base type vs. modifiers, but as this is so specific to Postgresql ARRAY it's better to handle these cases more locally. Change-Id: I394c3c673eb60689e51b5301e51651972cfdb4c0 Fixes: #4006
* Parse for Postgresql version w/ "beta"Mike Bayer2017-06-071-1/+6
| | | | | | | | | | | | | Continuing with the fix that correctly handles Postgresql version string "10devel" released in 1.1.8, an additional regexp bump to handle version strings of the form "10beta1". While Postgresql now offers better ways to get this information, we are sticking w/ the regexp at least through 1.1.x for the least amount of risk to compatibility w/ older or alternate Postgresql databases. Change-Id: I12ddb06465f7dcf80563c27632441ef5963f60d4 Fixes: #4005
* Implement get_unique_constraints, get_check_constraints for OracleEloy Felix2017-05-301-0/+8
| | | | | | | | Pull-request: https://github.com/zzzeek/sqlalchemy/pull/326 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/342 Fixes: #4002 Change-Id: I221fe8ba305fc455a03e3a5d15f803bf8ee2e8fb
* Add placeholder XML supportMike Bayer2017-05-261-3/+31
| | | | | | | | | | | Added a placeholder type :class:`.mssql.XML` to the SQL Server dialect, so that a reflected table which includes this type can be re-rendered as a CREATE TABLE. The type has no special round-trip behavior nor does it currently support additional qualifying arguments. Change-Id: I651fa729bd8e9b31a0b5effe0839aff077d77c46 Fixes: #3973
* Remove twophase for cx_Oracle 6.xMike Bayer2017-05-231-0/+25
| | | | | | | | | | | Support for two-phase transactions has been removed entirely for cx_Oracle when version 6.0b1 or later of the DBAPI is in use. The two- phase feature historically has never been usable under cx_Oracle 5.x in any case, and cx_Oracle 6.x has removed the connection-level "twophase" flag upon which this feature relied. Change-Id: I2e8161cc2bc12f4845c9224cd483038112fe9734 Fixes: #3997
* Allow metadata.reflect() to recover from unreflectable tablesMike Bayer2017-05-221-0/+31
| | | | | | | | | | | | | Added support for views that are unreflectable due to stale table definitions, when calling :meth:`.MetaData.reflect`; a warning is emitted for the table that cannot respond to ``DESCRIBE`` but the operation succeeds. The MySQL dialect now raises UnreflectableTableError which is in turn caught by MetaData.reflect(). Reflecting the view standalone raises this error directly. Change-Id: Id8005219d8e073c154cc84a873df911b4a6cf4d6 Fixes: #3871
* Merge "Use regexp to parse cx_oracle version string"mike bayer2017-05-091-0/+21
|\
| * Use regexp to parse cx_oracle version stringMike Bayer2017-05-091-0/+21
| | | | | | | | | | | | | | | | | | Fixed bug in cx_Oracle dialect where version string parsing would fail for cx_Oracle version 6.0b1 due to the "b" character. Version string parsing is now via a regexp rather than a simple split. Change-Id: I2af7172b0d7184e3ea3bd051e9fa8d6ca2a571cd Fixes: #3975
* | Support autocommit for GRANT and REVOKE on postgresqlJacob Hayes2017-05-091-0/+6
|/ | | | | | | Extends `AUTOCOMMIT_REGEXP` for the postgres dialect to include `GRANT` and `REVOKE`. Change-Id: Iba15f1ebf5bd7bc0fc1193fdf561417e53bf5d57 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/357
* test / document postgresql_ops against a labeled expressionMike Bayer2017-04-241-0/+26
| | | | | | | | | | Since postgresql_ops explicitly states that it expects string keys, to apply to a function call or expression one needs to give the SQL expression a label that can be referred to by name in the dictionary. test / document this. Change-Id: I4bc4ade46dac27f9c1b92e7823433292beab97b9 Fixes: #3970
* Remove MySQL UTC_TIMESTAMP ruleMike Bayer2017-04-132-1/+87
| | | | | | | | | Removed an ancient and unnecessary intercept of the UTC_TIMESTAMP MySQL function, which was getting in the way of using it with a parameter. Change-Id: I6e6b52c051418bcb9d31987e78299310810cb78d Fixes: #3966
* Set up base ARRAY to be compatible with postgresql.ARRAY.Mike Bayer2017-04-111-99/+132
| | | | | | | | | | For some reason, when ARRAY was added to the base it was never linked to postgresql.ARRAY. Link the two types and also make base ARRAY the schema event target so that it supports the same features as postgresql.ARRAY. Change-Id: I82fa6c9d2b8c5028dba3a009715f7bc296b2bc0b Fixes: #3964
* Consider mysql partition options separately from other table optionsMike Bayer2017-04-061-0/+37
| | | | | | | | | Move down all the PARTITION, SUBPARTITION options into a separate segment so that they come out at the end of CREATE TABLE after the table options. Change-Id: Iaa1c823848c93680ca22d72bda1b7c49742b9060 Fixes: #3961
* Support Postgresql INTERVAL fields spec/reflectionMike Bayer2017-04-051-1/+59
| | | | | | | | | | | | | Added support for all possible "fields" identifiers when reflecting the Postgresql ``INTERVAL`` datatype, e.g. "YEAR", "MONTH", "DAY TO MINUTE", etc.. In addition, the :class:`.postgresql.INTERVAL` datatype itself now includes a new parameter :paramref:`.postgresql.INTERVAL.fields` where these qualifiers can be specified; the qualifier is also reflected back into the resulting datatype upon reflection / inspection. Change-Id: I33816e68c533b023e0632db6f4e73fefd2de4721 Fixes: #3959
* Recognize brackets, quoted_name in SQL Server schemaMike Bayer2017-04-041-7/+95
| | | | | | | | | | | | | The SQL Server dialect now allows for a database and/or owner name with a dot inside of it, using brackets explicitly in the string around the owner and optionally the database name as well. In addition, sending the :class:`.quoted_name` construct for the schema name will not split on the dot and will deliver the full string as the "owner". :class:`.quoted_name` is also now available from the ``sqlalchemy.sql`` import space. Change-Id: I77491d63ce47638bd23787d903ccde2f35a9d43d Fixes: #2626
* ResultProxy won't autoclose connection until state flag is setMike Bayer2017-04-031-0/+29
| | | | | | | | | | | | | | Changed the mechanics of :class:`.ResultProxy` to unconditionally delay the "autoclose" step until the :class:`.Connection` is done with the object; in the case where Postgresql ON CONFLICT with RETURNING returns no rows, autoclose was occurring in this previously non-existent use case, causing the usual autocommit behavior that occurs unconditionally upon INSERT/UPDATE/DELETE to fail. Change-Id: I235a25daf4381b31f523331f810ea04450349722 Fixes: #3955 (cherry picked from commit 8ee363e4917b0dcd64a83b6d26e465c9e61e0ea5) (cherry picked from commit f52fb5282a046d26b6ee2778e03b995eb117c2ee)
* Support Postgresql development version numbersSean McCully2017-03-291-1/+4
| | | | | | | | | Added support for parsing the Postgresql version string for a development version like "PostgreSQL 10devel". Pull request courtesy Sean McCully. Change-Id: I7bc18bc4d290349c23e9796367b7d694d0873096 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/351
* Implement comments for tables, columnsFrazer McLean2017-03-171-1/+1
| | | | | | | | | | | | | | Added support for SQL comments on :class:`.Table` and :class:`.Column` objects, via the new :paramref:`.Table.comment` and :paramref:`.Column.comment` arguments. The comments are included as part of DDL on table creation, either inline or via an appropriate ALTER statement, and are also reflected back within table reflection, as well as via the :class:`.Inspector`. Supported backends currently include MySQL, Postgresql, and Oracle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #1546 Change-Id: Ib90683850805a2b4ee198e420dc294f32f15d35d
* Repair _execute_scalar for WITH_UNICODE modeMike Bayer2017-03-131-2/+2
| | | | | | | | | | | | | | | | | cx_Oracle 5.3 seems to code this flag ON now, so remove the warning and ensure WITH_UNICODE handling works. Additionally, the XE setup on jenkins is having more problems here, in particular low-connections mode is causing cx_Oracle to fail more frequently now. Turning off low-connections fixes those but then we get the TNS errors, so adding an emergency "retry" flag that is not yet a feature available to users. Real world applications are not dropping/creating thousands of tables the way our test suite is. Change-Id: Ie95b0e697276c404d3264c2e624e870463d966d6 Fixes: #3937
* Allow SchemaType and Variant to work togetherMike Bayer2017-03-071-0/+71
| | | | | | | | | | | | | | Added support for the :class:`.Variant` and the :class:`.SchemaType` objects to be compatible with each other. That is, a variant can be created against a type like :class:`.Enum`, and the instructions to create constraints and/or database-specific type objects will propagate correctly as per the variant's dialect mapping. Also added testing for some potential double-event scenarios on TypeDecorator but it seems usually this doesn't occur. Change-Id: I4a7e7c26b4133cd14e870f5bc34a1b2f0f19a14a Fixes: #2892
* - add test for inserting PG array w/ NULL, references #3916Mike Bayer2017-02-161-0/+9
| | | | Change-Id: I87be274c1ba019b41744a5a76c1b5e9334564ec8
* Add new DDL autocommit expressions for PostgresqlMike Bayer2017-02-131-0/+11
| | | | | | | | | | | | | | Added regular expressions for the "IMPORT FOREIGN SCHEMA", "REFRESH MATERIALIZED VIEW" Postgresql statements so that they autocommit when invoked via a connection or engine without an explicit transaction. Pull requests courtesy Frazer McLean and Paweł Stiasny. Fixes: #3840 Co-authored-by: Frazer McLean Co-authored-by: Paweł Stiasny Change-Id: I92b2b61683d29d57fa23a66a3559120cb1241c2f Pull-request: https://github.com/zzzeek/sqlalchemy/pull/323
* - limit to MySQL dialectMike Bayer2017-02-131-0/+2
| | | | Change-Id: I2781e1e2221d89c75dd65ff49490d9c409967930
* - pull autocommit suite into the mysql suite as wellMike Bayer2017-02-131-0/+9
| | | | Change-Id: If1106f7f125739e69ad2482f65b8f37672a76c9e
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-0722-584/+597
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* Copy whereclause / using in ExcludeConstraintMike Bayer2017-01-301-0/+24
| | | | | | | | | Fixed bug in Postgresql :class:`.ExcludeConstraint` where the "whereclause" and "using" parameters would not be copied during an operation like :meth:`.Table.tometadata`. Change-Id: I2f704981d4d4862f9c82a50272006fab8becebb6 Fixes: #3900
* Merge "Parse (but don't record) COMMENT portion of MySQL table key"mike bayer2017-01-171-0/+12
|\
| * Parse (but don't record) COMMENT portion of MySQL table keyLele Long2017-01-171-0/+12
| | | | | | | | | | | | | | | | | | | | | | The MySQL dialect now will not warn when a reflected column has a "COMMENT" keyword on it, but note however the comment is not yet reflected; this is on the roadmap for a future release. Pull request courtesy Lele Long. Fixes: #3867 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/324 Change-Id: I869e29aba6766d0eda1e59af09a3e8e3748a3942
* | Add support for prefixes on CREATE INDEX statements in MySQLJoseph Schorr2017-01-171-0/+8
|/ | | | | | | | | Added a new parameter ``mysql_prefix`` supported by the :class:`.Index` construct, allows specification of MySQL-specific prefixes such as "FULLTEXT". Pull request courtesy Joseph Schorr. Change-Id: I5a21fa466fdfd4d9e39e1fb4ecec1eab93b92c36 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/339
* Merge "Use full column->type processing for ON CONFLICT SET clause"mike bayer2017-01-132-4/+84
|\
| * Use full column->type processing for ON CONFLICT SET clauseMike Bayer2017-01-132-4/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in new "ON CONFLICT DO UPDATE" feature where the "set" values for the UPDATE clause would not be subject to type-level processing, as normally takes effect to handle both user-defined type level conversions as well as dialect-required conversions, such as those required for JSON datatypes. Additionally, clarified that the keys in the set_ dictionary should match the "key" of the column, if distinct from the column name. A warning is emitted for remaining column names that don't match column keys; for compatibility reasons, these are emitted as they were previously. Fixes: #3888 Change-Id: I67a04c67aa5f65e6d29f27bf3ef2f8257088d073
* | Support python3.6Mike Bayer2017-01-132-4/+4
|/ | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* Allow the value 0 for Postgresql TIME/TIMESTAMP precisionIonuț Ciocîrlan2016-11-231-0/+4
| | | | | Change-Id: Ie38c48369222d95849645f027e2c659f503cfd53 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/322
* Port lower case quoted name fix to firebirdMike Bayer2016-11-161-23/+0
| | | | | | | | | | | | | | Ported the fix for Oracle quoted-lowercase names to Firebird, so that a table name that is quoted as lower case can be reflected properly including when the table name comes from the get_table_names() inspection function. Also genericize the test to the test suite for denormlized name dialects. Fixes: #3548 Change-Id: I8ca62e8d2b359e363ccb01cfe2daa0995354a3cb
* Quote URL tokens with semicolons for pyodbc, adodbapiMike Bayer2016-11-111-1/+44
| | | | | | | | | | Fixed bug in pyodbc dialect (as well as in the mostly non-working adodbapi dialect) whereby a semicolon present in the password or username fields could be interpreted as a separator for another token; the values are now quoted when semicolons are present. Change-Id: I5f99fd8db53ebf8e805e7d9d60bc09b8f1af603f Fixes: #3762
* Add support for server side cursors to mysqldb and pymysqlRoman Podoliaka2016-11-101-133/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to skip buffering of the results on the client side, e.g. the following snippet: table = sa.Table( 'testtbl', sa.MetaData(), sa.Column('id', sa.Integer, primary_key=True), sa.Column('a', sa.Integer), sa.Column('b', sa.String(512)) ) table.create(eng, checkfirst=True) with eng.connect() as conn: result = conn.execute(table.select().limit(1)).fetchone() if result is None: for _ in range(1000): conn.execute( table.insert(), [{'a': random.randint(1, 100000), 'b': ''.join(random.choice(string.ascii_letters) for _ in range(100))} for _ in range(1000)] ) with eng.connect() as conn: for row in conn.execution_options(stream_results=True).execute(table.select()): pass now uses ~23 MB of memory instead of ~327 MB on CPython 3.5.2 and PyMySQL 0.7.9. psycopg2 implementation and execution options (stream_results, server_side_cursors) are reused. Change-Id: I4dc23ce3094f027bdff51b896b050361991c62e2
* Put include_table=True for DO UPDATE..WHERE, but not ON CONFLICTMike Bayer2016-11-072-6/+50
| | | | | | | | | | | | | Fixed regression caused by the fix in :ticket:`3807` (version 1.1.0) where we ensured that the tablename was qualified in the WHERE clause of the DO UPDATE portion of PostgreSQL's ON CONFLICT, however you *cannot* put the table name in the WHERE clause in the actual ON CONFLICT itself. This was an incorrect assumption, so that portion of the change in :ticket:`3807` is rolled back. Change-Id: I442d8629496a8e405b54711cfcf487761810ae8a Fixes: #3846 Fixes: #3807