summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
Commit message (Collapse)AuthorAgeFilesLines
* Fetch first supportFederico Caselli2020-10-024-54/+105
| | | | | | | | | Add support to ``FETCH {FIRST | NEXT} [ count ] {ROW | ROWS} {ONLY | WITH TIES}`` in the select for the supported backends, currently PostgreSQL, Oracle and MSSQL. Fixes: #5576 Change-Id: Ibb5871a457c0555f82b37e354e7787d15575f1f7
* accommodate for null in sqlite regex handlerMike Bayer2020-10-021-1/+2
| | | | | Fixes: #5624 Change-Id: Ic20dcde0a1e96b9981c63cac3cd34c7fdc7bd395
* fix too-short underlineMike Bayer2020-09-301-1/+2
| | | | Change-Id: Id9ac0b45f0859199e7db61ef5d4fac956b74b2ba
* Merge "Support for multiple hosts in PostgreSQL connection string"mike bayer2020-09-301-0/+31
|\
| * Support for multiple hosts in PostgreSQL connection stringRamonWill2020-09-231-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide support for multiple hosts in the PostgreSQL connection string. A user requested for SQLAlchemy to support multiple hosts within a PostgreSQL URL string. The proposed fix allows this. In the event that the url contains multiple hosts the proposed code will convert the query["hosts"] tuple into a single string. This allows the hosts to then get converted into a valid dsn variable in the psycopg2 connect function. This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [X ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. **Have a nice day!** Fixes: #4392 Closes: #5554 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5554 Pull-request-sha: 3f7a0ab8df9f1411a9f1ac0e152583bc7bf0c365 Change-Id: I3f3768d51b8331de786ffdc025b7ecfc662eafe5
* | Add reflection for Identity columnsFederico Caselli2020-09-284-94/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for reflecting "identity" columns, which are now returned as part of the structure returned by :meth:`_reflection.Inspector.get_columns`. When reflecting full :class:`_schema.Table` objects, identity columns will be represented using the :class:`_schema.Identity` construct. Fixed compilation error on oracle for sequence and identity column ``nominvalue`` and ``nomaxvalue`` options that require no space in them. Improved test compatibility with oracle 18. As part of the support for reflecting :class:`_schema.Identity` objects, the method :meth:`_reflection.Inspector.get_columns` no longer returns ``mssql_identity_start`` and ``mssql_identity_increment`` as part of the ``dialect_options``. Use the information in the ``identity`` key instead. The mssql dialect will assume that at least MSSQL 2005 is used. There is no hard exception raised if a previous version is detected, but operations may fail for older versions. Fixes: #5527 Fixes: #5324 Change-Id: If039fe637c46b424499e6bac54a2cbc0dc54cb57
* | upgrade to black 20.8b1Mike Bayer2020-09-2812-57/+54
| | | | | | | | | | | | | | It's better, the majority of these changes look more readable to me. also found some docstrings that had formatting / quoting issues. Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b
* | Improve Asyncpg json handlingFederico Caselli2020-09-231-11/+67
|/ | | | | | | | | Set default type codec for ``json`` and ``jsonb`` types when using the asyncpg driver. By default asyncpg will not decode them and return strings instead. Fixes: #5584 Change-Id: I41348eff8096ccf87b952d7e797c0694c6c4b5c4
* Fix has_table() for mssql temporary tablesGord Thompson2020-09-191-14/+27
| | | | | | | | | Fixes: #5597 Fixes the issue where :meth:`_reflection.has_table` always returns ``False`` for temporary tables. Change-Id: I03ab04c849a157ce8fd28c07ec3bf4407b0f2c94
* Add support for Azure authentication optionsGord Thompson2020-09-171-1/+2
| | | | | Fixes: #5592 Change-Id: I0688e5ea0fc6b01a0b72f397daea8f57a2ec0766
* Don't change asyncpg's "char" codecMike Bayer2020-09-162-23/+12
| | | | | | | | | | | | | | This codec was used to ensure the "pg_attribute.generated" column comes back as a string and not bytes, matching how other PG drivers treat this datatype. However, this breaks asyncpg's internal implementation of set_type_codec going forward and the "char" datatype is actually a bytes in any case. So at the moment it appears psycopg2/pg8000 are broken for mis-treatment of the datatype and asyncpg is broken in that it was allowing us to change a codec that it appears to rely upon internally. Fixes: #5586 Change-Id: I937eba315904721aa4e2726b95432910a8affe5f
* Merge "Correct for SQL Server temp table owner"mike bayer2020-09-161-29/+39
|\
| * Correct for SQL Server temp table ownerMike Bayer2020-09-151-29/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | on my machine, the owner for a temp table comes out as dbo, and i am testing against a CI machine. im not sure what happens on a CI machine except perhaps that it provisions new databases is changing things. in any case, since we are searching the tempdb for the name, get the schema/owner also. Also refines the test to use a single connection and a transaction that rolls back, doesn't hang here but let's see what CI does. Change-Id: I522596ccc526cdab14c516b9a566ff666ac57dd6
* | Remove silent ignore for skip_locked w/ unsupported backendsGord Thompson2020-09-151-1/+1
|/ | | | | | | | | | | | | | | | | | | | | For SQLAlchemy 1.4: The "skip_locked" keyword used with ``with_for_update()`` will render "SKIP LOCKED" on all MySQL backends, meaning it will fail for MySQL less than version 8 and on current MariaDB backends. This is because those backends do not support "SKIP LOCKED" or any equivalent, so this error should not be silently ignored. This is upgraded from a warning in the 1.3 series. For SQLAlchemy 1.3: The "skip_locked" keyword used with ``with_for_update()`` will emit a warning when used on MariaDB backends, and will then be ignored. This is a deprecated behavior that will raise in SQLAlchemy 1.4, as an application that requests "skip locked" is looking for a non-blocking operation which is not available on those backends. Fixes: #5578 Change-Id: I49ccb6c6ff46eafed12b77f51e1da8e0e397966c
* Deprecate engine-wise ss cursors; repair mariadbconnectorMike Bayer2020-09-137-38/+63
| | | | | | | | | | | | | | | | | | | The server_side_cursors engine-wide feature relies upon regexp parsing of statements a well as general guessing as to when the feature should be used. This is not within the 2.0 way of doing things and should be removed. Additionally, mariadbconnector defaults to unbuffered cursors; add new cursor hooks so that mariadbconnector can specify buffered or unbuffered cursors without too much difficulty. This will also correctly default mariadbconnector to buffered cursors which should repair the segfaults we've been getting. Try to restore the assert_raises that was removed in 5b6dfc0c38bf1f01da4b8 to see if mariadbconnector segfaults are resolved. Change-Id: I77f1c972c742e40694972f578140bb0cac8c39eb
* Merge "Improve handling of covering indexes"mike bayer2020-09-122-9/+47
|\
| * Improve handling of covering indexesGord Thompson2020-09-122-9/+47
| | | | | | | | | | | | | | | | | | | | Improved support for covering indexes (with INCLUDE columns). Added the ability for postgresql to render CREATE INDEX statements with an INCLUDE clause from Core. Index reflection also report INCLUDE columns separately for both mssql and postgresql (11+). Fixes: #4458 Change-Id: If0b82103fbc898cdaeaf6a6d2d421c732744acd6
* | Merge "Do not specify type on mssql by default"mike bayer2020-09-123-18/+19
|\ \
| * | Do not specify type on mssql by defaultFederico Caselli2020-09-123-18/+19
| | | | | | | | | | | | | | | | | | | | | Make optional sequences render as identity in mssql Remove unused dialect option sequence_default_column_type Change-Id: I821eeffcb442f8d1b69186a9b798b15c3d8d6ff3
* | | Merge "Reflect mssql/postgresql filtered/partial indexes"mike bayer2020-09-122-10/+28
|\ \ \
| * | | Reflect mssql/postgresql filtered/partial indexesRamonWill2020-09-122-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for inspection / reflection of partial indexes / filtered indexes, i.e. those which use the ``mssql_where`` or ``postgresql_where`` parameters, with :class:`_schema.Index`. The entry is both part of the dictionary returned by :meth:`.Inspector.get_indexes` as well as part of a reflected :class:`_schema.Index` construct that was reflected. Pull request courtesy Ramon Williams. **Have a nice day!** Fixes: #4966 Closes: #5504 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5504 Pull-request-sha: b3018bac987081193b2e65cfdb6aeb7d5d270fcd Change-Id: Icbb2f93d1545700718ccb5222097185b815f5dbc
* | | | 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
|\