summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Update select usage to use the new 1.4 format"mike bayer2020-09-087-34/+29
|\
| * Update select usage to use the new 1.4 formatFederico Caselli2020-09-087-34/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change includes mainly that the bracketed use within select() is moved to positional, and keyword arguments are removed from calls to the select() function. it does not yet fully address other issues such as keyword arguments passed to the table.select(). Additionally, allows False / None to both be considered as "disable" for all of select.correlate(), select.correlate_except(), query.correlate(), which establishes consistency with passing of ``False`` for the legact select(correlate=False) argument. Change-Id: Ie6c6e6abfbd3d75d4c8de504c0cf0159e6999108
* | Fix typo in I0ad6d7a095e49d331618274c40ce75c76afdc7ddFederico Caselli2020-09-081-2/+2
|/ | | | Change-Id: I649662d440f83df379922e8c967d28f635f9c85b
* Merge "Create connection characteristics API; implement postgresql flags"mike bayer2020-09-084-1/+158
|\
| * Create connection characteristics API; implement postgresql flagsMike Bayer2020-09-084-1/+158
| | | | | | | | | | | | | | | | | | | | | | Added support for PostgreSQL "readonly" and "deferrable" flags for all of psycopg2, asyncpg and pg8000 dialects. This takes advantage of a newly generalized version of the "isolation level" API to support other kinds of session attributes set via execution options that are reliably reset when connections are returned to the connection pool. Fixes: #5549 Change-Id: I0ad6d7a095e49d331618274c40ce75c76afdc7dd
* | PostgreSQL dialect-level isolation_level parameter is legacyMike Bayer2020-09-081-17/+29
|/ | | | | | | | | The isolation level section in the docs inadvertently copied the PostgreSQL example using the PGDialect.isolation_level parameter and not the execution_options. ensure only the execution_options version is documented. Change-Id: I94e02ede62d3dded40e3fcbce8d04608dc063108
* Merge "Add new MySQL reserved words: `cube`, `lateral`."mike bayer2020-09-031-0/+2
|\
| * Add new MySQL reserved words: `cube`, `lateral`.StefanosChaliasos2020-08-301-0/+2
| | | | | | | | | | | | | | | | Closes: #5539 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5539 Pull-request-sha: 8c228be322023041b11691d93dafa1be090f01a0 Change-Id: Ic756472a19563e793cf7e33b24eb1ad5e913dbc0
* | Merge "Improve reflection for mssql temporary tables"mike bayer2020-09-013-4/+67
|\ \
| * | Improve reflection for mssql temporary tablesGord Thompson2020-09-013-4/+67
| | | | | | | | | | | | | | | Fixes: #5506 Change-Id: I718474d76e3c630a1b71e07eaa20cefb104d11de
* | | MariaDB dialect implementationGeorg Richter2020-08-313-0/+244
|/ / | | | | | | | | | | | | | | | | | | Fixes: #5459 Closes: #5515 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5515 Pull-request-sha: 760090b9067304cc65fece12fcf10b522afc4a2a Change-Id: I30e8fbc02b7b5329ca228cd39f6fb7cfd0e43092
* | Emit v2.0 deprecation warning for "implicit autocommit"Gord Thompson2020-08-281-31/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Implicit autocommit", which is the COMMIT that occurs when a DML or DDL statement is emitted on a connection, is deprecated and won't be part of SQLAlchemy 2.0. A 2.0-style warning is emitted when autocommit takes effect, so that the calling code may be adjusted to use an explicit transaction. As part of this change, DDL methods such as :meth:`_schema.MetaData.create_all` when used against a :class:`_engine.Engine` or :class:`_engine.Connection` will run the operation in a BEGIN block if one is not started already. The MySQL and MariaDB dialects now query from the information_schema.tables system view in order to determine if a particular table exists or not. Previously, the "DESCRIBE" command was used with an exception catch to detect non-existent, which would have the undesirable effect of emitting a ROLLBACK on the connection. There appeared to be legacy encoding issues which prevented the use of "SHOW TABLES", for this, but as MySQL support is now at 5.0.2 or above due to :ticket:`4189`, the information_schema tables are now available in all cases. Fixes: #4846 Change-Id: I733a7e0e17477a63607fb9931c87c393bbd7ac57
* | Add support for regular expression on supported backend.Federico Caselli2020-08-275-2/+220
|/ | | | | | | | | | | | Two operations have been defined: * :meth:`~.ColumnOperators.regexp_match` implementing a regular expression match like function. * :meth:`~.ColumnOperators.regexp_replace` implementing a regular expression string replace function. Fixes: #1390 Change-Id: I44556846e4668ccf329023613bd26861d5c674e6
* Merge "make URL immutable"mike bayer2020-08-263-11/+6
|\
| * make URL immutableMike Bayer2020-08-253-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | it's not really correct that URL is mutable and doesn't do any argument checking. propose replacing it with an immutable named tuple with rich copy-and-mutate methods. At the moment this makes a hard change to the CreateEnginePlugin docs that previously recommended url.query.pop(). I can't find any plugins on github other than my own that are using this feature, so see if we can just make a hard change on this one. Fixes: #5526 Change-Id: I28a0a471d80792fa8c28f4fa573d6352966a4a79
* | Merge "Updates for MariaDB sequences"mike bayer2020-08-252-8/+10
|\ \
| * | Updates for MariaDB sequencesFederico Caselli2020-08-222-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MariaDB should not run a Sequence if it has optional=True. Additionally, rework the rules in crud.py to accommodate the new combination MariaDB brings us, which is a dialect that supports both cursor.lastrowid, explicit sequences, *and* no support for returning. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #5528 Change-Id: I9a8ea69a34983affa95dfd22186e2908fdf0d58c
* | | Add deprecation warning for mssql legacy_schema_aliasingGord Thompson2020-08-242-8/+15
|/ / | | | | | | | | Fixes: #4809 Change-Id: I9ce2a5dfb79d86624c187ee28b5911fd14328ce2
* | Merge "Add support for identity columns"mike bayer2020-08-213-46/+185
|\ \ | |/ |/|
| * Add support for identity columnsFederico Caselli2020-08-193-46/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Added the :class:`_schema.Identity` construct that can be used to configure identity columns rendered with GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY. Currently the supported backends are PostgreSQL >= 10, Oracle >= 12 and MSSQL (with different syntax and a subset of functionalities). Fixes: #5362 Fixes: #5324 Fixes: #5360 Change-Id: Iecea6f3ceb36821e8b96f0b61049b580507a1875
* | Merge "normalize execute style for events, 2.0"mike bayer2020-08-201-8/+12
|\ \
| * | normalize execute style for events, 2.0Mike Bayer2020-08-201-8/+12
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | The _execute_20 and exec_driver_sql methods should wrap up the parameters so that they represent the single list / single dictionary style of invocation into the legacy methods. then the before_ after_ execute event handlers should be receiving the parameter dictionary as a single dictionary. this requires that we break out distill_params to work differently if event handlers are present. additionally, add deprecation warnings for old argument passing styles. Change-Id: I97cb4d06adfcc6b889f10d01cc7775925cffb116
* | Merge "Implement DDL visitor for PG ENUM with schema translate support"mike bayer2020-08-191-10/+47
|\ \
| * | Implement DDL visitor for PG ENUM with schema translate supportMike Bayer2020-08-191-10/+47
| |/ | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the :class:`_postgresql.ENUM` type would not consult the schema translate map when emitting a CREATE TYPE or DROP TYPE during the test to see if the type exists or not. Additionally, repaired an issue where if the same enum were encountered multiple times in a single DDL sequence, the "check" query would run repeatedly rather than relying upon a cached value. Fixes: #5520 Change-Id: I79f46e29ac0168e873ff178c242f8d78f6679aeb
* | Merge "Add JSON support for mssql"mike bayer2020-08-197-10/+239
|\ \
| * | Add JSON support for mssqlGord Thompson2020-08-197-10/+239
| |/ | | | | | | | | | | | | | | | | | | Added support for the :class:`_types.JSON` datatype on the SQL Server dialect using the :class:`_mssql.JSON` implementation, which implements SQL Server's JSON functionality against the ``NVARCHAR(max)`` datatype as per SQL Server documentation. Implementation courtesy Gord Thompson. Fixes: #4384 Change-Id: I28af79a4d8fafaa68ea032228609bba727784f18
* | Support data types for CREATE SEQUENCE in PostgreSQLFederico Caselli2020-08-181-0/+11
|/ | | | | | | | | Allow specifying the data type when creating a :class:`.Sequence` in PostgreSQL by using the parameter :paramref:`.Sequence.data_type`. Fixes: #5498 Change-Id: I2b4a80aa89b1503c56748dc3ecd2cf145faddd8b
* Update dialect for pg8000 version 1.16.0Tony Locke2020-08-183-41/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pg8000 dialect has been revised and modernized for the most recent version of the pg8000 driver for PostgreSQL. Changes to the dialect include: * All data types are now sent as text rather than binary. * Using adapters, custom types can be plugged in to pg8000. * Previously, named prepared statements were used for all statements. Now unnamed prepared statements are used by default, and named prepared statements can be used explicitly by calling the Connection.prepare() method, which returns a PreparedStatement object. Pull request courtesy Tony Locke. Notes by Mike: to get this all working it was needed to break up JSONIndexType into "str" and "int" subtypes; this will be needed for any dialect that is dependent on setinputsizes(). also includes @caselit's idea to include query params in the dbdriver parameter. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Closes: #5451 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5451 Pull-request-sha: 639751ca9c7544801b9ede02e6cbe15a16c59c82 Change-Id: I2869bc52c330916773a41d11d12c297aecc8fcd8
* Merge "Create a real type for Tuple() and handle appropriately in compiler"mike bayer2020-08-171-6/+23
|\
| * Create a real type for Tuple() and handle appropriately in compilerMike Bayer2020-08-171-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improved the :func:`_sql.tuple_` construct such that it behaves predictably when used in a columns-clause context. The SQL tuple is not supported as a "SELECT" columns clause element on most backends; on those that do (PostgreSQL, not surprisingly), the Python DBAPI does not have a "nested type" concept so there are still challenges in fetching rows for such an object. Use of :func:`_sql.tuple_` in a :func:`_sql.select` or :class:`_orm.Query` will now raise a :class:`_exc.CompileError` at the point at which the :func:`_sql.tuple_` object is seen as presenting itself for fetching rows (i.e., if the tuple is in the columns clause of a subquery, no error is raised). For ORM use,the :class:`_orm.Bundle` object is an explicit directive that a series of columns should be returned as a sub-tuple per row and is suggested by the error message. Additionally ,the tuple will now render with parenthesis in all contexts. Previously, the parenthesization would not render in a columns context leading to non-defined behavior. As part of this change, Tuple receives a dedicated datatype which appears to allow us the very desirable change of removing the bindparam._expanding_in_types attribute as well as ClauseList._tuple_values (which might already have not been needed due to #4645). Fixes: #5127 Change-Id: Iecafa0e0aac2f1f37ec8d0e1631d562611c90200
* | Bump minimum MySQL version to 5.0.2; use all-numeric server versionMike Bayer2020-08-163-226/+226
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MySQL dialect's server_version_info tuple is now all numeric. String tokens like "MariaDB" are no longer present so that numeric comparison works in all cases. The .is_mariadb flag on the dialect should be consulted for whether or not mariadb was detected. Additionally removed structures meant to support extremely old MySQL versions 3.x and 4.x; the minimum MySQL version supported is now version 5.0.2. In addition, as the "MariaDB" name goes away from server version, expand upon the change in I330815ebe572b6a9818377da56621397335fa702 to support the name "mariadb" throughout the dialect and test suite when mariadb-only mode is used. This changes the "name" field on the MariaDB dialect to "mariadb", which then implies a change throughout the testing requirements system as well as all the dialect-specific DDL argument names such as "mysql_engine" is now specified as "mariadb_engine", etc. Make use of the recent additions to test suite URL provisioning so that we can force MariaDB databases to have a "mariadb-only" dialect which allows us to test this name change fully. Update documentation to refer to MySQL / MariaDB explicitly as well as indicating the "mariadb_" prefix used for options. It seems likely that MySQL and MariaDB version numbers are going to start colliding at some point so having the "mariadb" name be available as a totally separate dialect name should give us some options in this regard. Currently also includes a date related fix to a test for the postgresql dialect that was implicitly assuming a non-UTC timezone Fixes: #4189 Change-Id: I00e76d00f62971e1f067bd61915fa6cc1cf64e5e
* Provision on different drivers dynamicallyMike Bayer2020-08-141-0/+17
| | | | | | | | | | | We want TOX_POSTGRESQL and similar to be the fixed variable that is configured from CI environment. These variables should refer to database servers but individual drivers like asyncpg mysqlconnector etc. should come from local tox.ini. add a new system to generate per-driver URLs from a simple list of hostname-based URLs delivered from CI environment. Change-Id: I4267b4a70742765388c7e7c4432c1da9d9adece2
* Don't import asyncpg prior to python 3.6Mike Bayer2020-08-141-1/+1
| | | | | | | Continuing on 788ba204a43b37d28cc690138b83e6782f8a46da make sure asyncpg doesn't get imported if version < 3.6. Change-Id: Ic070a0c9d3656f7da7ce2eb85033968fc88a64b9
* Implement rudimentary asyncio support w/ asyncpgMike Bayer2020-08-133-1/+797
| | | | | | | | | | | | | | | | | | | | | | | | | | Using the approach introduced at https://gist.github.com/zzzeek/6287e28054d3baddc07fa21a7227904e We can now create asyncio endpoints that are then handled in "implicit IO" form within the majority of the Core internals. Then coroutines are re-exposed at the point at which we call into asyncpg methods. Patch includes: * asyncpg dialect * asyncio package * engine, result, ORM session classes * new test fixtures, tests * some work with pep-484 and a short plugin for the pyannotate package, which seems to have so-so results Change-Id: Idbcc0eff72c4cad572914acdd6f40ddb1aef1a7d Fixes: #3414
* Use importlib_metadata; add namespace for mariadbMike Bayer2020-08-133-16/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | The ``importlib_metadata`` library is used to scan for setuptools entrypoints rather than pkg_resources. as importlib_metadata is a small library that is included as of Python 3.8, the compatibility library is installed as a dependency for Python versions older than 3.8. Unfortunately setuptools "attr:" is broken because it tries to import the module; seems like this is fixed as part of https://github.com/pypa/setuptools/pull/1753 however this is too recent to rely upon for now. Added a new dialect token "mariadb" that may be used in place of "mysql" in the :func:`_sa.create_engine` URL. This will deliver a MariaDB dialect subclass of the MySQLDialect in use that forces the "is_mariadb" flag to True. The dialect will raise an error if a server version string that does not indicate MariaDB in use is received. This is useful for MariaDB-specific testing scenarios as well as to support applications that are hardcoding to MariaDB-only concepts. As MariaDB and MySQL featuresets and usage patterns continue to diverge, this pattern may become more prominent. Fixes: #5400 Fixes: #5496 Change-Id: I330815ebe572b6a9818377da56621397335fa702
* Fix mysql CREATE TABLE / COLLATE issueGord Thompson2020-08-091-0/+2
| | | | | Fixes: #5411 Change-Id: Ib0c53f5ed3f9d3ff0586580c9a9cce73b4b870f4
* Fix typosKarthikeyan Singaravelan2020-08-091-1/+1
|
* Add MariaDB 1927 to is_disconnect codesMike Bayer2020-08-051-0/+1
| | | | | | | | | Added MariaDB code 1927 to the list of "disconnect" codes, as recent MariaDB versions apparently use this code when the database server was stopped. Fixes: #5493 Change-Id: I63f1d692f36cb0411ead278556e3f8c64ab72ea4
* fix formattingMike Bayer2020-08-041-1/+1
| | | | Change-Id: I8315cfef6e5c4b87d64fc770998a1229cc690870
* Add note that fast_executemany uses memoryMike Bayer2020-08-041-7/+11
| | | | | | | | Ideally this would be a per-execution option, or Pyodbc could perhaps run the data in chunks. Fixes: #5334 Change-Id: If4a11b312346b8e4c2b8cd38840b3a2ba56dec3b
* Clean python UUID importsVlastimil Zíma2020-07-303-22/+3
| | | | | | | | | | | Fixes: #5482 All supported python versions provide 'uuid' module. Closes: #5483 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5483 Pull-request-sha: fc32498a8b639ff21d5898100592782826d2c6dd Change-Id: I8b41b811da7576f724353425dad5d6f581641b4b
* Merge "Consider default FROM DUAL for MySQL"mike bayer2020-07-291-0/+12
|\
| * Consider default FROM DUAL for MySQLMike Bayer2020-07-291-0/+12
| | | | | | | | | | | | | | | | | | | | | | MySQL claims it doesn't require FROM DUAL for no FROM clause even though the issue at #5481 locates a case which requires one. See if FROM DUAL the same way as Oracle without attempting to guess is potentially feasible. Fixes: #5481 Change-Id: I2a28876c10a8ce2d121cd344dcdd837db321d4ab
* | Ensure is_comparison passed for PG RANGE op() methodsJim Bosch2020-07-261-9/+9
|/ | | | | | | | | | | | | | | Fixed issue where the return type for the various RANGE comparison operators would itself be the same RANGE type rather than BOOLEAN, which would cause an undesirable result in the case that a :class:`.TypeDecorator` that defined result-processing behavior were in use. Pull request courtesy Jim Bosch. Fixes: #5476 Closes: #5477 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5477 Pull-request-sha: 925b117e0c91cdd67d9ddbd9d65f5ca3e88af91f Change-Id: I52ab4d4362d379c8253990f9d328a40990a64520
* Update docs with actual MariaDB JSON supportDefteZ2020-07-261-2/+2
|
* Fix mssql dialect escaping object names containing ']'Gord Thompson2020-07-181-1/+4
| | | | | Fixes: #5467 Change-Id: I054ec219717ba62847a9daf1214e215dd6b70633
* Merge "test single and double quote inspection scenarios"2020_tutorialmike bayer2020-07-132-20/+20
|\
| * test single and double quote inspection scenariosMike Bayer2020-07-132-20/+20
| | | | | | | | | | | | | | | | | | | | | | Applied a sweep through all included dialects to ensure names that contain single or double quotes are properly escaped when querying system tables, for all :class:`.Inspector` methods that accept object names as an argument (e.g. table names, view names, etc). SQLite and MSSQL contained two quoting issues that were repaired. Fixes: #5456 Change-Id: I3bc98806f5166f3d82275650079ff561446f2aef
* | more docs for autocommit isolation levelMike Bayer2020-07-125-4/+17
|/ | | | | | | | this concept is not clear that we offer real DBAPI autocommit everywhere. backport 1.3 with edits as well Change-Id: I2e8328b7fb6e1cdc5453ab29c94276f60c7ca149
* Merge "Add future=True to create_engine/Session; unify select()"mike bayer2020-07-081-29/+37
|\