summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/associationproxy.py
Commit message (Collapse)AuthorAgeFilesLines
* Support AssociationProxy any() / has() / contains() to another AssociationProxyMike Bayer2017-06-121-36/+68
| | | | | | | | | | | | | | | | | | | 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
* Call proxied collection before invoking creator in associationlist.append()Mike Bayer2017-04-281-1/+2
| | | | | | | | | | | | Improved the association proxy list collection so that premature autoflush against a newly created association object can be prevented in the case where ``list.append()`` is being used, and a lazy load would be invoked when the association proxy accesses the endpoint collection. The endpoint collection is now accessed first before the creator is invoked to produce the association object. Change-Id: I008a6dbdfe5b1c0dfd02189c3d954d83a65f3fc5 Fixes: #3941
* Support python3.6Mike Bayer2017-01-131-1/+1
| | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* - happy new yearMike Bayer2016-01-291-1/+1
|
* Change generator termination from StopIteration to return.pr/211pgjones2015-10-301-2/+2
| | | | | | | | | | | From [PEP 479](https://www.python.org/dev/peps/pep-0479/) the correct way to terminate a generator is to return (which implicitly raises StopIteration) rather than raise StopIteration. Without this change using sqlalchemy in python 3.5 or greater results in these warnings PendingDeprecationWarning: generator '__iter__' raised StopIteration which this commit should remove.
* - Added the :paramref:`.AssociationProxy.info` parameter to theMike Bayer2015-10-091-1/+8
| | | | | | | | | :class:`.AssociationProxy` constructor, to suit the :attr:`.AssociationProxy.info` accessor that was added in :ticket:`2971`. This is possible because :class:`.AssociationProxy` is constructed explicitly, unlike a hybrid which is constructed implicitly via the decorator syntax. fixes #3551
* - Fixed bug in association proxy where an any()/has()Mike Bayer2015-04-281-6/+10
| | | | | | | on an relationship->scalar non-object attribute comparison would fail, e.g. ``filter(Parent.some_collection_to_attribute.any(Child.attr == 'foo'))`` fixes #3397
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* Fix slice addressing of _AssociationList with python3Gilles Dartiguelongue2015-03-101-1/+4
|
* - add MemoizedSlots, a generalized solution to using __getattr__Mike Bayer2015-01-051-1/+1
| | | | | for memoization on a class that uses slots. - apply many more __slots__. mem use for nova now at 46% savings
* - rename _InspectionAttr to InspectionAttrMike Bayer2014-08-131-3/+3
|
* PEP8 style fixesBrian Jarrett2014-07-131-24/+24
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - Fixed bug in association proxy where assigning an empty sliceMike Bayer2014-03-041-2/+3
| | | | (e.g. ``x[:] = [...]``) would fail on Py3k.
* - Fixed a regression in association proxy caused by :ticket:`2810` whichMike Bayer2014-02-271-5/+3
| | | | | | | | | caused a user-provided "getter" to no longer receive values of ``None`` when fetching scalar values from a target that is non-present. The check for None introduced by this change is now moved into the default getter, so a user-provided getter will also again receive values of None. re: #2810
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - catch the metadata on ScalarTest.test_scalar_proxy, this has been leaving ↵Mike Bayer2013-10-251-1/+5
| | | | | | | | itself around for a long time - association proxy now returns None for proxied scalar that is also None, rather than raising AttributeError. [ticket:2810]
* Added additional criterion to the ==, != comparators, used withMike Bayer2013-06-081-4/+26
| | | | | | | | | | | | | | | | | | | scalar values, for comparisons to None to also take into account the association record itself being non-present, in addition to the existing test for the scalar endpoint on the association record being NULL. Previously, comparing ``Cls.scalar == None`` would return records for which ``Cls.associated`` were present and ``Cls.associated.scalar`` is None, but not rows for which ``Cls.associated`` is non-present. More significantly, the inverse operation ``Cls.scalar != None`` *would* return ``Cls`` rows for which ``Cls.associated`` was non-present. Additionally, added a special use case where you can call ``Cls.scalar.has()`` with no arguments, when ``Cls.scalar`` is a column-based value - this returns whether or not ``Cls.associated`` has any rows present, regardless of whether or not ``Cls.associated.scalar`` is NULL or not. [ticket:2751]
* clean up some of this collection stuffMike Bayer2013-05-261-18/+12
|
* a pass where we try to squash down as many list()/keys() combinationsMike Bayer2013-05-261-1/+1
| | | | as possible
* do a sweep of some obvious 3kismsMike Bayer2013-05-261-16/+27
|
* most of ORM passing...Mike Bayer2013-05-041-0/+2
|
* - the raw 2to3 runMike Bayer2013-04-271-16/+16
| | | | - went through examples/ and cleaned out excess list() calls
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* Extended the :doc:`/core/inspection` system so that all Python descriptorsMike Bayer2012-12-291-2/+15
| | | | | | | | associated with the ORM or its extensions can be retrieved. This fulfills the common request of being able to inspect all :class:`.QueryableAttribute` descriptors in addition to extension types such as :class:`.hybrid_property` and :class:`.AssociationProxy`. See :attr:`.Mapper.all_orm_descriptors`.
* just a pep8 pass of lib/sqlalchemy/extDiana Clarke2012-11-191-35/+48
|
* - move ext to relative importsMike Bayer2012-07-171-32/+30
|
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-3/+3
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.
* fix import hereMike Bayer2012-04-241-4/+4
|
* happy new yearMike Bayer2012-01-041-1/+1
|
* - Changed the update() method on association proxyMike Bayer2011-09-141-4/+13
| | | | | | | | dictionary to use a duck typing approach, i.e. checks for "keys", to discern between update({}) and update((a, b)). Previously, passing a dictionary that had tuples as keys would be misinterpreted as a sequence. [ticket:2275]
* - second pass through association proxy docs, some more links on ↵Mike Bayer2011-08-061-22/+41
| | | | any()/has(), MapperProperty
* - rewrite the docs for association proxy using declarative, add new ↵Mike Bayer2011-08-051-19/+76
| | | | | | | | examples, querying, etc., part of [ticket:2246] - add some accessors to AssociationProxy for attributes, test in join(), [ticket:2236] - update relationship docs to talk about callables, part of [ticket:2246]
* - Association proxy now has correct behavior forMike Bayer2011-02-131-20/+48
| | | | | | | any(), has(), and contains() when proxying a many-to-one scalar attribute to a one-to-many collection (i.e. the reverse of the 'typical' association proxy use case) [ticket:2054]
* - whitespace removal bonanzaMike Bayer2011-01-021-8/+8
|
* - clean up copyright, update for 2011, stamp every file withMike Bayer2011-01-021-0/+6
| | | | | a consistent tag - AUTHORS file
* - The official name for the relation() function is nowMike Bayer2010-03-171-10/+10
| | | | | | relationship(), to eliminate confusion over the relational algebra term. relation() however will remain available in equal capacity for the foreseeable future. [ticket:1740]
* - association_proxy now has basic comparator methods .any(),Mike Bayer2010-01-221-0/+21
| | | | | .has(), .contains(), ==, !=, thanks to Scott Torborg. [ticket:1372]
* - The signature of the proxy_factory callable passed toMike Bayer2009-12-081-1/+1
| | | | | | | | association_proxy is now (lazy_collection, creator, value_attr, association_proxy), adding a fourth argument that is the parent AssociationProxy argument. Allows serializability and subclassing of the built in collections. [ticket:1259]
* - The collection proxies produced by associationproxy are nowMike Bayer2009-07-251-103/+64
| | | | | | pickleable. A user-defined proxy_factory however is still not pickleable unless it defines __getstate__ and __setstate__. [ticket:1446]
* merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 ↵Mike Bayer2008-12-181-3/+3
| | | | | | | | testing issues, and also addresses a significant chunk of py3k deprecations. It's mainly expicit __hash__ methods. Additionally, most usage of sets/dicts to store columns uses util-based placeholder names.
* Association proxies no longer cloak themselves at the class level.Jason Kirtland2008-12-181-13/+26
|
* - Always use native itemgetter & attrgetterJason Kirtland2008-07-151-1/+2
|
* - Removed 2.3 set emulations/enhancements.Jason Kirtland2008-07-151-23/+23
| | | | (sets.Set-based collections & DB-API returns still work.)
* - Another namespace cleanup tweak, why not.Jason Kirtland2008-05-211-2/+3
|
* Duh.Jason Kirtland2008-05-211-0/+3
|
* - Removed deprecated append(val, **kw)Jason Kirtland2008-05-211-107/+132
| | | | - dict/set/list proxies are now docstring'd like their python counterparts
* r4695 merged to trunk; trunk now becomes 0.5.Mike Bayer2008-05-091-20/+57
| | | | 0.4 development continues at /sqlalchemy/branches/rel_0_4
* Adjusted inplace-binops on set-based collections and association proxies toJason Kirtland2008-05-051-8/+10
| | | | | | more closely follow builtin (2.4+) set semantics. Formerly any set duck-type was accepted, now only types or subtypes of set, frozenset or the collection type itself are accepted.