summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/relationships.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in 'Relationships API' docspr/170Ernest Walzel2015-04-281-1/+1
| | | | exprssed -> expressed
* - Fixed more regressions caused by NEVER_SET; comparisonsMike Bayer2015-04-201-14/+33
| | | | | | | | | to transient objects with attributes unset would leak NEVER_SET, and negated_contains_or_equals would do so for any transient object as the comparison used only the committed value. Repaired the NEVER_SET cases, fixes #3371, and also made negated_contains_or_equals() use state_attr_by_column() just like a non-negated comparison, fixes #3374
* - Made a small improvement to the heuristics of relationship whenMike Bayer2015-04-121-0/+9
| | | | | | | | | determining remote side with semi-self-referential (e.g. two joined inh subclasses referring to each other), non-simple join conditions such that the parententity is taken into account and can reduce the need for using the ``remote()`` annotation; this can restore some cases that might have worked without the annotation prior to 0.9.4 via :ticket:`2948`. fixes #3364
* - Added a new extension suite :mod:`sqlalchemy.ext.baked`. ThisMike Bayer2015-03-111-12/+76
| | | | | | | | simple but unusual system allows for a dramatic savings in Python overhead for the construction and processing of orm :class:`.Query` objects, from query construction up through rendering of a string SQL statement. fixes #3054
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - Fixed bugs in ORM object comparisons where comparison ofMike Bayer2015-02-201-3/+4
| | | | | | | | | | many-to-one ``!= None`` would fail if the source were an aliased class, or if the query needed to apply special aliasing to the expression due to aliased joins or polymorphic querying; also fixed bug in the case where comparing a many-to-one to an object state would fail if the query needed to apply special aliasing due to aliased joins or polymorphic querying. fixes #3310
* - Fixed bug in lazy loading SQL construction whereby a complexMike Bayer2015-02-021-14/+18
| | | | | | | | primaryjoin that referred to the same "local" column multiple times in the "column that points to itself" style of self-referential join would not be substituted in all cases. The logic to determine substitutions here has been reworked to be more open-ended. fixes #3300
* - add MemoizedSlots, a generalized solution to using __getattr__Mike Bayer2015-01-051-0/+1
| | | | | for memoization on a class that uses slots. - apply many more __slots__. mem use for nova now at 46% savings
* - fix links for loading, add a redirect pageMike Bayer2014-12-271-1/+1
| | | | | | bump foo
* - for #3230, scale back the check to only look at columns thatMike Bayer2014-10-191-15/+20
| | | | | | | already have more than one ForeignKeyConstraint referring to them. This limits the check to what we hope is the most common case, but we benefit that the memory and config-time impact is scaled back dramatically.
* - A warning is emitted in the case of multiple relationships thatticket_3230Mike Bayer2014-10-191-0/+51
| | | | | | | | | | | | ultimately will populate a foreign key column in conflict with another, where the relationships are attempting to copy values from different source columns. This occurs in the case where composite foreign keys with overlapping columns are mapped to relationships that each refer to a different referenced column. A new documentation section illustrates the example as well as how to overcome the issue by specifying "foreign" columns specifically on a per-relationship basis. fixes #3230
* - Fixed warning that would emit when a complex self-referentialMike Bayer2014-09-111-4/+4
| | | | | | | primaryjoin contained functions, while at the same time remote_side was specified; the warning would suggest setting "remote side". It now only emits if remote_side isn't present. fixes #3194
* - remove some old cruftMike Bayer2014-09-071-21/+6
| | | | | | - prop.compare() isn't needed; replace with prop._with_parent() for relationships - update docs in orm/interfaces
* - The behavior of :paramref:`.joinedload.innerjoin` as well asMike Bayer2014-08-261-10/+6
| | | | | | | :paramref:`.relationship.innerjoin` is now to use "nested" inner joins, that is, right-nested, as the default behavior when an inner join joined eager load is chained to an outer join eager load. fixes #3008
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-491/+538
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-1/+1
| | | | Found using: https://github.com/intgr/topy
* - The "primaryjoin" model has been stretched a bit further to allowMike Bayer2014-04-191-26/+46
| | | | | | | | | | a join condition that is strictly from a single column to itself, translated through some kind of SQL function or expression. This is kind of experimental, but the first proof of concept is a "materialized path" join condition where a path string is compared to itself using "like". The :meth:`.Operators.like` operator has also been added to the list of valid operators to use in a primaryjoin condition. fixes #3029
* - Fixed a very old behavior where the lazy load emitted for a one-to-manyMike Bayer2014-03-271-4/+11
| | | | | | | | | | | | | | | | | could inappropriately pull in the parent table, and also return results inconsistent based on what's in the parent table, when the primaryjoin includes some kind of discriminator against the parent table, such as ``and_(parent.id == child.parent_id, parent.deleted == False)``. While this primaryjoin doesn't make that much sense for a one-to-many, it is slightly more common when applied to the many-to-one side, and the one-to-many comes as a result of a backref. Loading rows from ``child`` in this case would keep ``parent.deleted == False`` as is within the query, thereby yanking it into the FROM clause and doing a cartesian product. The new behavior will now substitute the value of the local "parent.deleted" for that parameter as is appropriate. Though typically, a real-world app probably wants to use a different primaryjoin for the o2m side in any case. fixes #2948
* - fairly epic rework of the cascade documentationMike Bayer2014-03-151-60/+14
|
* fix typosMike Bayer2014-02-281-1/+1
|
* - Added a new option to :paramref:`.relationship.innerjoin` which isMike Bayer2014-02-281-2/+13
| | | | | | | | | | | to specify the string ``"nested"``. When set to ``"nested"`` as opposed to ``True``, the "chaining" of joins will parenthesize the inner join on the right side of an existing outer join, instead of chaining as a string of outer joins. This possibly should have been the default behavior when 0.9 was released, as we introduced the feature of right-nested joins in the ORM, however we are keeping it as a non-default for now to avoid further surprises. fixes #2976
* this isn't really the mainstream use case here; would need to talkMike Bayer2014-02-161-6/+0
| | | | about non-equality operators in general.
* - extensive cross-linking of relationship options with their documentation ↵Mike Bayer2014-02-161-97/+232
| | | | | | sections - convert all paramter references in relationship documentation to :paramref:
* remove redundant see alsoMike Bayer2014-02-161-3/+0
|
* - add cross-linking for passive_deletes / passive_updatesMike Bayer2014-02-161-2/+13
|
* - cross link remote_side/self-referentialMike Bayer2014-02-141-1/+7
| | | | - trim off fn prefix on some relationship parameter names
* - Support is improved for supplying a :func:`.join` construct as theMike Bayer2014-01-221-4/+25
| | | | | | | | | | target of :paramref:`.relationship.secondary` for the purposes of creating very complex :func:`.relationship` join conditions. The change includes adjustments to query joining, joined eager loading to not render a SELECT subquery, changes to lazy loading such that the "secondary" target is properly included in the SELECT, and changes to declarative to better support specification of a join() object with classes as targets.
* - Fixed a bug involving the new flattened JOIN structures whichMike Bayer2014-01-131-4/+3
| | | | | | | | | | | are used with :func:`.joinedload()` (thereby causing a regression in joined eager loading) as well as :func:`.aliased` in conjunction with the ``flat=True`` flag and joined-table inheritance; basically multiple joins across a "parent JOIN sub" entity using different paths to get to a target class wouldn't form the correct ON conditions. An adjustment / simplification made in the mechanics of figuring out the "left side" of the join in the case of an aliased, joined-inh class repairs the issue. [ticket:2908]
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - Fixed regression where we don't check the given name against theMike Bayer2014-01-021-1/+1
| | | | | | correct string class when setting up a backref based on a name, therefore causing the error "too many values to unpack". This was related to the Py3k conversion. [ticket:2901]
* wrong method nameMike Bayer2013-12-161-1/+1
|
* load_on_pending is different from enable_relationship_loading and shouldMike Bayer2013-12-151-4/+6
| | | | not be superseded. both have a potential use.
* - Error message when a string arg sent to :func:`.relationship` whichMike Bayer2013-12-121-12/+10
| | | | | | | doesn't resolve to a class or mapper has been corrected to work the same way as when a non-string arg is received, which indicates the name of the relationship which had the configurational error. [ticket:2888]
* Fix indentation issues in docstringspr/43Vraj Mohan2013-11-121-2/+3
|
* An overhaul of expression handling for special symbols particularlyMike Bayer2013-10-231-1/+1
| | | | | | | | | | with conjunctions, e.g. ``None`` :func:`.expression.null` :func:`.expression.true` :func:`.expression.false`, including consistency in rendering NULL in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_` expressions which contain boolean constants, and rendering of boolean constants and expressions as compared to "1" or "0" for backends that don't feature ``true``/``false`` constants. [ticket:2804]
* these are in alphabetical orderMike Bayer2013-10-131-21/+21
|
* - Added new option to :func:`.relationship` ``distinct_target_key``.Mike Bayer2013-10-131-0/+23
| | | | | | | | | | | | | | | This enables the subquery eager loader strategy to apply a DISTINCT to the innermost SELECT subquery, to assist in the case where duplicate rows are generated by the innermost query which corresponds to this relationship (there's not yet a general solution to the issue of dupe rows within subquery eager loading, however, when joins outside of the innermost subquery produce dupes). When the flag is set to ``True``, the DISTINCT is rendered unconditionally, and when it is set to ``None``, DISTINCT is rendered if the innermost relationship targets columns that do not comprise a full primary key. The option defaults to False in 0.8 (e.g. off by default in all cases), None in 0.9 (e.g. automatic by default). Thanks to Alexander Koval for help with this. [ticket:2836]
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-061-5/+6
| | | | | | | | | | | | | - The system of loader options has been entirely rearchitected to build upon a much more comprehensive base, the :class:`.Load` object. This base allows any common loader option like :func:`.joinedload`, :func:`.defer`, etc. to be used in a "chained" style for the purpose of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``. The new system supersedes the usage of dot-separated path names, multiple attributes within options, and the usage of ``_all()`` options. - Added a new load option :func:`.orm.load_only`. This allows a series of column names to be specified as loading "only" those attributes, deferring the rest.
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-5/+1587
| | | | | | | | | - rework the event system so that event modules load after their targets, dependencies are reversed - create an improved strategy lookup system for the ORM - rework the ORM to have very few import cycles - move out "importlater" to just util.dependency - other tricks to cross-populate modules in as clear a way as possible
* - improve overlapping selectables, apply to both query and relationshipMike Bayer2013-06-041-6/+2
| | | | | | - clean up inspect() calls within query._join() - make sure join.alias(flat) propagates - fix almost all assertion tests
* Fixes to the ``sqlalchemy.ext.serializer`` extension, includingMike Bayer2013-04-261-2/+13
| | | | | | | that the "id" passed from the pickler is turned into a string to prevent against bytes being parsed on Py3K, as well as that ``relationship()`` and ``orm.join()`` constructs are now properly serialized. [ticket:2698] and some other observed issues.
* lintingMike Bayer2013-03-091-15/+12
|
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-42/+43
|
* - remove remote_foreign annotationMike Bayer2012-10-281-48/+15
| | | | - support annotations on Column where name isn't immediately present
* - fix annotation transfer when producing m2m backref, [ticket:2578]Mike Bayer2012-09-281-0/+14
|
* trailing whitespace bonanzaMike Bayer2012-07-281-69/+69
|
* - move all of orm to use absolute importsMike Bayer2012-06-231-11/+9
| | | | | | | | - break out key mechanics of loading objects into new "orm.loading" module, removing implementation details from both mapper.py and query.py. is analogous to persistence.py - some other cleanup and old cruft removal
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-4/+4
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.