summaryrefslogtreecommitdiff
path: root/test/sql
Commit message (Collapse)AuthorAgeFilesLines
* Don't double-process ResultMetaData for BufferedColumnResultProxyMike Bayer2016-04-271-5/+47
| | | | | | | | | | | | | Fixed a bug in the result proxy used mainly by Oracle when binary and other LOB types are in play, such that when query / statement caching were used, the type-level result processors, notably that required by the binary type itself but also any other processor, would become lost after the first run of the statement due to it being removed from the cached result metadata. Change-Id: I751940866cffb4f48de46edc8137482eab59790c Fixes: #3699 (cherry picked from commit f3bc60bdd809235cbeb3f414717ac0e273269cf9)
* Fix result set handling for case insensitive dupe colsMike Bayer2016-04-211-0/+15
| | | | | | | | | | | | Fixed bug where when using ``case_sensitive=False`` with an :class:`.Engine`, the result set would fail to correctly accomodate for duplicate column names in the result set, causing an error when the statement is executed in 1.0, and preventing the "ambiguous column" exception from functioning in 1.1. Change-Id: If582bb9fdd057e4da3ae42f7180b17d1a1a2d98e Fixes: #3690 (cherry picked from commit 1f3e5d9826fe989f2212745f6b3592b2ef9b5e32)
* - move all resultproxy tests intio test_resultset, adapted fromMike Bayer2016-03-301-1/+311
| | | | 03d35a833cff68013781640b1192d079ab7e1154 in master (not cherry-picked)
* - Fixed bug where the negation of an EXISTS expression would notMike Bayer2016-03-212-0/+42
| | | | | | | | | be properly typed as boolean in the result, and also would fail to be anonymously aliased in a SELECT list as is the case with a non-negated EXISTS construct. fixes #3682 (cherry picked from commit 07a4b6cbcda6e6ee6e67893c5a5d2fd01e5f125f)
* - move out unconsumed names tests from test_compiler out to test_insert, ↵Mike Bayer2016-03-023-48/+62
| | | | | | | | | test_update - establish consistent names between existing unconsumed names tests and new ones added per ref #3666 (cherry picked from commit 6b7c207801d826db872aeda02e7c7b531df68034)
* Add test for inserting multiple valuesAthena Yao2016-03-021-0/+38
| | | | (cherry picked from commit a1de176d23ee03724ce269d143790686f862b400)
* - additional adjustment to the fix made in ↵Mike Bayer2016-02-211-0/+40
| | | | | | | | | | | | | 8ad968f33100baeb3b13c7e0b724b6b79ab4277f for ref #3657. The Oracle dialect makes more use of the "select_wraps_for" feature than SQL server because Oracle doesn't have "TOP" for a limit-only select, so tests are showing more happening here. In the case where the select() has some dupe columns, these are deduped from the .c collection so a positional match between the wrapper and original can't use .inner_columns, because these collections wont match. Using _columns_plus_names instead which is the deduped collection that determines the SELECT display, which definitely have to match up.
* - reworked the way the "select_wraps_for" expression isMike Bayer2016-02-202-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | handled within visit_select(); this attribute was added in the 1.0 series to accommodate the subquery wrapping behavior of SQL Server and Oracle while also working with positional column targeting and no longer relying upon "key fallback" in order to target columns in such a statement. The IBM DB2 third-party dialect also has this use case, but its implementation is using regular expressions to rewrite the textual SELECT only and does not make use of a "wrapped" select at this time. The logic no longer attempts to reconcile proxy set collections as this was not deterministic, and instead assumes that the select() and the wrapper select() match their columns postionally, at least for the column positions they have in common, so it is now very simple and safe. fixes #3657. - as a side effect of #3657 it was also revealed that the strategy of calling upon a ResultProxy._getter was not correctly calling into NoSuchColumnError when an expected column was not present, and instead returned None up to loading.instances() to produce NoneType failures; added a raiseerr argument to _getter() which is called when we aren't expecting None, fixes #3658. (cherry picked from commit 8ad968f33100baeb3b13c7e0b724b6b79ab4277f)
* - Fixed bug in :func:`.expression.text` construct where a double-colonMike Bayer2016-02-091-0/+11
| | | | | | | | expression would not escape properly, e.g. ``some\:\:expr``, as is most commonly required when rendering Postgresql-style CAST expressions. fixes #3644 (cherry picked from commit 29dcaa2b0ae2d26b36ec624be80f56e03ab9095e)
* - add literal_binds for delete() statements in addition to insert()/update()Mike Bayer2016-02-031-16/+25
| | | | | | | - move tests to CRUDTest - changelog, fixes #3643 (cherry picked from commit 150591f9e0a94902cb2a76b68ac7c9d8a1a3ec83)
* fix passing literal_binds flag through for update and insertTim Tate2016-02-031-0/+16
| | | | (cherry picked from commit c9b03fa8afd52646aba8c59fc038330eeee6db60)
* - Fixed issue where inadvertent use of the Python ``__contains__``Mike Bayer2016-02-021-1/+13
| | | | | | | | | | | override with a column expression (e.g. by using ``'x' in col``) would cause an endless loop in the case of an ARRAY type, as Python defers this to ``__getitem__`` access which never raises for this type. Overall, all use of ``__contains__`` now raises NotImplementedError. fixes #3642 (cherry picked from commit e0a580b3d055a600afae61840058a5a30ef5fe74)
* - rework ColumnCollection to no longer persist "all_col_set"; we don'tMike Bayer2016-01-261-0/+19
| | | | | | | | | | | | | | | need this collection except in the extend/update uses where we create it ad-hoc. simplifies pickling. Compatibility with 1.0 should be OK as ColumnColleciton uses __getstate__ in any case and the __setstate__ contract hasn't changed. - Fixed bug in :class:`.Table` metadata construct which appeared around the 0.9 series where adding columns to a :class:`.Table` that was unpickled would fail to correctly establish the :class:`.Column` within the 'c' collection, leading to issues in areas such as ORM configuration. This could impact use cases such as ``extend_existing`` and others. fixes #3632 (cherry picked from commit 8163de4cc9e01460d3476b9fb3ed14a5b3e70bae)
* - native unicode expectations are too difficult to maintainMike Bayer2016-01-231-60/+0
| | | | | | w/ the number of drivers /DBURIs / python versions (cherry picked from commit d18d6d9baf4c98c47af70c0a7c796423396a51c1)
* - add a forwards-test here as wellMike Bayer2016-01-211-0/+4
| | | | (cherry picked from commit 38958f7b3f3e6009c419ba8e021f2b14c1f2b89a)
* - documenation updates to clarify specific SQLite versionsMike Bayer2016-01-211-10/+20
| | | | | | | | | | | that have problems with right-nested joins and UNION column keys; references #3633 references #3634. backport from 1.1 to 0.9 announcing 1.1 as where these behaviors will be retired based on version-specific checks - fix test_resultset so that it passes when SQLite 3.10.0 is present, references #3633 (cherry picked from commit 89fa08792e98b9e31452aa3c949d9b909b10e7cd)
* - Fixed 1.0 regression where the eager fetch of cursor.rowcount wasMike Bayer2016-01-051-0/+17
| | | | | | | | | | no longer called for an UPDATE or DELETE statement emitted via plain text or via the :func:`.text` construct, affecting those drivers that erase cursor.rowcount once the cursor is closed such as SQL Server ODBC and Firebird drivers. fixes #3622 (cherry picked from commit 197ffa2be2cadce3df8bfb0799b3c80158250286)
* - add some more oracle skipsMike Bayer2015-12-141-0/+2
| | | | (cherry picked from commit c42725ed54a61d7e5a0931404ee83aa6b94d0aea)
* - Fixed bug in :meth:`.Update.return_defaults` which would cause allMike Bayer2015-12-141-0/+25
| | | | | | | | | | | | | | | | insert-default holding columns not otherwise included in the SET clause (such as primary key cols) to get rendered into the RETURNING even though this is an UPDATE. - Major fixes to the :paramref:`.Mapper.eager_defaults` flag, this flag would not be honored correctly in the case that multiple UPDATE statements were to be emitted, either as part of a flush or a bulk update operation. Additionally, RETURNING would be emitted unnecessarily within update statements. fixes #3609 (cherry picked from commit 0e4c4d7efc08d04c3c0ae960428b08ada37e4a91)
* - Fixed issue within the :meth:`.Insert.from_select` construct wherebyMike Bayer2015-12-091-0/+26
| | | | | | | | | | | | | the :class:`.Select` construct would have its ``._raw_columns`` collection mutated in-place when compiling the :class:`.Insert` construct, when the target :class:`.Table` has Python-side defaults. The :class:`.Select` construct would compile standalone with the erroneous column present subsequent to compilation of the :class:`.Insert`, and the the :class:`.Insert` statement itself would fail on a second compile attempt due to duplicate bound parameters. fixes #3603 (cherry picked from commit e57bf796169282f69187f50665f5ea233c2c9ab7)
* - Fixed bug where CREATE TABLE with a no-column table, but a constraintMike Bayer2015-12-011-1/+25
| | | | | | | | | such as a CHECK constraint would render an erroneous comma in the definition; this scenario can occur such as with a Postgresql INHERITS table that has no columns of its own. fixes #3598 (cherry picked from commit 9695faf32981406b12a6468b98d5c9b673f8e219)
* - Added support for parameter-ordered SET clauses in an UPDATEMike Bayer2015-11-281-0/+124
| | | | | | | | | | | | statement. This feature is available by passing the :paramref:`~.sqlalchemy.sql.expression.update.preserve_parameter_order` flag either to the core :class:`.Update` construct or alternatively adding it to the :paramref:`.Query.update.update_args` dictionary at the ORM-level, also passing the parameters themselves as a list of 2-tuples. Thanks to Gorka Eguileor for implementation and tests. adapted from pullreq github:200 (cherry picked from commit c90f0a49f332867f6b337c79ddf192299788667f)
* - fix bool testMike Bayer2015-09-271-1/+1
| | | | (cherry picked from commit 1704eacf24f803283033c172cb74b0fb4e9e36d8)
* - break out critical aspects of test_query into their own testsMike Bayer2015-09-273-1416/+1585
| | | | | | | finally, test_resultset and test_insert_exec. Update all idioms within these. (cherry picked from commit a8e1d33ae514a045d71d0a26d0c1325eecd4ca99)
* - Fixed regression in 1.0-released default-processor for multi-VALUESMike Bayer2015-08-312-16/+52
| | | | | | | | | | insert statement, :ticket:`3288`, where the column type for the default-holding column would not be propagated to the compiled statement in the case where the default was being used, leading to bind-level type handlers not being invoked. fixes #3520 (cherry picked from commit c39ff9978dbb77cbea4f1ee08234887d8aa1b165)
* - changelog for #3459, fixes #3459Mike Bayer2015-07-192-7/+2
| | | | | - test for .cast() method has no good place now except for test_cast in test_compiler.py
* Merge branch 'bb_issue_3459' of https://bitbucket.org/xflr6/sqlalchemy into pr56Mike Bayer2015-07-191-0/+7
|\
| * add ClauseElement.cast() shortcut-methodSebastian Bank2015-06-191-0/+7
| |
* | - Fixed regression where new methods on :class:`.ResultProxy` usedMike Bayer2015-07-191-2/+10
| | | | | | | | | | | | | | | | | | by the ORM :class:`.Query` object (part of the performance enhancements of :ticket:`3175`) would not raise the "this result does not return rows" exception in the case where the driver (typically MySQL) fails to generate cursor.description correctly; an AttributeError against NoneType would be raised instead. fixes #3481
* | - pg8000 very annoyingly complaining here, use total literalMike Bayer2015-07-191-1/+2
| |
* | - Fixed regression where :meth:`.ResultProxy.keys` would returnMike Bayer2015-07-191-5/+94
| | | | | | | | | | | | | | | | un-adjusted internal symbol names for "anonymous" labels, which are the "foo_1" types of labels we see generated for SQL functions without labels and similar. This was a side effect of the performance enhancements implemented as part of references #918. fixes #3483
* | - Fixed bug where coersion of literal ``True`` or ``False`` constantMike Bayer2015-07-191-0/+58
| | | | | | | | | | | | in conjunction with :func:`.and_` or :func:`.or_` would fail with an AttributeError. fixes #3490
* | - Fixed potential issue where a custom subclassMike Bayer2015-07-191-2/+14
| | | | | | | | | | | | | | of :class:`.FunctionElement` or other column element that incorrectly states 'None' or any other invalid object as the ``.type`` attribute will report this exception instead of recursion overflow. fixes #3485
* | - fix these two testsMike Bayer2015-07-171-2/+2
| |
* | Merge remote-tracking branch 'origin/pr/188' into pr188Mike Bayer2015-07-171-0/+3
|\ \
| * | Added test for modulo operator.pr/188Dan Gittik2015-07-171-0/+3
| |/
* | add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUEpr/186jakeogh2015-06-271-0/+6
| |
* | add NO MINVALUE and NO MAXVALUE support to Sequence()jakeogh2015-06-271-0/+12
| |
* | add MAXVALUE support to Sequence()jakeogh2015-06-271-1/+8
| |
* | add MINVALUE support to Sequence()jakeogh2015-06-271-0/+5
|/
* - Fixed a bug where clause adaption as applied to a :class:`.Label`Mike Bayer2015-06-091-0/+21
| | | | | | | | | | | | object would fail to accommodate the labeled SQL expression in all cases, such that any SQL operation that made use of :meth:`.Label.self_group` would use the original unadapted expression. One effect of this would be that an ORM :func:`.aliased` construct would not fully accommodate attributes mapped by :obj:`.column_property`, such that the un-aliased table could leak out when the property were used in some kinds of SQL comparisons. fixes #3445
* - Added official support for a CTE used by the SELECT presentMike Bayer2015-05-081-0/+35
| | | | | | | | | | | inside of :meth:`.Insert.from_select`. This behavior worked accidentally up until 0.9.9, when it no longer worked due to unrelated changes as part of :ticket:`3248`. Note that this is the rendering of the WITH clause after the INSERT, before the SELECT; the full functionality of CTEs rendered at the top level of INSERT, UPDATE, DELETE is a new feature targeted for a later release. fixes #3418
* - Fixed bug in enhanced constraint-attachment logic introduced inMike Bayer2015-05-021-0/+59
| | | | | | | | | | | :ticket:`3341` where in the unusual case of a constraint that refers to a mixture of :class:`.Column` objects and string column names at the same time, the auto-attach-on-column-attach logic will be skipped; for the constraint to be auto-attached in this case, all columns must be assembled on the target table up front. Added a new section to the migration document regarding the original feature as well as this change. fixes #3411
* - Fixed bug where the truncation of long labels in SQL could produceMike Bayer2015-04-281-22/+45
| | | | | | | | | | a label that overlapped another label that is not truncated; this because the length threshhold for truncation was greater than the portion of the label that remains after truncation. These two values have now been made the same; label_length - 6. The effect here is that shorter column labels will be "truncated" where they would not have been truncated before. fixes #3396
* - Fixed a regression that was incorrectly fixed in 1.0.0b4Mike Bayer2015-04-241-0/+13
| | | | | | | | | | | | | | | | | | (hence becoming two regressions); reports that SELECT statements would GROUP BY a label name and fail was misconstrued that certain backends such as SQL Server should not be emitting ORDER BY or GROUP BY on a simple label name at all; when in fact, we had forgotten that 0.9 was already emitting ORDER BY on a simple label name for all backends, as described in :ref:`migration_1068`, as 1.0 had rewritten this logic as part of :ticket:`2992`. In 1.0.2, the bug is fixed both that SQL Server, Firebird and others will again emit ORDER BY on a simple label name when passed a :class:`.Label` construct that is expressed in the columns clause, and no backend will emit GROUP BY on a simple label name in this case, as even Postgresql can't reliably do GROUP BY on a simple name in every case. fixes #3338, fixes #3385
* - Fixed support for "literal_binds" mode when using limit/offsetMike Bayer2015-04-231-3/+3
| | | | | | with Firebird, so that the values are again rendered inline when this is selected. Related to :ticket:`3034`. fixes #3381
* - repair a regression caused by #3282, where we no longer wereMike Bayer2015-04-221-78/+276
| | | | | | | | | | applying any topological sort to tables on SQLite. See the changelog for details, but we now continue to sort tables for SQLite on DROP, prohibit the sort from considering alter, and only warn if we encounter an unresolvable cycle, in which case, then we forego the ordering. use_alter as always is used to break such a cycle. fixes #3378
* - Fixed issue where a straight SELECT EXISTS query would fail toMike Bayer2015-04-202-4/+33
| | | | | | | | | | | | | | | | assign the proper result type of Boolean to the result mapping, and instead would leak column types from within the query into the result map. This issue exists in 0.9 and earlier as well, however has less of an impact in those versions. In 1.0, due to #918 this becomes a regression in that we now rely upon the result mapping to be very accurate, else we can assign result-type processors to the wrong column. In all versions, this issue also has the effect that a simple EXISTS will not apply the Boolean type handler, leading to simple 1/0 values for backends without native boolean instead of True/False. The fix includes that an EXISTS columns argument will be anon-labeled like other column expressions; a similar fix is implemented for pure-boolean expressions like ``not_(True())``. fixes #3372
* Merge remote-tracking branch 'origin/pr/163' into pr163Mike Bayer2015-04-126-9/+3
|\
| * PEP8 cleanup in /test/sqlEric Streeper2015-03-186-9/+3
| |