summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - flake8 for lib passesMike Bayer2019-01-053-6/+5
| | | | Change-Id: I0d7f5105f838a0275f3c240441bdcdc9ae7444d0
* flake8 refactor - dialectsMike Bayer2019-01-052-0/+3
| | | | | | | | | | | | A full rewrite of all imports and pep8 formatting using zimports, black, commits are broken into sections. Directories included in this commit: lib/sqlalchemy/dialects/ lib/sqlalchemy/databases/ lib/sqlalchemy/connectors/ Change-Id: I7070d589303a760e6ed5eefde39efc11da818281 (cherry picked from commit aa46e6a9e2e3cd04f835c53ed4600e6f8e9ee13f)
* flake8 refactor - ormMike Bayer2019-01-051-0/+3
| | | | | | | | | | | | A full rewrite of all imports and pep8 formatting using zimports, black, commits are broken into sections. Directories included in this commit: lib/sqlalchemy/orm/ Change-Id: Iad6a2e4a03a5bbfd5d68d174284aaabe69e2760a (cherry picked from commit 7eeed1cbb97b9b08bf74739a3b02d672d1858249)
* flake8 refactor - coreMike Bayer2019-01-0515-174/+304
| | | | | | | | | | | | A full rewrite of all imports and pep8 formatting using zimports, black, commits are broken into sections. Directories included in this commit: lib/sqlalchemy/sql/ Change-Id: Ia994322c398c55aaa01d11d21cb74f1d50ab683f (cherry picked from commit 0ae1a3ab57727b798da78befa1ee40537ae95b69)
* - do a broken zimports run on libMike Bayer2019-01-0519-404/+298
|
* step 1, straight black -l 79 runMike Bayer2019-01-0519-3116/+4593
| | | | includes adjustment to setup.py to recognize __version__ correctly
* commit 1b774808c926665047bf353222ecd191679a95d1Lele Gaifax2018-12-301-4/+4
| | | | | | | | | | | | | | | | Author: Lele Gaifax <lele@metapensiero.it> Date: Tue Dec 25 12:35:41 2018 +0100 Consistently use "PostgreSQL", fixing also a few doc glitches commit 0e382aaee4427193926f0dc10ad29056bc12c85e Author: Lele Gaifax <lele@metapensiero.it> Date: Tue Dec 25 12:08:49 2018 +0100 Remove duplicated words Change-Id: Iaa586b9412f46a50fe6ff3bbb92e07d6cb1905c8 (cherry picked from commit c0f9708fde39175c8695fdd87873464f516fdf98)
* Rewrite the convert_unicode docs and add tons of dragonsMike Bayer2018-12-211-22/+36
| | | | | | | | These flags will all be going away as Python 3 has solved all of this. Change-Id: I4f581d8dd7826dd823b671d0d8e72250284236c8 (cherry picked from commit 7f12f63c3a8c77715135126aac88ac6055b279c0)
* typoRaphael2018-11-301-1/+1
| | | | | | typo (cherry picked from commit 0a0b36686d5da0e7d04974c8df0ece574b71f3cb)
* Add missing spacewodim2018-10-301-1/+1
|
* Import from collections.abcxtreak2018-09-272-4/+3
| | | | | | | | | | | | | | | Fixed additional warnings generated by Python 3.7 due to changes in the organization of the Python ``collections`` and ``collections.abc`` packages. Previous ``collections`` warnings were fixed in version 1.2.11. Pull request courtesy xtreak. See I2d1c0ef97c8ecac7af152cc56263422a40faa6bb for the original collections.abc fixes. Fixes: #4339 Change-Id: Ia92d2461f20309fb33ea6c6f592f7d4e7e32ae7a Pull-request: https://github.com/zzzeek/sqlalchemy/pull/475 (cherry picked from commit 2d2fa49130249f757f6f1100dad879e1071ad385)
* Copy create_constraint flag for EnumMike Bayer2018-09-251-1/+1
| | | | | | | | | | Fixed bug where the :paramref:`.Enum.create_constraint` flag on the :class:`.Enum` datatype would not be propagated to copies of the type, which affects use cases such as declarative mixins and abstract bases. Fixes: #4341 Change-Id: I978be65f33a616fe4d5f5de03fb3eaab6f6a2272 (cherry picked from commit 0737f45d4ff8fdb2e12972cc58c18345e4d6dde2)
* Allow dialects to customize group by clause compilationSamuel Chou2018-09-201-9/+13
| | | | | | | | | | | | Refactored :class:`.SQLCompiler` to expose a :meth:`.SQLCompiler.group_by_clause` method similar to the :meth:`.SQLCompiler.order_by_clause` and :meth:`.SQLCompiler.limit_clause` methods, which can be overridden by dialects to customize how GROUP BY renders. Pull request courtesy Samuel Chou. Change-Id: I0a7238e55032558c27a0c56a72907c7b883456f1 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/474 (cherry picked from commit 33fccc486111fc6b41eab651cc7325c83099ad45)
* Adapt right side in join if lateral detectedMike Bayer2018-09-181-1/+3
| | | | | | | | | | | | Fixed bug where use of :class:`.Lateral` construct in conjunction with :meth:`.Query.join` as well as :meth:`.Query.select_entity_from` would not apply clause adaption to the right side of the join. "lateral" introduces the use case of the right side of a join being correlatable. Previously, adaptation of this clause wasn't considered. Fixes: #4334 Change-Id: I3631e562092769d30069a2aa5e50a580f4661a23 (cherry picked from commit 43f2c66ea7413cc0aaf6ca040ad33fb65ca4412d)
* document expanding bound parameters, in_(), and baked query use casesMike Bayer2018-08-272-12/+77
| | | | | | cherry-picked from 90a772b19339b97517bc46f016122341528e440a with modifications Change-Id: I09ccd73ebabbea4b5098ba5b170786ac065444c8
* Update expanding docsMike Bayer2018-08-271-4/+3
| | | | | | | - no longer experimental - will support empty param sets in 1.3 Change-Id: I06c69cc44dfb2b5449ace8c14dc0e12f2af25c64
* Pass desired array type from pg.array_agg to functions.array_aggMike Bayer2018-08-221-1/+2
| | | | | | | | | | | | Fixed the :func:`.postgresql.array_agg` function, which is a slightly altered version of the usual :func:`.functions.array_agg` function, to also accept an incoming "type" argument without forcing an ARRAY around it, essentially the same thing that was fixed for the generic function in 1.1 in :ticket:`4107`. Fixes: #4324 Change-Id: I399a29f59c945a217cdd22c65ff0325edea8ea65 (cherry picked from commit 52a3f5b7635583ae6feb084b1db654b9c65caec2)
* Add missing range_ / rows parameters to additional over() methodsMike Bayer2018-08-191-4/+8
| | | | | | | | | | | | | Added missing window function parameters :paramref:`.WithinGroup.over.range_` and :paramref:`.WithinGroup.over.rows` parameters to the :meth:`.WithinGroup.over` and :meth:`.FunctionFilter.over` methods, to correspond to the range/rows feature added to the "over" method of SQL functions as part of :ticket:`3049` in version 1.1. Fixes: #4322 Change-Id: I77dcdac65c699a4b52a3fc3ee09a100ffb4fc20e (cherry picked from commit 3e2f61c439dab76133a49b7a16b03bf4071d4c4c)
* Add concept of "implicit boolean", treat as nativeMike Bayer2018-08-164-2/+32
| | | | | | | | | | | | | | | | Fixed issue that is closely related to :ticket:`3639` where an expression rendered in a boolean context on a non-native boolean backend would be compared to 1/0 even though it is already an implcitly boolean expression, when :meth:`.ColumnElement.self_group` were used. While this does not affect the user-friendly backends (MySQL, SQLite) it was not handled by Oracle (and possibly SQL Server). Whether or not the expression is implicitly boolean on any database is now determined up front as an additional check to not generate the integer comparison within the compliation of the statement. Fixes: #4320 Change-Id: Iae0a65e5c01bd576e64733c3651e1e1a1a1b240c (cherry picked from commit 462ccd9ff18d2e428b20ec3f596391a275472140)
* Include UPDATE/DELETE extra_froms in correlationMike Bayer2018-08-041-12/+15
| | | | | | | | | | | | | | | | | | Fixed bug where the multi-table support for UPDATE and DELETE statements did not consider the additional FROM elements as targets for correlation, when a correlated SELECT were also combined with the statement. This change now includes that a SELECT statement in the WHERE clause for such a statement will try to auto-correlate back to these additional tables in the parent UPDATE/DELETE or unconditionally correlate if :meth:`.Select.correlate` is used. Note that auto-correlation raises an error if the SELECT statement would have no FROM clauses as a result, which can now occur if the parent UPDATE/DELETE specifies the same tables in its additional set of tables ; specify :meth:`.Select.correlate` explicitly to resolve. Change-Id: Ie11eaad7e49af3f59df11691b104d6359341bdae Fixes: #4313 (cherry picked from commit abeea1d82db34232bbef01e98fa4d1de0f583eb6)
* Drop default-related structures after the Table is dropped.Mike Bayer2018-07-101-5/+11
| | | | | | | | | | | | | Fixed bug where a :class:`.Sequence` would be dropped explicitly before any :class:`.Table` that refers to it, which breaks in the case when the sequence is also involved in a server-side default for that table, when using :meth:`.MetaData.drop_all`. The step which processes sequences to be dropped via non server-side column default functions is now invoked after the table itself is dropped. Change-Id: I185f2cc76d2011ad4dd3ba9bde5d8aef0ec335ae Fixes: #4300 (cherry picked from commit 532566ba1f28ff8a6afa6eacc10c59eb918501f6)
* Merge "Support JOIN in UPDATE..FROM" into rel_1_2mike bayer2018-06-251-4/+13
|\
| * Support JOIN in UPDATE..FROMMike Bayer2018-06-241-4/+13
| | | | | | | | | | | | | | | | | | | | | | The :class:`.Update` construct now accommodates a :class:`.Join` object as supported by MySQL for UPDATE..FROM. As the construct already accepted an alias object for a similar purpose, the feature of UPDATE against a non-table was already implied so this has been added. Change-Id: I7b2bca627849384d5377abb0c94626463e4fad04 Fixes: #3645 (cherry picked from commit 58540ae93db30fb12f331587c32bb2d76db79ab3)
* | Merge "render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL" ↵mike bayer2018-06-241-2/+7
|\ \ | |/ |/| | | into rel_1_2
| * render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQLMike Bayer2018-06-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed INSERT FROM SELECT with CTEs for the Oracle and MySQL dialects, where the CTE was being placed above the entire statement as is typical with other databases, however Oracle and MariaDB 10.2 wants the CTE underneath the "INSERT" segment. Note that the Oracle and MySQL dialects don't yet work when a CTE is applied to a subquery inside of an UPDATE or DELETE statement, as the CTE is still applied to the top rather than inside the subquery. Also adds test suite support CTEs against backends. Change-Id: I8ac337104d5c546dd4f0cd305632ffb56ac8bf90 Fixes: #4275 Fixes: #4230 (cherry picked from commit 3619edcb8aa3ceef2a44925b85315fc0e90c5982)
* | Lookup index columns in parent table by key for copyMike Bayer2018-06-141-1/+2
|/ | | | | | | | | | | | | | Fixed regression in 1.2 due to :ticket:`4147` where a :class:`.Table` that has had some of its indexed columns redefined with new ones, as would occur when overriding columns during reflection or when using :paramref:`.Table.extend_existing`, such that the :meth:`.Table.tometadata` method would fail when attempting to copy those indexes as they still referred to the replaced column. The copy logic now accommodates for this condition. Change-Id: I521aa2c9f3baa0e84598bbdd6ffe4bf07b6e3ba8 Fixes: #4279 (cherry picked from commit 8f7766cc61479f3c9220c640230eeecd3d49ccc8)
* Turn oracle BINARY_DOUBLE, BINARY_FLOAT, DOUBLE_PRECISION into floatsMike Bayer2018-05-251-1/+23
| | | | | | | | | | | | | | | | | | The Oracle BINARY_FLOAT and BINARY_DOUBLE datatypes now participate within cx_Oracle.setinputsizes(), passing along NATIVE_FLOAT, so as to support the NaN value. Additionally, :class:`.oracle.BINARY_FLOAT`, :class:`.oracle.BINARY_DOUBLE` and :class:`.oracle.DOUBLE_PRECISION` now subclass :class:`.Float`, since these are floating point datatypes, not decimal. These datatypes were already defaulting the :paramref:`.Float.asdecimal` flag to False in line with what :class:`.Float` already does. Added reflection capabilities for the :class:`.oracle.BINARY_FLOAT`, :class:`.oracle.BINARY_DOUBLE` datatypes. Change-Id: Id99b912e83052654a17d07dc92b4dcb958cb7600 Fixes: #4264 (cherry picked from commit 28c7450b61beeb0bfb3d082cfcd12493c182e0ee)
* Fix string formatting TypeError if tuple is passedMiguel Ventura2018-05-171-1/+1
| | | | | | | | | | | Fixed issue where the "ambiguous literal" error message used when interpreting literal values as SQL expression values would encounter a tuple value, and fail to format the message properly. Pull request courtesy Miguel Ventura. Change-Id: I50d5d32d5f80ec79703a42d4b19b42c2f9701f24 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/442 (cherry picked from commit 0b0b58c938c6a38fccc3e0ba59876b3b6b4f8009)
* SQL Server is not native boolean; add new flag for CHECK constraintMike Bayer2018-05-101-1/+2
| | | | | | | | | | | | | | | Fixed a 1.2 regression caused by :ticket:`4061` where the SQL Server "BIT" type would be considered to be "native boolean". The goal here was to avoid creating a CHECK constraint on the column, however the bigger issue is that the BIT value does not behave like a true/false constant and cannot be interpreted as a standalone expression, e.g. "WHERE <column>". The SQL Server dialect now goes back to being non-native boolean, but with an extra flag that still avoids creating the CHECK constraint. Change-Id: I4765d2a2a00b0d14f50282603cc4d48d4739dac1 Fixes: #4250 (cherry picked from commit bd1d6012dcbe5fbc6d1097a79d85b972b0d4fd8a)
* Ensure all visit_sequence accepts **kw argsMike Bayer2018-04-041-1/+1
| | | | | | | | | | | Fixed issue where the compilation of an INSERT statement with the "literal_binds" option that also uses an explicit sequence and "inline" generation, as on Postgresql and Oracle, would fail to accommodate the extra keyword argument within the sequence processing routine. Change-Id: Ibdab7d340aea7429a210c9535ccf1a3e85f074fb Fixes: #4231 (cherry picked from commit b4eb29253cb29a069973503f36d1103d4a18311c)
* Track if we're rendering within the CTE recursivelyMike Bayer2018-03-141-1/+9
| | | | | | | | | | | Fixed a regression that occurred from the previous fix to :ticket:`4204` in version 1.2.5, where a CTE that refers to itself after the :meth:`.CTE.alias` method has been called would not refer to iself correctly. Change-Id: Iaa63d65ad2b90c8693f9953fbb32dbb10c73a037 Fixes: #4204 (cherry picked from commit ef2859bbc8bb8104bf4e429a52efb50a712d834a)
* Clone _cte_alias instead of assigning "self"Mike Bayer2018-03-051-1/+1
| | | | | | | | | | | Fixed bug in :class:.`CTE` construct along the same lines as that of :ticket:`4204` where a :class:`.CTE` that was aliased would not copy itself correctly during a "clone" operation as is frequent within the ORM as well as when using the :meth:`.ClauseElement.params` method. Change-Id: Id68d72dd244dedfc7bd6116c9a5123c51a55ea20 Fixes: #4210 (cherry picked from commit 9a13f007e2342def94cc7362eeadd5ec8c988340)
* Check existing CTE for an alias name when rendering FROM clauseMike Bayer2018-03-021-50/+56
| | | | | | | | | | | Fixed bug in CTE rendering where a :class:`.CTE` that was also turned into an :class:`.Alias` would not render its "ctename AS aliasname" clause appropriately if there were more than one reference to the CTE in a FROM clause. Change-Id: If8cff27a2f4faa5eceb59aa86398db6edb3b9e72 Fixes: #4204 (cherry picked from commit 5f60dc649cde2525f5eb1e7008a75304603b751c)
* Quote cte alias if neededEric Atkin2018-02-221-0/+2
| | | | | | | | | | Fixed bug where CTE expressions would not have their name or alias name quoted when the given name is case sensitive or otherwise requires quoting. Pull request courtesy Eric Atkin. Fixes: #4197 Change-Id: Ib8573e82b9a1ca94b50c7c5d73ee98b79465d689 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/426
* Add values_callable feature to EnumJon Snyder2018-02-071-2/+22
| | | | | | | | | | | | Added support for :class:`.Enum` to persist the values of the enumeration, rather than the keys, when using a Python pep-435 style enumerated object. The user supplies a callable function that will return the string values to be persisted. This allows enumerations against non-string values to be value-persistable as well. Pull request courtesy Jon Snyder. Pull-request: https://github.com/zzzeek/sqlalchemy/pull/410 Fixes: #3906 Change-Id: Id385465d215d1e5baaad68368b168afdd846b82c
* fix handling of native enum aliases in sqlalchemy enum columnsDaniel Knell2018-02-051-5/+8
| | | | | | | | | | Fixed bug where the :class:`.Enum` type wouldn't handle enum "aliases" correctly, when more than one key refers to the same value. Pull request courtesy Daniel Knell. Fixes: #4180 Change-Id: Ia716c00ca6c67aeab56965f0fdd575ecb7c71416 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/420
* Merge "Make column-level collation quoting dialect-specific"mike bayer2018-01-122-2/+20
|\
| * Make column-level collation quoting dialect-specificMike Bayer2018-01-122-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression in 1.2 where newly repaired quoting of collation names in :ticket:`3785` breaks SQL Server, which explicitly does not understand a quoted collation name. Whether or not mixed-case collation names are quoted or not is now deferred down to a dialect-level decision so that each dialect can prepare these identifiers directly. Change-Id: Iaf0a8123d9bf4711219e320896bb28c5d2649304 Fixes: #4154
* | happy new yearMike Bayer2018-01-1219-19/+19
| | | | | | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* | `ValuesBase.values` inconsistency fixAubrey Stark-Toller2018-01-121-17/+22
|/ | | | | | | | | | Fixed bug in :meth:`.Insert.values` where using the "multi-values" format in combination with :class:`.Column` objects as keys rather than strings would fail. Pull request courtesy Aubrey Stark-Toller. Change-Id: I9d3b40b5950df8f5bfdc8b1d22f9c3afb277f17f Pull-request: https://github.com/zzzeek/sqlalchemy/pull/412 Fixes: #4162
* Merge "Implement an error lookup"mike bayer2017-12-271-5/+5
|\
| * Implement an error lookupMike Bayer2017-12-271-5/+5
| | | | | | | | | | | | | | | | Add codes to commonly raised error messages and classes that link back to fixed documentation sections giving background on these messages. Change-Id: I78d0660add7026bb662e20305a59283b20616954
* | - call this 1.2.0Mike Bayer2017-12-261-3/+3
|/ | | | Change-Id: If8d60e5d44f387eba97fd9bb1dfa85947ce7f42f
* Fully copy index expressionsMike Bayer2017-12-141-16/+28
| | | | | | | | | | | | | | | | | Fixed bug where the :meth:`.Table.tometadata` method would not properly accommodate :class:`.Index` objects that didn't consist of simple column expressions, such as indexes against a :func:`.text` construct, indexes that used SQL expressions or :attr:`.func`, etc. The routine now copies expressions fully to a new :class:`.Index` object while substituting all table-bound :class:`.Column` objects for those of the target table. Also refined the means by which tometadata() checks if an Index or UniqueConstraint is generated by a column-level flag, by propagating an attribute "_column_flag=True" to such indexes/constraints. Change-Id: I7ef1b8ea42f9933357ae35f241a5ba9838bac35b Fixes: #4147
* Merge "Change visit name for ColumnElement"mike bayer2017-12-071-1/+1
|\
| * Change visit name for ColumnElementMike Bayer2017-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | No SQLA built-in subclasses ColumnElement without specifying an alternate visit_name, and user defined ColumnElement subclasses should avoid being treated like ColumnClause, e.g. where a Table is present. Fixes: #4142 Change-Id: I15ed09ba8bdebae4cb0c7e5e5df3f59351477577
* | Merge "Allow delete where clause to refer multiple tables."mike bayer2017-12-062-9/+86
|\ \
| * | Allow delete where clause to refer multiple tables.inytar2017-12-052-9/+86
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented "DELETE..FROM" syntax for Postgresql, MySQL, MS SQL Server (as well as within the unsupported Sybase dialect) in a manner similar to how "UPDATE..FROM" works. A DELETE statement that refers to more than one table will switch into "multi-table" mode and render the appropriate "USING" or multi-table "FROM" clause as understood by the database. Pull request courtesy Pieter Mulder. For SQL syntaxes see: Postgresql: https://www.postgresql.org/docs/current/static/sql-delete.html MySQL: https://dev.mysql.com/doc/refman/5.7/en/delete.html#multiple-table_syntax MSSQL: https://docs.microsoft.com/en-us/sql/t-sql/statements/delete-transact-sql Sybase: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00801.1510/html/iqrefso/X315721.htm Co-authored by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I6dfd57b49e44a095d076dc493cd2360bb5d920d3 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/392 Fixes: #959
* | Propagate attachment events for ARRAYMike Bayer2017-12-041-0/+2
|/ | | | | | | | | | | | Fixed regression in :class:`.ARRAY` datatype caused by :ticket:`3964`, which is essentially the same issue as that of :ticket:`3832`, where column attachment events for :class:`.ARRAY` would not be invoked. This breaks the use case of using declarative mixins that declare a :class:`.Column` which makes use of :meth:`.MutableList.as_mutable`. Change-Id: If8c57615860883837f6cf72661e46180a77778c1 Fixes: #4141
* add nullsfirst() / nullslast() to top-level importsLele Gaifax2017-11-161-0/+2
| | | | | Change-Id: Ieefcc4c30c1c17f43f2908d961e00815bae862bb Pull-request: https://github.com/zzzeek/sqlalchemy/pull/378