summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
Commit message (Collapse)AuthorAgeFilesLines
* use the stack to get the insert statement in on conflictticket_4074_11Mike Bayer2017-09-121-1/+3
| | | | | | | | | | 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 (cherry picked from commit 70516536107a44230762206342c51239c5d85417)
* 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 (cherry picked from commit 65680b2343ef421a62582e23e2b35293732933ad)
* - fix typosMike Bayer2017-08-221-1/+1
| | | | | Change-Id: Ibf8bc0e997ff989c7b0c16afad48a95414078052 (cherry picked from commit d8a80a35a0f117c7659c7a9c62e27994d3aadc01)
* - 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-221-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 (cherry picked from commit 03255a5a0fc6aa8acfff99ed9e62d58054b8b6af)
* 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 (cherry picked from commit 7997d7fdc3634e7dba9fd0113b8b85ef311bfeaa)
* 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 (cherry picked from commit 5650a0c306391216a9c9ce1961c5b548e534b5eb)
* 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 (cherry picked from commit ec422fb70e0044ed42dcfda5fb1a7a65db322cf1)
* Parse for Postgresql version w/ "beta"Mike Bayer2017-06-081-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 (cherry picked from commit b6d3f60791834ead92564fc58afebc2c3eb4a2ff)
* 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 (cherry picked from commit b1369b47217558779a5b8a17ecd945cedd608dc7)
* 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 (cherry picked from commit 1b98ce355a60b7ad9898aeb412c21591bb438231)
* 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 (cherry picked from commit 2574ca4b215cb06720d3ff4352d87ce87ebdd160)
* Fix docs syntax errorDenis Kataev2017-05-101-8/+6
| | | | (cherry picked from commit 3e3554d37ca589218c13f9b2969801dccbbdfa2c)
* Merge "Use regexp to parse cx_oracle version string" into rel_1_1mike 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 (cherry picked from commit 50484eda7787c3e83c9c88c1841fc63b348ca23c)
* | 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 (cherry picked from commit 328248e6e31100aae03f060b83488f3116cd3450)
* Break the lines to fit pdf and fix another broken syntaxLunarShaddow2017-05-081-8/+10
| | | | | | (cherry picked from commit 3d19fb6d53c2aa0fdb7944569fa697c75785634c) Change-Id: I17334d7673c645505af4eaaf2112544f2fa5e625
* 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 (cherry picked from commit 029d0f75385298f8056c04eba1d2f9563126a8a6)
* 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 (cherry picked from commit c0b85ad6ad1df2497a95c87d837c32d87f17291f)
* 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 (cherry picked from commit 93b11905e599a6d73a85d2085e15385ebf46cdc6)
* 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 (cherry picked from commit a86764d99b3a440cdc27b437ef2de9d393ca8036)
* 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 (cherry picked from commit 28edc2604a96d5ecd8318232c95a034433aa07d1)
* Repair _execute_scalar for WITH_UNICODE modeMike Bayer2017-03-131-15/+24
| | | | | | | | | | | | | | | | | 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
* Repair missing "checkfirst" for test suiteMike Bayer2017-03-071-4/+4
| | | | | | | | the test_metadata tests trigger the before_create dispatch without the checkfirst flag. Postgresql backend should be able to tolerate this. Change-Id: Ife497cc3a4eb2812462116f94aad732864225f3f
* - update asktom link, fixes #3925Mike Bayer2017-03-061-1/+1
| | | | Change-Id: Ibd63311dfccebbdf67e8ad7dc56ad311bf573895
* Add new reserved words for MySQL 8.0 (beta).Hanno Schlichting2017-02-281-0/+3
| | | | | | | Based on https://dev.mysql.com/doc/refman/8.0/en/keywords.html#table-keywords-new-8.0 Change-Id: I128c93520e57331e0ec4d40b0c0e752bf9b982d9 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/346
* Add new DDL autocommit expressions for PostgresqlMike Bayer2017-02-131-0/+8
| | | | | | | | | | | | | | 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
* Copy whereclause / using in ExcludeConstraintMike Bayer2017-01-301-1/+3
| | | | | | | | | 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
* Don't check isolation level prior to SQL Server 2005Mike Bayer2017-01-261-0/+4
| | | | | | | | | | Added a version check to the "get_isolation_level" feature, which is invoked upon first connect, so that it skips for SQL Server version 2000, as the necessary system view is not available prior to SQL Server 2005. Change-Id: If4f860513f0aae6625803f449714aedfc5075f57 Fixes: #3898
* - document that "column" and "where" are arbitrary SQL expressionsMike Bayer2017-01-261-3/+51
| | | | | | | for ExcludeConstraint, if string is used then quoting must be applied manually. fixes #3899 Change-Id: I5885c90179e4056b84fc4776464bba7c8c70a80a
* Improve server-side Sequence documentationMike Bayer2017-01-191-0/+1
| | | | | | | | | | | | Include the metadata argument for the Sequence and explain the rationale. Correct inconsistencies between Core / ORM examples and update language regarding client side vs. server side Sequence directive. Co-authored-by: Stéphane Raimbault <stephane.raimbault@gmail.com> Change-Id: I65c522acf9bdf25041a5baf2e10be41f0927999a Pull-request: https://github.com/zzzeek/sqlalchemy/pull/341
* Merge "Parse (but don't record) COMMENT portion of MySQL table key"mike bayer2017-01-171-0/+1
|\
| * Parse (but don't record) COMMENT portion of MySQL table keyLele Long2017-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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/+25
|/ | | | | | | | | 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-11/+49
|\
| * Use full column->type processing for ON CONFLICT SET clauseMike Bayer2017-01-132-11/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Support python3.6"mike bayer2017-01-1312-41/+41
|\ \ | |/ |/|
| * Support python3.6Mike Bayer2017-01-1312-41/+41
| | | | | | | | | | | | | | | | | | | | | | 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
* | - document how to use autocommit isolation level for CONCURRENTLY,Mike Bayer2017-01-121-0/+19
|/ | | | | | fixes #3887 Change-Id: I6d1a13b7bb4169204105c7a100d17cfed3ded9d1
* Merge "update for 2017 copyright"mike bayer2017-01-0954-54/+54
|\
| * update for 2017 copyrightMike Bayer2017-01-0454-54/+54
| | | | | | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* | - add a section for ARRAY of JSON to complement ARRAY of ENUM. references #3467Mike Bayer2017-01-051-0/+23
|/ | | | Change-Id: I9836b842be01ef24138071fa022d80f5f77be14f
* Don't select lastrowid for inline=TrueMike Bayer2016-12-211-1/+2
| | | | | | | | | | | - Fixed bug where SQL Server dialects would attempt to select the last row identity for an INSERT from SELECT, failing in the case when the SELECT has no rows. For such a statement, the inline flag is set to True indicating no last primary key should be fetched. Change-Id: Ic40d56d9eadadc3024a4d71245f9eed4c420024a Fixes: #3876
* Bump "table compression" flag to Oracle 10.1Mike Bayer2016-12-201-1/+1
| | | | | | | | | | - Fixed bug where the "COMPRESSION" keyword was used in the ALL_TABLES query on Oracle 9.2; even though Oracle docs state table compression was introduced in 9i, the actual column is not present until 10.1. Change-Id: Iebfa59bfcfdff859169df349a5426137ab006e67 Fixes: #3875
* Allow the value 0 for Postgresql TIME/TIMESTAMP precisionIonuț Ciocîrlan2016-11-231-4/+4
| | | | | Change-Id: Ie38c48369222d95849645f027e2c659f503cfd53 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/322
* Port lower case quoted name fix to firebirdMike Bayer2016-11-161-0/+3
| | | | | | | | | | | | | | 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/+8
| | | | | | | | | | 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 conditional import for pysqlcipher3Kevin Jurczyk2016-11-101-2/+16
| | | | | | | This is a Py3K supporting DBAPI for pysqlcipher. Change-Id: I2a625274a371908f4de9d37f33e05408894b334b Pull-request: https://github.com/zzzeek/sqlalchemy/pull/320
* Add support for server side cursors to mysqldb and pymysqlRoman Podoliaka2016-11-104-38/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add quotes around PRAGMA values in pysqlcipher connect.Kevin Jurczyk2016-11-081-1/+1
| | | | | | | | | Arguments such as cipher, kdf_iter, cipher_page_size and cipher_use_hmac may (always?) require quotes within the PRAGMA directive. Change-Id: I2c808f34e1c44f0593b72b304e170e4af0a6035a Pull-request: https://github.com/zzzeek/sqlalchemy/pull/319