summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* raise error on empty in_pr/282erebus12016-06-051-0/+1
|
* Fix label referencing in SQL Server OFFSET logicMike Bayer2016-05-101-0/+10
| | | | | | | | | | | Fixed bug where by ROW_NUMBER OVER clause applied for OFFSET selects in SQL Server would inappropriately substitute a plain column from the local statement that overlaps with a label name used by the ORDER BY criteria of the statement. Change-Id: Ic2500c886cbfc83a1ad5a2681783f008b9f23838 Fixes: #3711 (cherry picked from commit a4be7c92393e08607dc46f318e97803519052a93)
* Repair _orm_columns() to accommodate text()Mike Bayer2016-05-051-0/+2
| | | | | | | | | | Fixed bug whereby passing a :func:`.text` construct to the :meth:`.Query.group_by` method would raise an error, instead of intepreting the object as a SQL fragment. Change-Id: I5fc2f590b76508d52e23b5fa9cf037ddea8080c3 fixes: #3706 (cherry picked from commit 9bdd6f2b1f6b34a82b77849ec05811aa0279931d)
* Adds parentheses around prints in documentationjfinkels2016-04-271-7/+7
| | | | | This makes the docstring example code compatible with both Python 2 and Python 3. (cherry picked from commit 8aa7369125f831a74c9f024ce5dde73ecf812e63)
* - Fixed bug where the negation of an EXISTS expression would notMike Bayer2016-03-212-1/+13
| | | | | | | | | 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)
* Raise exception when we have multiple values with an unknown column. Fixes ↵Athena Yao2016-03-021-1/+1
| | | | | | #3666. (cherry picked from commit 399f92cd116b747f742b919ac9a3e79eb0637e8a)
* - unfortunately calling upon "_label" here makes it unclear ifMike Bayer2016-02-261-2/+4
| | | | | we're trying to hit columns without names yet and such, to suit the bug right now just make it specific to FunctionElement
* - Anonymous labeling is applied to a :attr:`.func` construct that isMike Bayer2016-02-261-1/+1
| | | | | | | | | | | passed to :func:`.column_property`, so that if the same attribute is referred to as a column expression twice the names are de-duped, thus avoiding "ambiguous column" errors. Previously, the ``.label(None)`` would need to be applied in order for the name to be de-anonymized. fixes #3663 (cherry picked from commit 0210695bd97e76f58d8781b69337816501482fb0)
* - additional adjustment to the fix made in ↵Mike Bayer2016-02-211-1/+4
| | | | | | | | | | | | | 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-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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)
* - further edit the unnest() example to suit PG's esoteric requirementsMike Bayer2016-02-181-4/+6
| | | | | | exactly (cherry picked from commit c97aa63789036fc145503f03123275253ae02d2c)
* - use same colname as the alias we give to the PG functionMike Bayer2016-02-161-2/+2
| | | | | | here, fixes #3652 (cherry picked from commit e310a8e423d9a4eeb511b7b84dbeccc90c234a1f)
* - repair the fix just cherry-picked for ref #3644 as compiler.py wasn'tMike Bayer2016-02-091-1/+1
| | | | | present in the commit for master, having been inadvertently committed on February 3. Source of this line is c1316a299257fae8264c8038d83e415f4605fde7.
* - add literal_binds for delete() statements in addition to insert()/update()Mike Bayer2016-02-031-1/+1
| | | | | | | - move tests to CRUDTest - changelog, fixes #3643 (cherry picked from commit 150591f9e0a94902cb2a76b68ac7c9d8a1a3ec83)
* fix passing literal_binds flag through for update and insertTim Tate2016-02-032-4/+5
| | | | (cherry picked from commit c9b03fa8afd52646aba8c59fc038330eeee6db60)
* - Fixed issue where inadvertent use of the Python ``__contains__``Mike Bayer2016-02-022-1/+5
| | | | | | | | | | | 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)
* - happy new yearMike Bayer2016-01-2919-19/+19
| | | | (cherry picked from commit 859379e2fcc4506d036700ba1eca4c0ae526a8ee)
* - unfortunately we need to match within join where col.key does not matchMike Bayer2016-01-261-2/+1
| | | | | | | what's given so we need to use a set() here. contains_column is not within any performance paths (cherry picked from commit 5742e321b261c0c1303835b80418cd3cdc1b5643)
* - rework ColumnCollection to no longer persist "all_col_set"; we don'tMike Bayer2016-01-261-20/+9
| | | | | | | | | | | | | | | 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)
* - generalize the verbiage on LargeBinary so that it doesn'tMike Bayer2016-01-201-10/+5
| | | | | | create confusion for inherited classes such as BYTEA, fixes (cherry picked from commit 47d8858c54401cdf10285b7935049faf87432f55)
* - fix some old verbiage that refers to text() as an "implicit" thingMike Bayer2016-01-141-8/+7
| | | | | | | for SQL fragments; we've deprecated that in 1.0 and its a good idea to document like this for 0.9 as well. (cherry picked from commit d5d7284bdd0ffc96e7a79354944627cf9b5d8e4d)
* - Fixed 1.0 regression where the eager fetch of cursor.rowcount wasMike Bayer2016-01-051-0/+6
| | | | | | | | | | 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)
* some spelling fixesjonathan vanasco2015-12-161-3/+3
| | | | (cherry picked from commit 738d515b95f1ff94d7dfd265883237d247d1c153)
* - a few tweaks to allow "server_defaults" to be a little more linkable;Mike Bayer2015-12-141-2/+10
| | | | | remove "undoc members" that was putting some random server_default atributes from ColumnClause
* - Fixed bug in :meth:`.Update.return_defaults` which would cause allMike Bayer2015-12-141-0/+1
| | | | | | | | | | | | | | | | 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-2/+3
| | | | | | | | | | | | | 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/+1
| | | | | | | | | 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)
* - Postgres: Do not prefix table with schema in: "FOR UPDATE of <table>"Diana Clarke2015-11-301-2/+2
| | | | | | | | | | | | | | For example, this query: SELECT s1.users.name FROM s1.users FOR UPDATE OF s1.users should actually be: SELECT s1.users.name FROM s1.users FOR UPDATE OF users fixes #3573 (cherry picked from commit fd47fea6fbb11ee84b7eea5772f40855703ebe47)
* - Added support for parameter-ordered SET clauses in an UPDATEMike Bayer2015-11-283-62/+114
| | | | | | | | | | | | 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)
* - add a JSON warning for coerce_compared_valueMike Bayer2015-10-281-0/+20
| | | | (cherry picked from commit 98c1dcc6bcade313a254fe11e8efa3c5b5ad959e)
* - Fixed regression in 1.0-released default-processor for multi-VALUESMike Bayer2015-08-311-0/+1
| | | | | | | | | | 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)
* Remove useless codeLeonardo Rochael Almeida2015-08-061-3/+0
| | | | | `to_unicode` variable was created but was not used. (cherry picked from commit 69fcabb335130bd0f6e9889c5b191c68192559b5)
* - fix typo in suffix_with() docs, fixes #3502Mike Bayer2015-07-291-1/+1
| | | | (cherry picked from commit 2e52f877638ded9d8440fa94632bff0f1705a83e)
* - changelog for #3459, fixes #3459Mike Bayer2015-07-191-1/+4
| | | | | - 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 :meth:`.ResultProxy.keys` would returnMike Bayer2015-07-191-3/+0
| | | | | | | | | | | | | | | | 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-2/+5
| | | | | | | | | | | | 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-1/+8
| | | | | | | | | | | | | | 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
* | Merge remote-tracking branch 'origin/pr/188' into pr188Mike Bayer2015-07-171-0/+8
|\ \
| * | Added support for reflected modulo operator.Dan Gittik2015-07-171-0/+8
| | |
* | | - version specs for new Sequence argumentsMike Bayer2015-07-171-0/+15
| | | | | | | | | | | | - changelog for pullreq github:186
* | | Merge remote-tracking branch 'origin/pr/186' into pr186Mike Bayer2015-07-172-2/+50
|\ \ \ | |/ / |/| |
| * | add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUEpr/186jakeogh2015-06-272-4/+31
| | |
| * | add NO MINVALUE and NO MAXVALUE support to Sequence()jakeogh2015-06-272-2/+6
| | |
| * | add MAXVALUE support to Sequence()jakeogh2015-06-272-3/+12
| | |
| * | add MINVALUE support to Sequence()jakeogh2015-06-272-2/+10
| |/
* | - try to note under insert.values(), if you needMike Bayer2015-07-081-3/+7
|/ | | | | | "multiple parameter sets" there is a much more common case which works equally well for INSERT/UPDATE/DELETE e.g. executemany(). reference #3476
* - Repaired the :class:`.ExcludeConstraint` construct to support commonMike Bayer2015-06-161-8/+20
| | | | | | | features that other objects like :class:`.Index` now do, that the column expression may be specified as an arbitrary SQL expression such as :obj:`.cast` or :obj:`.text`. fixes #3454
* - Fixed a bug where clause adaption as applied to a :class:`.Label`Mike Bayer2015-06-091-1/+2
| | | | | | | | | | | | 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