summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Propose implicit FROM logic be limited to only those tablesno_auto_fromsMike Bayer2017-06-241-9/+27
| | | | | | | | | | | explicitly in the columns clause A proposal to prevent "FROM A, B" styles of cartesian products by simply disallowing from the FROM clause any table that wasn't explicitly made part of the FROM clause nor was selected from. Change-Id: Ia8c3f5efa702a0cf9421fd8d899a808af51e0023
* added link for CrateDB supportJodok Batlogg2017-06-231-0/+1
|
* Don't erase reflected comment in _init_existingEloy Felix2017-06-202-2/+7
| | | | | Change-Id: Ie0b78c79367933486528ca0ba686d4a9f16922b1 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/370
* Add ad-hoc mapped expressionsMike Bayer2017-06-198-2/+325
| | | | | | | | | | Added a new feature :func:`.orm.with_expression` that allows an ad-hoc SQL expression to be added to a specific entity in a query at result time. This is an alternative to the SQL expression being delivered as a separate element in the result tuple. Change-Id: Id8c479f7489fb02e09427837c59d1eabb2a6c014 Fixes: #3058
* - 1.1.11 release dateMike Bayer2017-06-191-0/+1
| | | | Change-Id: I351e5727368b67598d091e5153a66987e349f8f6
* Merge "Handle SHOW VARIABLES returning no row"mike bayer2017-06-163-12/+57
|\
| * Handle SHOW VARIABLES returning no rowMike Bayer2017-06-163-12/+57
| | | | | | | | | | | | | | | | | | | | | | MySQL 5.7 has introduced permission limiting for the "SHOW VARIABLES" command; the MySQL dialect will now handle when SHOW returns no row, in particular for the initial fetch of SQL_MODE, and will emit a warning that user permissions should be modified to allow the row to be present. Change-Id: I98e7a69230da397b17eae07b7e9d024fa7aeeb26 Fixes: #4007
* | Merge "Add all versioning logic to _post_update()"mike bayer2017-06-165-18/+333
|\ \
| * | Add all versioning logic to _post_update()Mike Bayer2017-06-155-18/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An UPDATE emitted as a result of the :paramref:`.relationship.post_update` feature will now integrate with the versioning feature to both bump the version id of the row as well as assert that the existing version number was matched. Fixes: #3496 Change-Id: I865405dd6069f1c1e3b0d27a4980e9374e059f97
* | | Set complete FROM list for subquery eagerload's orig queryMike Bayer2017-06-164-12/+121
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of checking that the "orig_entity" we receive applies as a correct FROM element for the subquery we're building, set the FROM clause of the query to exactly what it already is based on column_descriptions (assuming there is no FROM list already), thereby ensuring that the FROM list will remain intact, regardless of what orig_entity turns out to be and what the target_cols ultimately refer towards. Fixed issue with subquery eagerloading which continues on from the series of issues fixed in :ticket:`2699`, :ticket:`3106`, :ticket:`3893` involving that the "subquery" contains the correct FROM clause when beginning from a joined inheritance subclass and then subquery eager loading onto a relationship from the base class, while the query also includes criteria against the subclass. The fix in the previous tickets did not accommodate for additional subqueryload operations loading more deeply from the first level, so the fix has been further generalized. Change-Id: Ic909590814f71e577d8266b1dbc4c393dc48e019 Fixes: #4011
* | Repair WithinGroup.get_children()Mike Bayer2017-06-163-1/+19
|/ | | | | | | | Fixed AttributeError which would occur in :class:`.WithinGroup` construct during an iteration of the structure. Change-Id: I563882d93c8c32292463a605b636aa60c77e9406 Fixes: #4012
* - remove redundant fixture from base test classMike Bayer2017-06-151-15/+0
| | | | Change-Id: I76f197d5b2b39ae476bfff924e899773aa123be0
* - ensure String has a length for mysql compatibilityMike Bayer2017-06-151-1/+1
| | | | Change-Id: Iaa1077ca5929bdc67300cc6bfb1ba98aff382246
* Repair regression to pathing for subclassesMike Bayer2017-06-152-3/+72
| | | | | | | | | Issue #3963's initial commit narrowed the "current path" match rules too much such that a path that matches current path on subclass would no longer match. Change-Id: I8c9a0db91a09d789cfb8666288a913f8bbcdb2e9 Fixes: #3963
* Refinements for unitofwork internalsMike Bayer2017-06-142-51/+66
| | | | | | | | | | | * remove "mapper" argument from SaveUpdateState, DeleteState * use __slots__ for all uow action classes * rename ".delete" to ".isdelete" * rename issue_post_update to register_post_update since this doesn't actually issue the UPDATE * rename IssuePostUpdate to PostUpdateAll Change-Id: Ia6263b80d6a86eab1e8ed38df1421b1d0f249797
* Support AssociationProxy any() / has() / contains() to another AssociationProxyMike Bayer2017-06-124-37/+313
| | | | | | | | | | | | | | | | | | | The :meth:`.AssociationProxy.any`, :meth:`.AssociationProxy.has` and :meth:`.AssociationProxy.contains` comparison methods now support linkage to an attribute that is itself also an :class:`.AssociationProxy`, recursively. After some initial attempts it's clear that the any() / has() of AssociationProxy needed to be reworked into a generic _criterion_exists() to allow this to work recursively without excess complexity. For the case of the multi-linked associationproxy, the usual checks of "any()" / "has()" correctness simply don't take place; for a single-link association proxy the error checking logic that takes place in relationship() has been ported to the local any() / has() methods. Change-Id: Ic5aed2a4e910b8138a737d215430113c31cce856 Fixes: #3769
* Render ARRAY index embedded between type and COLLATEMike Bayer2017-06-083-3/+41
| | | | | | | | | | | | | | | | Fixed bug where using :class:`.ARRAY` with a string type that features a collation would fail to produce the correct syntax within CREATE TABLE. The "COLLATE" must appear to the right of the array dimensions, so we are using regexp substitution to insert the brackets in the appropriate place. A more heavyweight solution would be that datatypes know how to split up their base type vs. modifiers, but as this is so specific to Postgresql ARRAY it's better to handle these cases more locally. Change-Id: I394c3c673eb60689e51b5301e51651972cfdb4c0 Fixes: #4006
* Parse for Postgresql version w/ "beta"Mike Bayer2017-06-073-2/+20
| | | | | | | | | | | | | Continuing with the fix that correctly handles Postgresql version string "10devel" released in 1.1.8, an additional regexp bump to handle version strings of the form "10beta1". While Postgresql now offers better ways to get this information, we are sticking w/ the regexp at least through 1.1.x for the least amount of risk to compatibility w/ older or alternate Postgresql databases. Change-Id: I12ddb06465f7dcf80563c27632441ef5963f60d4 Fixes: #4005
* - assert passive_deletes='all' does not affect collection/scalarMike Bayer2017-06-062-27/+33
| | | | | | | | | | | | membership removal in issue #3844 we hypotheized that passive_deletes='all' was broken because it sets to NULL a foreign key attribute when the child object is removed or replaced. However, not doing the NULL set means that nothing happens at all and the operation silently fails. Change-Id: I11834e7e324349e172dc797bac62731008b6b95a
* - make sure ticket # is hereMike Bayer2017-06-061-0/+1
| | | | Change-Id: I7d54026da9a9a9331a4fd7e675dbfe9c433fe2e4
* Warn when declared_attr.cascading detected on mapped classMike Bayer2017-06-065-2/+62
| | | | | | | | | | | | | | A warning is emitted if the :attr:`.declared_attr.cascading` modifier is used with a declarative attribute that is itself declared on a class that is to be mapped, as opposed to a declarative mixin class or ``__abstract__`` class. The :attr:`.declared_attr.cascading` modifier currently only applies to mixin/abstract classes. Also add a test for @declared_attr.cascading when used on an attribute on __abstract__. Change-Id: Ib1b9dbe373e8be1cf24eadfed224a8988b3cd95d Fixes: #3847
* Re-send column value w/ onupdate default during post-updateMike Bayer2017-06-064-9/+89
| | | | | | | | | | | Adjusted the behavior of post_update such that if a column with an "onupdate" default has received an explicit value for INSERT, re-send the same data during a post-update UPDATE so that the value remains in effect, rather than an onupdate overwriting it. Change-Id: I26bccb6f957dcad07a2bcbda2dd9e14c60b92b06 Fixes: #3471
* Merge "Implement _postfetch_post_update to expire/refresh onupdates in ↵mike bayer2017-06-063-6/+118
|\ | | | | | | post_update"
| * Implement _postfetch_post_update to expire/refresh onupdates in post_updateMike Bayer2017-06-053-6/+118
| | | | | | | | | | | | | | | | | | | | | | | | Fixed bug involving the :paramref:`.relationship.post_update` feature where a column "onupdate" value would not result in expiration or refresh of the corresponding object attribute, if the UPDATE for the row were a result of the "post update" feature. Additionally, the :meth:`.SessionEvents.refresh_flush` event is now emitted for these attributes when refreshed within the flush. Fixes: #3472 Change-Id: I5ee2d715e773a306ab1e8143e4382c228991ac78
* | Implement in-place mutation operators for MutableSet, MutableListMike Bayer2017-06-054-0/+113
|/ | | | | | | | | | | Implemented in-place mutation operators ``__ior__``, ``__iand__``, ``__ixor__`` and ``__isub__`` for :class:`.mutable.MutableSet` and ``__iadd__`` for :class:`.mutable.MutableList` so that change events are fired off when these mutator methods are used to alter the collection. Change-Id: Ib357a96d3b06c5deb6b53eb304a8b9f1dc9e9ede Fixes: #3853
* selectin polymorphic loadingMike Bayer2017-06-0513-49/+836
| | | | | | | | | | | | | Added a new style of mapper-level inheritance loading "polymorphic selectin". This style of loading emits queries for each subclass in an inheritance hierarchy subsequent to the load of the base object type, using IN to specify the desired primary key values. Fixes: #3948 Change-Id: I59e071c6142354a3f95730046e3dcdfc0e2c4de5
* Merge branch 'fix-typo' of https://github.com/lelit/sqlalchemyMike Bayer2017-06-021-5/+5
|\
| * Fix a few doc typosLele Gaifax2017-06-021-5/+5
| |
* | Implement get_unique_constraints, get_check_constraints for OracleEloy Felix2017-05-306-6/+185
| | | | | | | | | | | | | | | | Pull-request: https://github.com/zzzeek/sqlalchemy/pull/326 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/342 Fixes: #4002 Change-Id: I221fe8ba305fc455a03e3a5d15f803bf8ee2e8fb
* | Don't hard-evaluate non-ORM @declared_attr for AbstractConcreteBaseMike Bayer2017-05-263-1/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where using :class:`.declared_attr` on an :class:`.AbstractConcreteBase` where a particular return value were some non-mapped symbol, including ``None``, would cause the attribute to hard-evaluate just once and store the value to the object dictionary, not allowing it to invoke for subclasses. This behavior is normal when :class:`.declared_attr` is on a mapped class, and does not occur on a mixin or abstract class. Since :class:`.AbstractConcreteBase` is both "abstract" and actually "mapped", a special exception case is made here so that the "abstract" behavior takes precedence for :class:`.declared_attr`. Change-Id: I6160ebb3a52c441d6a4b663c8c9bbac6d37fa417 Fixes: #3848
* | Add placeholder XML supportMike Bayer2017-05-264-21/+81
| | | | | | | | | | | | | | | | | | | | | | Added a placeholder type :class:`.mssql.XML` to the SQL Server dialect, so that a reflected table which includes this type can be re-rendered as a CREATE TABLE. The type has no special round-trip behavior nor does it currently support additional qualifying arguments. Change-Id: I651fa729bd8e9b31a0b5effe0839aff077d77c46 Fixes: #3973
* | Merge "Raise if ForeignKeyConstraint created with different numbers of local ↵mike bayer2017-05-253-0/+51
|\ \ | | | | | | | | | and remote columns."
| * | Raise if ForeignKeyConstraint created with different numbers ofMike Bayer2017-05-253-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | local and remote columns. An :class:`.ArgumentError` is now raised if a :class:`.ForeignKeyConstraint` object is created with a mismatched number of "local" and "remote" columns, which otherwise causes the internal state of the constraint to be incorrect. Note that this also impacts the condition where a dialect's reflection process produces a mismatched set of columns for a foreign key constraint. Downstream DB2 dialect has been reported as potentially causing this scenario. Change-Id: Id51c34a6c43749bb582639f9c1dc28723482f0e5 Fixes: #3949 References: #3998
* | | Flatten operator precedence for comparison operatorsMichael Birtwell2017-05-256-21/+64
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | The operator precedence for all comparison operators such as LIKE, IS, IN, MATCH, equals, greater than, less than, etc. has all been merged into one level, so that expressions which make use of these against each other will produce parentheses between them. This suits the stated operator precedence of databases like Oracle, MySQL and others which place all of these operators as equal precedence, as well as Postgresql as of 9.5 which has also flattened its operator precendence. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #3999 Change-Id: I3f3d5124a64af0d376361cdf15a97e2e703be56f Pull-request: https://github.com/zzzeek/sqlalchemy/pull/367
* | Add with_for_update() support in session.refresh()Mike Bayer2017-05-247-6/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Session.refresh() is still hardcoded to legacy lockmode, come up with a new API so that the newer argument style works with it. Added new argument :paramref:`.with_for_update` to the :meth:`.Session.refresh` method. When the :meth:`.Query.with_lockmode` method were deprecated in favor of :meth:`.Query.with_for_update`, the :meth:`.Session.refresh` method was never updated to reflect the new option. Change-Id: Ia02a653746b7024699b515451525a88d7a17d63a Fixes: #3991
* | - add forwards-versionMike Bayer2017-05-231-0/+1
| | | | | | | | Change-Id: Id1652beb13209aac203456c88acff629048e00cc
* | Merge "Remove twophase for cx_Oracle 6.x"mike bayer2017-05-233-35/+57
|\ \
| * | Remove twophase for cx_Oracle 6.xMike Bayer2017-05-233-35/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support for two-phase transactions has been removed entirely for cx_Oracle when version 6.0b1 or later of the DBAPI is in use. The two- phase feature historically has never been usable under cx_Oracle 5.x in any case, and cx_Oracle 6.x has removed the connection-level "twophase" flag upon which this feature relied. Change-Id: I2e8161cc2bc12f4845c9224cd483038112fe9734 Fixes: #3997
* | | Add AttributeEvents.modifiedMike Bayer2017-05-237-6/+133
|/ / | | | | | | | | | | | | | | | | | | Added new event handler :meth:`.AttributeEvents.modified` which is triggered when the func:`.attributes.flag_modified` function is invoked, which is common when using the :mod:`sqlalchemy.ext.mutable` extension module. Change-Id: Ic152f1d5c53087d780b24ed7f1f1571527b9e8fc Fixes: #3303
* | - add option to disable py.test warnings plugin;Mike Bayer2017-05-232-2/+2
| | | | | | | | | | | | | | lift cap on py.test. references: https://github.com/pytest-dev/pytest/issues/2430 Change-Id: Ieb8a6258ba1d15efa570d9cda2b51cf021499a23
* | Merge "Add clause adaptation for AliasedClass to with_parent()"mike bayer2017-05-235-17/+100
|\ \
| * | Add clause adaptation for AliasedClass to with_parent()Mike Bayer2017-05-235-17/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where :meth:`.Query.with_parent` would not work if the :class:`.Query` were against an :func:`.aliased` construct rather than a regular mapped class. Also adds a new parameter :paramref:`.util.with_parent.from_entity` to the standalone :func:`.util.with_parent` function as well as :meth:`.Query.with_parent`. Change-Id: Ic684dd63cc90b582c7580c9bba3c92fa3f286da7 Fixes: #3607
* | | - add session.close() w/ rationale to top-level "using transactions"Mike Bayer2017-05-231-0/+9
|/ / | | | | | | | | | | section. References #3974 Change-Id: Idb650cbe9825cfae893ee917132b5b9d693f0c6c
* | - pin py.test at 3.0.7 due to https://github.com/pytest-dev/pytest/issues/2430Mike Bayer2017-05-231-1/+1
| | | | | | | | Change-Id: I587282da141aa6ea92f944eeb4c9e5782d0b5f29
* | - remove .gitattributes and merge=union as this isn't reallyMike Bayer2017-05-221-1/+0
| | | | | | | | | | | | working anyway. need to try something else. Change-Id: Iabcefa4b66d242acb74a8135c2f5a6a4345441a7
* | Repair formatting throughout documentationKataev Denis2017-05-2288-303/+303
| | | | | | | | | | | | | | | | | | | | | | 1. Section decorators to [one style](http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections): without inset at both side and with same length as text. 2. Fix broken [reference](http://docs.sqlalchemy.org/en/latest/core/type_basics.html#generic-types). 3. Convert tabs to space in some small files. 4. Some python code snippets have python+sql syntax hint. Change-Id: I39a7a41ef0b0591c6bf1e610748e2b5c19fc5379 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/361
* | detect and raise for version_id is NULLDiana Clarke2017-05-223-0/+85
| | | | | | | | | | | | | | | | | | The versioning feature does not support NULL for the version counter. An exception is now raised if the version id is programmatic and was set to NULL for an UPDATE. Pull request courtesy Diana Clarke. Fixes: #3673 Change-Id: I8b0da56234a7c7f5e7fde35536e09a6216a5e48a
* | Merge "Detect no params w/ manual version_id counter and set to itself"mike bayer2017-05-223-0/+83
|\ \
| * | Detect no params w/ manual version_id counter and set to itselfMike Bayer2017-05-223-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where programmatic version_id counter in conjunction with joined table inheritance would fail if the version_id counter were not actually incremented and no other values on the base table were modified, as the UPDATE would have an empty SET clause. Since programmatic version_id where version counter is not incremented is a documented use case, this specific condition is now detected and the UPDATE now sets the version_id value to itself, so that concurrency checks still take place. Change-Id: I80e385bffeed4851cc20131cbe983c173a46f655 Fixes: #3996
* | | Allow metadata.reflect() to recover from unreflectable tablesMike Bayer2017-05-227-7/+101
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Added support for views that are unreflectable due to stale table definitions, when calling :meth:`.MetaData.reflect`; a warning is emitted for the table that cannot respond to ``DESCRIBE`` but the operation succeeds. The MySQL dialect now raises UnreflectableTableError which is in turn caught by MetaData.reflect(). Reflecting the view standalone raises this error directly. Change-Id: Id8005219d8e073c154cc84a873df911b4a6cf4d6 Fixes: #3871