summaryrefslogtreecommitdiff
path: root/test/dialect
Commit message (Collapse)AuthorAgeFilesLines
...
| * Add MACCADDR8 for PGCompilerasimfarooq52022-12-191-0/+1
| | | | | | | | | | | | | | | | | | | | Add MACCADDR8 for PGCompiler Closes: #8393 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8393 Pull-request-sha: 837a68eba3e31e0acbb7c47ee87bca4e9def7648 Change-Id: I87e4999eb8d82662ff8ab409c98dc57edd7fd271
* | Merge "add explicit REGCONFIG, pg full text functions" into mainmike bayer2022-12-162-0/+284
|\ \
| * | add explicit REGCONFIG, pg full text functionsMike Bayer2022-12-152-0/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for explicit use of PG full text functions with asyncpg and psycopg (SQLAlchemy 2.0 only), with regards to the ``REGCONFIG`` type cast for the first argument, which previously would be incorrectly cast to a VARCHAR, causing failures on these dialects that rely upon explicit type casts. This includes support for :class:`_postgresql.to_tsvector`, :class:`_postgresql.to_tsquery`, :class:`_postgresql.plainto_tsquery`, :class:`_postgresql.phraseto_tsquery`, :class:`_postgresql.websearch_to_tsquery`, :class:`_postgresql.ts_headline`, each of which will determine based on number of arguments passed if the first string argument should be interpreted as a PostgreSQL "REGCONFIG" value; if so, the argument is typed using a newly added type object :class:`_postgresql.REGCONFIG` which is then explicitly cast in the SQL expression. Fixes: #8977 Change-Id: Ib36698a984fd4194bd6e0eb663105f790f3db7d3
* | | Fix equality comparison between a PG Range and a different class instanceLele Gaifax2022-12-151-0/+4
| |/ |/| | | | | | | | | | | | | | | | | This fixes issue #8984, making the method `Range.__eq__` return `NotImplemented` when the argument is an instance of a different class. Closes: #8985 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8985 Pull-request-sha: b8f601f038a2203af02a99ab190ebbc1c489549a Change-Id: Iaf0b651a22a9f346c8f18b3a53e3339bf61bb33f
* | check index_list pragma for number of columns returnedMike Bayer2022-12-131-0/+1
|/ | | | | | | | | | | Fixed regression caused by new support for reflection of partial indexes on SQLite added in 1.4.45 for :ticket:`8804`, where the ``index_list`` pragma command in very old versions of SQLite (possibly prior to 3.8.9) does not return the current expected number of columns, leading to exceptions raised when reflecting tables and indexes. Fixes: #8969 Change-Id: If317cdcfc6782f7e180df329b6ea0ddb48ce2269
* Oracle COLUMN_VALUE is a column name, not a keywordMike Bayer2022-12-072-7/+40
| | | | | | | | | Fixed issue in Oracle compiler where the syntax for :meth:`.FunctionElement.column_valued` was incorrect, rendering the name ``COLUMN_VALUE`` without qualifying the source table correctly. Fixes: #8945 Change-Id: Ia04bbdc68168e78b67a74bb3834a63f5d5000627
* sort materialize view names in testMike Bayer2022-12-061-1/+1
| | | | | | saw this fail on CI with views in reverse order Change-Id: I953f379f36924673a49b94cf5e7f54d071044113
* Merge "Add compatibility properties to Range; implement pep-484" into mainmike bayer2022-12-051-0/+18
|\
| * Add compatibility properties to Range; implement pep-484Lele Gaifax2022-12-051-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a bunch of properties to new PG Range class for compatibility with other implementations, providing a more similar API to access emptiness and bounds status. The naming conventions here derive from PostgreSQL itself, see https://www.postgresql.org/docs/9.3/functions-range.html . pep-484 also implemented by Mike, as this is a pretty type-intensive module. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Closes: #8927 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8927 Pull-request-sha: 8b9e7b7e3345673b43aeabd7ec88b88dc3cfa7eb Change-Id: I0b1d49311517ee1cc1377a974ed0a860ea5756e4
* | Rewrite positional handling, test for "numeric"Federico Caselli2022-12-052-3/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed how the positional compilation is performed. It's rendered by the compiler the same as the pyformat compilation. The string is then processed to replace the placeholders with the correct ones, and to obtain the correct order of the parameters. This vastly simplifies the computation of the order of the parameters, that in case of nested CTE is very hard to compute correctly. Reworked how numeric paramstyle behavers: - added support for repeated parameter, without duplicating them like in normal positional dialects - implement insertmany support. This requires that the dialect supports out of order placehoders, since all parameters that are not part of the VALUES clauses are placed at the beginning of the parameter tuple - support for different identifiers for a numeric parameter. It's for example possible to use postgresql style placeholder $1, $2, etc Added two new dialect based on sqlite to test "numeric" fully using both :1 style and $1 style. Includes a workaround for SQLite's not-really-correct numeric implementation. Changed parmstyle of asyncpg dialect to use numeric, rendering with its native $ identifiers Fixes: #8926 Fixes: #8849 Change-Id: I7c640467d49adfe6d795cc84296fc7403dcad4d6
* Merge "Fix positional compiling bugs" into mainmike bayer2022-12-022-6/+6
|\
| * Fix positional compiling bugsFederico Caselli2022-12-012-6/+6
| | | | | | | | | | | | | | | | | | | | | | Fixed a series of issues regarding positionally rendered bound parameters, such as those used for SQLite, asyncpg, MySQL and others. Some compiled forms would not maintain the order of parameters correctly, such as the PostgreSQL ``regexp_replace()`` function as well as within the "nesting" feature of the :class:`.CTE` construct first introduced in :ticket:`4123`. Fixes: #8827 Change-Id: I9813ed7c358cc5c1e26725c48df546b209a442cb
* | disable setinputsizes only for true DBAPI executemanyMike Bayer2022-12-011-61/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression caused by the combination of :ticket:`8177`, re-enable setinputsizes for SQL server unless fast_executemany + DBAPI executemany is used for a statement, along with :ticket:`6047`, implement "insertmanyvalues", which bypasses DBAPI executemany in place of a custom DBAPI execute for INSERT statements. setinputsizes would incorrectly not be used for a multiple parameter-set INSERT statement that used "insertmanyvalues" if fast_executemany were turned on, as the check would incorrectly assume this is a DBAPI executemany call. The "regression" would then be that the "insertmanyvalues" statement format is apparently slightly more sensitive to multiple rows that don't use the same types for each row, so in such a case setinputsizes is especially needed. The fix repairs the fast_executemany check so that it only disables setinputsizes if true DBAPI executemany is to be used. Fixes: #8917 Change-Id: I78895606a99848d4f92ecf38ded92dc5d6d48c6f
* | [sqlite] Reflect DEFERRABLE and INITIALLY options for foreign keysMichael Gorven2022-11-301-0/+59
|/ | | | | | | | | | | | | Added support for the SQLite backend to reflect the "DEFERRABLE" and "INITIALLY" keywords which may be present on a foreign key construct. Pull request courtesy Michael Gorven. Fixes: #8903 Closes: #8904 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8904 Pull-request-sha: 52aa4cf77482c4051899e21bea75b9830e4c3efa Change-Id: I713906db1a458d8f1be39625841ca3bbc03ec835
* Merge "Add value-level hooks for SQL type detection; apply to Range" into mainmike bayer2022-11-291-0/+21
|\
| * Add value-level hooks for SQL type detection; apply to RangeLele Gaifax2022-11-291-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added additional type-detection for the new PostgreSQL :class:`_postgresql.Range` type, where previous cases that allowed the psycopg2-native range objects to be received directly by the DBAPI without SQLAlchemy intercepting them stopped working, as we now have our own value object. The :class:`_postgresql.Range` object has been enhanced such that SQLAlchemy Core detects it in otherwise ambiguous situations (such as comparison to dates) and applies appropriate bind handlers. Pull request courtesy Lele Gaifax. Fixes: #8884 Closes: #8886 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8886 Pull-request-sha: 6e95e08a30597d3735ab38f2f1a2ccabd968852c Change-Id: I3ca277c826dcf4b5644f44eb251345b439a84ee4
* | Merge "add partial index predicate to SQLiteDialect.get_indexes() result" ↵mike bayer2022-11-291-0/+51
|\ \ | | | | | | | | | into main
| * | add partial index predicate to SQLiteDialect.get_indexes() resultTobias Pfeiffer2022-11-281-0/+51
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Added support for reflection of expression-oriented WHERE criteria included in indexes on the SQLite dialect, in a manner similar to that of the PostgreSQL dialect. Pull request courtesy Tobias Pfeiffer. Fixes: #8804 Closes: #8806 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8806 Pull-request-sha: 539dfcb372360911b69aed2a804698bb1a2220b1 Change-Id: I0e34d47dbe2b9c1da6fce531363084843e5127a3
* | Rectify PG Range.__bool__, inverting previous logicLele Gaifax2022-11-271-0/+4
|/ | | | | | | | | | The boolness of the range was defined to be equal to its emptiness. As this has been identified as a typo rather than the intended, this inverts the logic, to match common Python behaviour as well as how other popular PG drivers do. Closes: #8885 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8885 Pull-request-sha: 5670cdb920692a62f77b7b6ea312784033de83d9 Change-Id: I6f4a40168b2f037c578e84f7550370411bd42160
* Merge "Issue #8765: implement missing methods on PG Range" into mainmike bayer2022-11-171-41/+428
|\
| * Issue #8765: implement missing methods on PG RangeLele Gaifax2022-11-151-41/+428
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Description This PR implements missing methods on the PG `Range` class, as described by issue #8765. ### Checklist This pull request is: - [ ] A documentation / typographical error fix - [ ] A short code fix - [x] A new feature implementation Closes: #8766 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8766 Pull-request-sha: 21c0df86cc0d1502855527e29425fbffc3f45d64 Change-Id: I86fabd966ad1f14a3a86132be741df46965b9aa9
* | Merge "Try running pyupgrade on the code" into mainmike bayer2022-11-1722-133/+91
|\ \
| * | Try running pyupgrade on the codeFederico Caselli2022-11-1622-133/+91
| |/ | | | | | | | | | | | | | | command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>" pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not exists in sqlalchemy fixtures Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
* | accommodate NULL format_type()Mike Bayer2022-11-161-0/+31
|/ | | | | | | | | Made an adjustment to how the PostgreSQL dialect considers column types when it reflects columns from a table, to accommodate for alternative backends which may return NULL from the PG ``format_type()`` function. Fixes: #8748 Change-Id: I6178287aac567210a76afaa5805b825daa7fa4db
* add informative exception context for literal renderMike Bayer2022-11-141-2/+3
| | | | | | | | | | An informative re-raise is now thrown in the case where any "literal bindparam" render operation fails, indicating the value itself and the datatype in use, to assist in debugging when literal params are being rendered in a statement. Fixes: #8800 Change-Id: Id658f8b03359312353ddbb0c7563026239579f7b
* establish consistency for RETURNING column labelsMike Bayer2022-11-113-0/+90
| | | | | | | | | | | | | | | The RETURNING clause now renders columns using the routine as that of the :class:`.Select` to generate labels, which will include disambiguating labels, as well as that a SQL function surrounding a named column will be labeled using the column name itself. This is a more comprehensive change than a similar one made for the 1.4 series that adjusted the function label issue only. includes 1.4's changelog for the backported version which also fixes an Oracle issue independently of the 2.0 series. Fixes: #8770 Change-Id: I2ab078a214a778ffe1720dbd864ae4c105a0691d
* Merge "Implement contains_value(), issubset() and issuperset() on PG Range" ↵mike bayer2022-11-031-22/+248
|\ | | | | | | into main
| * Implement contains_value(), issubset() and issuperset() on PG RangeLele Gaifax2022-11-031-22/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new methods :meth:`_postgresql.Range.contains` and :meth:`_postgresql.Range.contained_by` to the new :class:`.Range` data object, which mirror the behavior of the PostgreSQL ``@>`` and ``<@`` operators, as well as the :meth:`_postgresql.AbstractRange.comparator_factory.contains` and :meth:`_postgresql.AbstractRange.comparator_factory.contained_by` SQL operator methods. Pull request courtesy Lele Gaifax. Fixes: #8706 Closes: #8707 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8707 Pull-request-sha: 3a74a0d93e63032ebee02992977498c717a077ff Change-Id: Ief81ca5c31448640b26dfbc3defd4dde1d51e366
* | use simple decimal query to detect decimal charMike Bayer2022-11-011-54/+57
|/ | | | | | | | | | | | Fixed issue where the ``nls_session_parameters`` view queried on first connect in order to get the default decimal point character may not be available depending on Oracle connection modes, and would therefore raise an error. The approach to detecting decimal char has been simplified to test a decimal value directly, instead of reading system views, which works on any backend / driver. Fixes: #8744 Change-Id: I39825131c13513798863197d0c180dd5a18b32dc
* Only convert Range for sqlalchemy Range objectMike Bayer2022-10-211-0/+34
| | | | | | | | | | Refined the new approach to range objects described at :ref:`change_7156` to accommodate driver-specific range and multirange objects, to better accommodate both legacy code as well as when passing results from raw SQL result sets back into new range or multirange expressions. Fixes: #8690 Change-Id: I7e62c47067f695c6380ad0fe2fe19deaf33594d1
* Merge "further qualify pyodbc setinputsizes types for long stirngs" into mainmike bayer2022-10-191-0/+167
|\
| * further qualify pyodbc setinputsizes types for long stirngsMike Bayer2022-10-181-0/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression caused by SQL Server pyodbc change :ticket:`8177` where we now use ``setinputsizes()`` by default; for VARCHAR, this fails if the character size is greater than 4000 (or 2000, depending on data) characters as the incoming datatype is NVARCHAR, which has a limit of 4000 characters, despite the fact that VARCHAR can handle unlimited characters. Additional pyodbc-specific typing information is now passed to ``setinputsizes()`` when the datatype's size is > 2000 characters. The change is also applied to the :class:`.JSON` type which was also impacted by this issue for large JSON serializations. Fixes: #8661 Change-Id: I07fa873e95dbd2c94f3d286e93e8b3229c3a9807
* | Revert automatic set of sequence start to 1Federico Caselli2022-10-173-5/+21
|/ | | | | | | | | | | | | | | | | The :class:`.Sequence` construct restores itself to the DDL behavior it had prior to the 1.4 series, where creating a :class:`.Sequence` with no additional arguments will emit a simple ``CREATE SEQUENCE`` instruction **without** any additional parameters for "start value". For most backends, this is how things worked previously in any case; **however**, for MS SQL Server, the default value on this database is ``-2**63``; to prevent this generally impractical default from taking effect on SQL Server, the :paramref:`.Sequence.start` parameter should be provided. As usage of :class:`.Sequence` is unusual for SQL Server which for many years has standardized on ``IDENTITY``, it is hoped that this change has minimal impact. Fixes: #7211 Change-Id: I1207ea10c8cb1528a1519a0fb3581d9621c27b31
* adjust MySQL view reflection for non-standard MySQL variantsJohn Bodley2022-10-031-2/+15
| | | | | | | | | | | | | | | | Adjusted the regular expression used to match "CREATE VIEW" when testing for views to work more flexibly, no longer requiring the special keyword "ALGORITHM" in the middle, which was intended to be optional but was not working correctly. The change allows view reflection to work more completely on MySQL-compatible variants such as StarRocks. Pull request courtesy John Bodley. Fixes: #8588 Closes: #8589 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8589 Pull-request-sha: d85b2c5b51e45cec543c9ae9d62d6d659b063354 Change-Id: I173137f0bf68639cad0d5c329055475b40ddb5e4
* Merge "`aggregate_order_by` now supports cache generation." into mainmike bayer2022-09-261-0/+33
|\
| * `aggregate_order_by` now supports cache generation.Federico Caselli2022-09-251-0/+33
| | | | | | | | | | | | | | | | | | also adjusted CacheKeyFixture to be a general purpose fixture so that sub-components / dialects can run their own cache key tests. Fixes: #8574 Change-Id: I6c66107856aee11e548d357cea77bceee3e316a0
* | implement batched INSERT..VALUES () () for executemanyMike Bayer2022-09-243-428/+29
|/ | | | | | | | | | | | | | | | | | | | the feature is enabled for all built in backends when RETURNING is used, except for Oracle that doesn't need it, and on psycopg2 and mssql+pyodbc it is used for all INSERT statements, not just those that use RETURNING. third party dialects would need to opt in to the new feature by setting use_insertmanyvalues to True. Also adds dialect-level guards against using returning with executemany where we dont have an implementation to suit it. execute single w/ returning still defers to the server without us checking. Fixes: #6047 Fixes: #7907 Change-Id: I3936d3c00003f02e322f2e43fb949d0e6e568304
* Tighten password security by removing `URL.__str__`Yassen Damyanov2022-09-231-1/+1
| | | | | | | | | | | | | | | For improved security, the :class:`_url.URL` object will now use password obfuscation by default when ``str(url)`` is called. To stringify a URL with cleartext password, the :meth:`_url.URL.render_as_string` may be used, passing the :paramref:`_url.URL.render_as_string.hide_password` parameter as ``False``. Thanks to our contributors for this pull request. Fixes: #8567 Closes: #8563 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8563 Pull-request-sha: d1f1127f753849eb70b8d6cc64badf34e1b9219b Change-Id: If756c8073ff99ac83876d9833c8fe1d7c76211f9
* auto-cast PG range typesMike Bayer2022-09-201-0/+89
| | | | | | | | | | Range type handling has been enhanced so that it automatically renders type casts, so that in-place round trips for statements that don't provide the database with any context don't require the :func:`_sql.cast` construct to be explicit for the database to know the desired type. Change-Id: Id630b726f8a23059dd2f4cbc410bf5229d89cbfb References: #8540
* Improve array_agg and Array processingFederico Caselli2022-09-171-0/+43
| | | | | | | | | The :class:`_functions.array_agg` will now set the array dimensions to 1. Improved :class:`_types.ARRAY` processing to accept ``None`` values as value of a multi-array. Fixes: #7083 Change-Id: Iafec4f77fde9719ccc7c8535bf6235dbfbc62102
* Merge "Support GROUP BY ROLLUP on MySql/MariaDB" into mainmike bayer2022-09-161-0/+7
|\
| * Support GROUP BY ROLLUP on MySql/MariaDBFederico Caselli2022-09-091-0/+7
| | | | | | | | | | | | | | | | | | The ``ROLLUP`` function will now correctly render ``WITH ROLLUP`` on MySql and MariaDB, allowing the use of group by rollup with these backend. Fixes: #8503 Change-Id: I9289af3a39ca667a2f0f84f73346ebd4b091fedd
* | catch exception for system_views alsoMike Bayer2022-09-151-3/+30
|/ | | | | | | | | | | | Fixed yet another regression in SQL Server isolation level fetch (see :ticket:`8231`, :ticket:`8475`), this time with "Microsoft Dynamics CRM Database via Azure Active Directory", which apparently lacks the ``system_views`` view entirely. Error catching has been extended that under no circumstances will this method ever fail, provided database connectivity is present. Fixes: #8525 Change-Id: I76a429e3329926069a0367d2e77ca1124b9a059d
* Fix Azure Synapse connection errorGord Thompson2022-09-021-1/+19
| | | | | | | | | | Fixed regression caused by the fix for :ticket:`8231` released in 1.4.40 where connection would fail if the user does not have permission to query the dm_exec_sessions or dm_pdw_nodes_exec_sessions system view when trying to determine the current transaction isolation level. Fixes: #8475 Change-Id: Ie2bcda92f2ef2d12360ddda47eb6e896313c71f2
* Merge "include mssql_clustered dialect_options when reflecting - issue ↵mike bayer2022-08-241-1/+157
|\ | | | | | | #8288" into main
| * include mssql_clustered dialect_options when reflecting - issue #8288John Lennox2022-08-231-1/+157
| | | | | | | | | | | | | | | | | | | | | | | | Implemented reflection of the "clustered index" flag ``mssql_clustered`` for the SQL Server dialect. Pull request courtesy John Lennox. Fixes: #8288 Closes: #8289 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8289 Pull-request-sha: 1bb57352e3e31d8fb7de69ab5e60e5464949f640 Change-Id: Ife367066328f9e47ad823e4098647964a18e21e8
* | Merge "support create/drop events for all CREATE/DROP" into mainmike bayer2022-08-221-0/+75
|\ \ | |/ |/|
| * support create/drop events for all CREATE/DROPMike Bayer2022-08-201-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | Implemented the DDL event hooks :meth:`.DDLEvents.before_create`, :meth:`.DDLEvents.after_create`, :meth:`.DDLEvents.before_drop`, :meth:`.DDLEvents.after_drop` for all :class:`.SchemaItem` objects that include a distinct CREATE or DROP step, when that step is invoked as a distinct SQL statement, including for :class:`.ForeignKeyConstraint`, :class:`.Sequence`, :class:`.Index`, and PostgreSQL's :class:`_postgresql.ENUM`. Fixes: #8394 Change-Id: Iee6274984e794f50103451a04d089641d6ac443a
* | Merge "JSONPATH type can be used in casts in PostgreSQL" into mainmike bayer2022-08-172-13/+44
|\ \
| * | JSONPATH type can be used in casts in PostgreSQLFederico Caselli2022-08-172-13/+44
| |/ | | | | | | | | | | | | | | | | | | Introduced the type :class:`_postgresql.JSONPATH` that can be used in cast expressions. This is required by some PostgreSQL dialects when using functions such as ``jsonb_path_exists`` or ``jsonb_path_match`` that accept a ``jsonpath`` as input. Fixes: #8216 Change-Id: I3e7337eab91680cab1604e1f3058854a0a19c5be