summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
Commit message (Collapse)AuthorAgeFilesLines
* Refactor for cx_Oracle version 6oracle_numericMike Bayer2017-09-113-537/+399
| | | | | | | | | 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-18/+19
| | | | | | | | | | | 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 InternalError for mysqlclient disconnectMike Bayer2017-09-011-1/+2
| | | | | | | | | | mysqlclient as of 1.3.11 changed the exception class for a particular disconnect situation from InterfaceError to InternalError; the disconnection detection logic now accommodates this. Change-Id: I294f90f794491fd363548719222d8e3008480615 Fixes: #4065
* Add SQL Server CI coverageMike Bayer2017-08-315-60/+47
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* Use text_type, not unicodeMike Bayer2017-08-311-1/+1
| | | | | | | Revise the fix from 03560c4b83308719067ec635662c35f9a437fb7f to use compat.text_type for py3k compatibility Change-Id: Ia6807bd4de3bba4b33b5327a1be7e728b45eb093
* Enable native boolean for SQL ServerMike Bayer2017-08-301-1/+1
| | | | | | | | | | | | | | | | SQL Server supports what SQLAlchemy calls "native boolean" with its BIT type, as this type only accepts 0 or 1 and the DBAPIs return its value as True/False. So the SQL Server dialects now enable "native boolean" support, in that a CHECK constraint is not generated for a :class:`.Boolean` datatype. The only difference vs. other native boolean is that there are no "true" / "false" constants so "1" and "0" are still rendered here. Tests are implicit in the existing suites. Change-Id: I75bbcd549884099fb1a177e68667bf880c40fa7c Fixes: #4061
* Merge "Join key_constraints on schema as well for SQL server get_fks"mike bayer2017-08-301-0/+1
|\
| * Join key_constraints on schema as well for SQL server get_fksMike Bayer2017-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where the SQL Server dialect could pull columns from multiple schemas when reflecting a self-referential foreign key constraint, if multiple schemas contained a constraint of the same name against a table of the same name. Tests are part of standard suite already (CI has been disabled) Change-Id: I04ff4a5dea9b82c8e517b3700a28fe994b5550f3 Fixes: #4060
* | Merge "Ignore SQL Server "heap" indexes"mike bayer2017-08-301-1/+1
|\ \
| * | Ignore SQL Server "heap" indexesMike Bayer2017-08-301-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | Added a rule to SQL Server index reflection to ignore the so-called "heap" index that is implicitly present on a table that does not specify a clustered index. Tests are part of standard suite already (CI has been disabled) Change-Id: I593b95551c40ee5d95d54203611112cbff10856f Fixes: #4059
* | Add preparer to pymssql that disables percent doublingMike Bayer2017-08-301-1/+12
|/ | | | | | | | | | | | | Fixed the pymssql dialect so that percent signs in SQL text, such as used in modulus expressions or literal textual values, are **not** doubled up, as seems to be what pymssql expects. This is despite the fact that the pymssql DBAPI uses the "pyformat" parameter style which itself considers the percent sign to be significant. Tests are part of standard suite already (CI has been disabled) Change-Id: Ie05de403caefcba3292a967183a995e95a5854d5 Fixes: #4057
* Implement AUTOCOMMIT for pyodbc, pymssqlMike Bayer2017-08-292-0/+10
| | | | | | | In prep for CI coverage for SQL Server, allow AUTOCOMMIT isolation level to work Change-Id: I850b977e75f53385986f2c181be4e4412dd3b3f4
* Apply percent sign escaping to literal binds, commentsMike Bayer2017-08-251-2/+5
| | | | | | | | | | | | | | 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
* - fix typosMike Bayer2017-08-221-1/+1
| | | | Change-Id: Ibf8bc0e997ff989c7b0c16afad48a95414078052
* - modernize the mysql connection timeout docsMike Bayer2017-08-221-6/+13
| | | | | Change-Id: Icb0474509539c1eb7536544749f2a48b4972078a (cherry picked from commit 4ce46fb0a085c1cc739e21881cc25567e663f8dc)
* First level repair for cx_Oracle 6.0 test regressionsMike Bayer2017-08-181-1/+3
| | | | | | | | | | | | Fixed more regressions caused by cx_Oracle 6.0; at the moment, the only behavioral change for users is disconnect detection now detects for cx_Oracle.DatabaseError in addition to cx_Oracle.InterfaceError, as this behavior seems to have changed. Other issues regarding numeric precision and uncloseable connections are pending with the upstream cx_Oracle issue tracker. Change-Id: Id61f1e33b21c155a598396340dfdecd28ff4066b Fixes: #4045
* Merge "Enable uuid for pg8000"mike bayer2017-08-171-2/+26
|\
| * Enable uuid for pg8000Mike Bayer2017-08-081-2/+26
| | | | | | | | | | | | | | | | | | 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
* | Ensure Oracle index w/ col DESC etc. is reflectedMike Bayer2017-08-141-13/+11
|/ | | | | | | | | | | | | | | | | | | | Fixed bug where an index reflected under Oracle with an expression like "column DESC" would not be returned, if the table also had no primary key, as a result of logic that attempts to filter out the index implicitly added by Oracle onto the primary key columns. Reworked the "filter out the primary key index" logic in oracle get_indexes() to be clearer. This changeset also adds an internal check to ColumnCollection to accomodate for the case of a column being added twice, as well as adding a private _table argument to Index such that reflection can specify the Table explicitly. The _table argument can become part of public API in a later revision or release if needed. Change-Id: I745711e03b3e450b7f31185fc70e10d3823063fa Fixes: #4042
* Add quoted_name to pg8000 py_typesMike Bayer2017-08-081-0/+6
| | | | | | | | | | | 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
* Revert cx_Oracle WITH_UNICODE change under > 5.0Mike Bayer2017-07-281-4/+13
| | | | | | | | | | | | | | | | Fixed performance regression caused by the fix for :ticket:`3937` where cx_Oracle as of version 5.3 dropped the ``.UNICODE`` symbol from its namespace, which was interpreted as cx_Oracle's "WITH_UNICODE" mode being turned on unconditionally, which invokes functions on the SQLAlchemy side which convert all strings to unicode unconditionally and causing a performance impact. In fact, per cx_Oracle's author the "WITH_UNICODE" mode has been removed entirely as of 5.1, so the expensive unicode conversion functions are no longer necessary and are disabled if cx_Oracle 5.1 or greater is detected under Python 2. The warning against "WITH_UNICODE" mode that was removed under :ticket:`3937` is also restored. Change-Id: Iddd38d81a5adb27c953a5ee2eae5529a21da16e1 Fixes: #4035
* Implement MySQL's ON DUPLICATE KEY UPDATEMichael Doronin2017-07-033-0/+200
| | | | | | | | | | | 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-11/+27
| | | | | | | | | | | 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-3/+9
| | | | | | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | 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-2/+109
| | | | | | | | 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-0/+18
| | | | | | | | | | | 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-35/+21
| | | | | | | | | | | 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-2/+7
| | | | | | | | | | | | | 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
* Prevent SQL server isolation level from failingMike Bayer2017-05-221-15/+30
| | | | | | | | | | | | Fixed bug where SQL Server transaction isolation must be fetched from a different view when using Azure data warehouse, the query is now attempted against both views and then a NotImplemented is raised unconditionally if failure continues to provide the best resiliency against future arbitrary API changes in new SQL Server versions. Change-Id: I621b5089febe8ace136428fa133fde1a7e21cda4 Fixes: #3994
* Fix docs syntax errorDenis Kataev2017-05-101-8/+6
|
* Merge "Use regexp to parse cx_oracle version string"mike bayer2017-05-091-2/+12
|\
| * Use regexp to parse cx_oracle version stringMike Bayer2017-05-091-2/+12
| | | | | | | | | | | | | | | | | | 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-1/+1
|/ | | | | | | Extends `AUTOCOMMIT_REGEXP` for the postgres dialect to include `GRANT` and `REVOKE`. Change-Id: Iba15f1ebf5bd7bc0fc1193fdf561417e53bf5d57 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/357
* Break the lines to fit pdf and fix another broken syntaxLunarShaddow2017-05-081-6/+10
|
* remove ambiguous line breakers to help sphinx identify code blockLunarShaddow2017-05-051-5/+2
|
* test / document postgresql_ops against a labeled expressionMike Bayer2017-04-241-8/+19
| | | | | | | | | | 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-131-3/+0
| | | | | | | | | 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-14/+3
| | | | | | | | | | 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-5/+29
| | | | | | | | | 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-8/+22
| | | | | | | | | | | | | 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
* Merge "Double percent signs based on paramstyle, not dialect"mike bayer2017-04-052-19/+4
|\
| * Double percent signs based on paramstyle, not dialectMike Bayer2017-04-052-19/+4
| | | | | | | | | | | | | | | | | | | | | | | | This patch moves the "doubling" of percent signs into the base compiler and makes it completely a product of whether or not the paramstyle is format/pyformat or not. Without this paramstyle, percent signs are not doubled across text(), literal_column(), and column(). Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197 Fixes: #3740
* | Recognize brackets, quoted_name in SQL Server schemaMike Bayer2017-04-041-3/+100
|/ | | | | | | | | | | | | 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
* Support Postgresql development version numbersSean McCully2017-03-291-1/+1
| | | | | | | | | 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
* Use config.db global opts as defaults for all testing_engine()Mike Bayer2017-03-221-0/+2
| | | | | | | | | | Some options need to be passed to engines in all cases, such as currently the oracle 12516 workaround. make sure calls to testing_engine also set up the dictionary with defaults even if options is passed. not clear if this affects other backends yet. Change-Id: I5a1f7634e4ce5af6fe55dc21a24db6afacd19bb7
* New features from python 2.7Катаев Денис2017-03-173-6/+6
| | | | | | | After bump minimum supported version to 2.7 (1da9d3752160430c91534a8868ceb8c5ad1451d4), we can use new syntax. Change-Id: Ib064c75a00562e641d132f9c57e5e69744200e05 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/347
* Implement comments for tables, columnsFrazer McLean2017-03-174-35/+131
| | | | | | | | | | | | | | 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
* Enable sane_multi_rowcount for cx_OracleMike Bayer2017-03-142-2/+5
| | | | | | | Also add some tests to test_rowcount. Change-Id: Idaa18fdc4fcfeb615725531c37de77decf76a783 Fixes: #3932
* Normalize Oracle reflected FK constraint nameMike Bayer2017-03-131-0/+2
| | | | | | | | | | | | | Oracle reflection now "normalizes" the name given to a foreign key constraint, that is, returns it as all lower case for a case insensitive name. This was already the behavior for indexes and primary key constraints as well as all table and column names. This will allow Alembic autogenerate scripts to compare and render foreign key constraint names correctly when initially specified as case insensitive. Change-Id: Ibb34ec6ce7cb244d1c4ae9d44ce2d37d37227e69 Fixes: #3276