summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/pr/450'Mike Bayer2018-11-031-18/+19
|\ | | | | | | Change-Id: I50c0dd75199a34f68f9a2fa0f89208a887193969
| * Minor cosmetic tweaks to reST markupLele Gaifax2018-06-151-9/+10
| |
| * Fix typoLele Gaifax2018-06-151-1/+1
| |
| * Consistently use "PostgreSQL", fixing a couple of mistypesLele Gaifax2018-06-151-8/+8
| |
* | Merge "Deannotate ORM columns in ColumnEntity"mike bayer2018-11-031-0/+11
|\ \
| * | Deannotate ORM columns in ColumnEntityMike Bayer2018-11-021-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a minor performance issue which could in some cases add unnecessary overhead to result fetching, involving the use of ORM columns and entities that include those same columns at the same time within a query. The issue has to do with hash / eq overhead when referring to the column in different ways. Fixes: #4347 Change-Id: I191d4d1b1623898060a9accdfd186de16f89a6b7
* | | Add new NO_RAISE attribute flag and specify for m2o history loadMike Bayer2018-11-023-5/+17
|/ / | | | | | | | | | | | | | | | | Added new behavior to the lazy load that takes place when the "old" value of a many-to-one is retrieved, such that exceptions which would be raised due to either ``lazy="raise"`` or a detached session error are skipped. Fixes: #4353 Change-Id: I6c6c77613e93061a909f5062b70b17e8913fc9ee
* | Merge "Implement __delete__"mike bayer2018-11-023-22/+51
|\ \
| * | Implement __delete__Mike Bayer2018-11-023-22/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A long-standing oversight in the ORM, the ``__delete__`` method for a many- to-one relationship was non-functional, e.g. for an operation such as ``del a.b``. This is now implemented and is equivalent to setting the attribute to ``None``. Fixes: #4354 Change-Id: I60131a84c007b0bf6f20c5cc5f21a3b96e954046
* | | Use attr keys when testing bulk update params for primary keyMike Bayer2018-11-011-1/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in :meth:`.Session.bulk_update_mappings` where alternate mapped attribute names would result in the primary key column of the UPDATE statement being included in the SET clause, as well as the WHERE clause; while usually harmless, for SQL Server this can raise an error due to the IDENTITY column. This is a continuation of the same bug that was fixed in :ticket:`.3849`, where testing was insufficient to catch this additional flaw. Fixes: #4357 Change-Id: Iead058c0465dfa31c5b8a8780769278b7000acc8
* | Add missing index method to _AssociationList.Chris Macklin2018-10-311-0/+3
| | | | | | | | | | | | | | | | Added missing ``.index()`` method to list-based association collections in the association proxy extension. Change-Id: Ice81dc4bcccd520638c5bc9a0f8bb2027946c846 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/485
* | Merge "Move pk on single-inh subclass check below conflict resolution check"mike bayer2018-10-311-5/+5
|\ \
| * | Move pk on single-inh subclass check below conflict resolution checkTom Manderson2018-10-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The column conflict resolution technique discussed at :ref:`declarative_column_conflicts` is now functional for a :class:`.Column` that is also a primary key column. Previously, a check for primary key columns declared on a single-inheritance subclass would occur before the column copy were allowed to pass. Fixes: #4352 Change-Id: Id4c025da53c28e58db6b549fe398f25f8a90d355 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/483
* | | Merge "Add reserved word 'function' for MySQL"mike bayer2018-10-301-4/+4
|\ \ \ | |/ / |/| |
| * | Add reserved word 'function' for MySQLAlex Hall2018-10-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added word ``function`` to the list of reserved words for MySQL, which is now a keyword in MySQL 8.0 Fixes: #4348 Change-Id: Idd30acda7e99076810f65d0ee860055a18dc9193 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/481
* | | Add missing spacewodim2018-10-301-1/+1
| | |
* | | re-word recycle parameter documentationDavid Poggi2018-10-301-4/+4
|/ / | | | | | | Change-Id: I80cabcd9fa3f3b45e5355bf6c774a8eee02e7f1b
* | Merge remote-tracking branch 'origin/pr/478'Mike Bayer2018-10-301-1/+29
|\ \ | | | | | | | | | Change-Id: I0f27b6426dbfd665edf2a119b1cfaadb54511dd0
| * | Add warning to hybrid property expression and fixup crosslinksJames Owen2018-10-041-1/+29
| | |
* | | Create object- and column-oriented versions of AssociationProxyInstanceMike Bayer2018-10-261-19/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The :class:`.AssociationProxy` now has standard column comparison operations such as :meth:`.ColumnOperators.like` and :meth:`.ColumnOperators.startswith` available when the target attribute is a plain column - the EXISTS expression that joins to the target table is rendered as usual, but the column expression is then use within the WHERE criteria of the EXISTS. Note that this alters the behavior of the ``.contains()`` method on the association proxy to make use of :meth:`.ColumnOperators.contains` when used on a column-based attribute. Fixes: #4351 Change-Id: I310941f4e8f778c200f8144a26a89e5364cd4dfb
* | | - also correct for dbapi is a Mock without __version__...Mike Bayer2018-10-201-1/+2
| | | | | | | | | | | | Change-Id: I9e6b61a3292a2a6c8bb281c2375f2326282bcb76
* | | Merge "Check more specifically for hybrid attr and not mapped property"mike bayer2018-10-201-1/+2
|\ \ \
| * | | Check more specifically for hybrid attr and not mapped propertyMike Bayer2018-10-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression caused by :ticket:`4326` in version 1.2.12 where using :class:`.declared_attr` with a mixin in conjunction with :func:`.orm.synonym` would fail to map the synonym properly to an inherited subclass. Fixes: #4350 Change-Id: Ib2a9b6a125a2ac7c7ff80201746b7f10e5596226
* | | | - correct for dbapi not present in some testsMike Bayer2018-10-201-1/+1
| | | | | | | | | | | | | | | | Change-Id: Iaa81a00658060d40add26c95cc69cee7edd5966a
* | | | Enable decimal implicit bind for mysqlclient, is fixed as ofMike Bayer2018-10-201-0/+12
|/ / / | | | | | | | | | | | | | | | post 1.3.13 Change-Id: Ic7a2055597d06038ab330f1114416e4538964a2b
* | | Add prop.secondary to FROM for dynamic loaderMike Bayer2018-10-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where "dynamic" loader needs to explicitly set the "secondary" table in the FROM clause of the query, to suit the case where the secondary is a join object that is otherwise not pulled into the query from its columns alone. Fixes: #4349 Change-Id: I397f62abd5603efa4fb273586d0f772bf8c8fbbf
* | | Don't call rollback on DBAPI connection that's "closed"Mike Bayer2018-10-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the existence of ConnectionRecord.connection to estimate that this connection is likely closed, and if so, don't try to call "rollback" on it. This rollback is normally harmless but is causing segfaults in mysqlclient due to https://github.com/PyMySQL/mysqlclient-python/issues/270. Change-Id: I1d7c5f5a520527d8268b6334795c2051f7ceeea6
* | | selectinload omit joinJayson Reis2018-10-104-33/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "selectin" loader strategy now omits the JOIN in the case of a simple one-to-many load, where it instead relies upon the foreign key columns of the related table in order to match up to primary keys in the parent table. This optimization can be disabled by setting the :paramref:`.relationship.omit_join` flag to False. Many thanks to Jayson Reis for the efforts on this. As part of this change, horizontal shard no longer relies upon the _mapper_zero() method to get the query-bound mapper, instead using the more generalized _bind_mapper() (which will use mapper_zero if no explicit FROM is present). A short check for the particular recursive condition is added to BundleEntity and it no longer assigns itself as the "namespace" to its ColumnEntity objects which creates a reference cycle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #4340 Change-Id: I649587e1c07b684ecd63f7d10054cd165891baf4 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/7
* | | Merge "Route bulk update/delete exec through new Query._execute_crud method"mike bayer2018-10-043-3/+52
|\ \ \
| * | | Route bulk update/delete exec through new Query._execute_crud methodMike Bayer2018-10-043-3/+52
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for bulk :meth:`.Query.update` and :meth:`.Query.delete` to the :class:`.ShardedQuery` class within the horiziontal sharding extension. This also adds an additional expansion hook to the bulk update/delete methods :meth:`.Query._execute_crud`. Fixes: #4196 Change-Id: I65f56458176497a8cbdd368f41b879881f06348b
* | | Merge "Support tuples of heterogeneous types for empty expanding IN"mike bayer2018-10-047-10/+87
|\ \ \ | |/ / |/| |
| * | Support tuples of heterogeneous types for empty expanding INMike Bayer2018-10-037-10/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pass a list of all the types for the left side of an IN expression to the visit_empty_set_expr() method, so that the "empty expanding IN" can produce clauses for each element. Fixes: #4271 Change-Id: I2738b9df2292ac01afda37f16d4fa56ae7bf9147
* | | Perform additional retrieval of correct column namesMike Bayer2018-10-031-0/+53
|/ / | | | | | | | | | | | | | | | | | | | | | | Added a workaround for a MySQL bug #88718 introduced in the 8.0 series, where the reflection of a foreign key constraint is not reporting the correct case sensitivity for the referred column, leading to errors during use of the reflected constraint such as when using the automap extension. The workaround emits an additional query to the information_schema tables in order to retrieve the correct case sensitive name. Fixes: #4344 Change-Id: I08020d6eec43cbe8a56316660380d3739a0b45f7
* | Merge "Fix dependency_for final argument"mike bayer2018-10-021-1/+1
|\ \
| * | Fix dependency_for final argumentJoe Urciuoli2018-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where part of the utility language helper internals was passing the wrong kind of argument to the Python ``__import__`` builtin as the list of modules to be imported. The issue produced no symptoms within the core library but could cause issues with external applications that redefine the ``__import__`` builtin or otherwise instrument it. Pull request courtesy Joe Urciuoli. Per the submitter: "The fourth argument provided to `__import__` (which `import_` feeds in to) is supposed to be a a list of strings, but this code is passing a single string. This was causing the sqlalchemy `import_` function to break the string (for example 'interfaces') into an array of single characters ['i', 'n', ...], which causes the actual `__import__` to not find the module `sqlalchemy.orm.i` (since it's trying to import `sqlalchemy.orm.i` and `sqlalchemy.orm.n` .. etc)" No issue could be reproduced locally as it seems you can put anything non- empty/None into that last argument, even a list like ``['X']``, and all the sub-modules seem to appear. Omit it, and then the sub-modules aren't present. Perhaps it just runs the module or not if this attribute is present. Change-Id: Ia15c74620f24d24f0df4882f9b36a04e2c3725b8 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/473
* | | Merge "Add .info to InstanceState"mike bayer2018-10-011-2/+4
|\ \ \
| * | | Add .info to InstanceStateMike Bayer2018-10-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added ``.info`` dictionary to the :class:`.InstanceState` class, the object that comes from calling :func:`.inspect` on a mapped object. Fixes: #4257 Change-Id: I32d043f369edb708a17eec2e0b8876db0c1891b4
* | | | Merge "Add reflection support for Postgresql partitioned tables"mike bayer2018-10-011-2/+3
|\ \ \ \
| * | | | Add reflection support for Postgresql partitioned tablesMike Bayer2018-10-011-2/+3
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added rudimental support for reflection of Postgresql partitioned tables, e.g. that relkind='p' is added to reflection queries that return table information. Fixes: #4237 Change-Id: I66fd10b002e4ed21ea13b13a7e35a85f66bdea75
* | | | Merge "Strong reference parent object in association proxy"mike bayer2018-10-011-10/+4
|\ \ \ \
| * | | | Strong reference parent object in association proxyMike Bayer2018-10-011-10/+4
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Considering the reversal of #597 as well as 84420a1d0fe09d7a45e878e853aa9f5258561f8b as I am unable to reproduce the original issues from that release. The long-standing behavior of the association proxy collection maintaining only a weak reference to the parent object is reverted; the proxy will now maintain a strong reference to the parent for as long as the proxy collection itself is also in memory, eliminating the "stale association proxy" error. This change is being made on an experimental basis to see if any use cases arise where it causes side effects. Change-Id: I051334be90a343dd0e8a1f35e072075eb14b14a7 Fixes: #4268
* | | | Add test and retroactive changelog for issue 4040Mike Bayer2018-10-012-1/+6
|/ / / | | | | | | | | | | | | Fixes: #4040 Change-Id: I707c1cd2708a37102ad8184bec21be35cb6242d7
* | | Merge "Import from collections.abc"mike bayer2018-09-274-9/+6
|\ \ \
| * | | Import from collections.abcxtreak2018-09-274-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "Break association proxy into a descriptor + per-class accessor"mike bayer2018-09-272-168/+220
|\ \ \ \
| * | | | Break association proxy into a descriptor + per-class accessorMike Bayer2018-09-272-168/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reworked :class:`.AssociationProxy` to store state that's specific to a parent class in a separate object, so that a single :class:`.AssocationProxy` can serve for multiple parent classes, as is intrinsic to inheritance, without any ambiguity in the state returned by it. A new method :meth:`.AssociationProxy.for_class` is added to allow inspection of class-specific state. Change-Id: I634f88aae6306ac5c5237a0e1acbe07d0481d6b6 Fixes: #3423
* | | | | Merge "Remove MappedCollection converter; deprecate @converter"mike bayer2018-09-271-24/+1
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Remove MappedCollection converter; deprecate @converterMike Bayer2018-09-271-24/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed the collection converter used by the :class:`.MappedCollection` class. This converter was used only to assert that the incoming dictionary keys matched that of their corresponding objects, and only during a bulk set operation. The converter can interfere with a custom validator or :meth:`.AttributeEvents.bulk_replace` listener that wants to convert incoming values further. The ``TypeError`` which would be raised by this converter when an incoming key didn't match the value is removed; incoming values during a bulk assignment will be keyed to their value-generated key, and not the key that's explicitly present in the dictionary. Overall, @converter is superseded by the :meth:`.AttributeEvents.bulk_replace` event handler added as part of :ticket:`3896`. Fixes: #3604 Change-Id: Id0f7bd2cec938f5975eb2ab94df9ba5754dd43c3
* | | | | Merge "Copy create_constraint flag for Enum"mike bayer2018-09-251-1/+1
|\ \ \ \ \
| * | | | | 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