summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/util.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-1/+1
| | | | Found using: https://github.com/intgr/topy
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - documentation cleanup in ORM including [ticket:2816]Mike Bayer2013-12-071-12/+40
|
* - Added new argument ``include_backrefs=True`` to theMike Bayer2013-12-021-6/+25
| | | | | | | :func:`.validates` function; when set to False, a validation event will not be triggered if the event was initated as a backref to an attribute operation from the other side. [ticket:1535] - break out validation tests into an updated module test_validators
* - Some refinements to the :class:`.AliasedClass` construct with regardsMike Bayer2013-11-231-14/+6
| | | | | | | | | | | | | | | to descriptors, like hybrids, synonyms, composites, user-defined descriptors, etc. The attribute adaptation which goes on has been made more robust, such that if a descriptor returns another instrumented attribute, rather than a compound SQL expression element, the operation will still proceed. Addtionally, the "adapted" operator will retain its class; previously, a change in class from ``InstrumentedAttribute`` to ``QueryableAttribute`` (a superclass) would interact with Python's operator system such that an expression like ``aliased(MyClass.x) > MyClass.x`` would reverse itself to read ``myclass.x < myclass_1.x``. The adapted attribute will also refer to the new :class:`.AliasedClass` as its parent which was not always the case before. [ticket:2872]
* Fixed a potential issue in an ordered sequence implementation usedMike Bayer2013-08-181-0/+1
| | | | | | | by the ORM to iterate mapper hierarchies; under the Jython interpreter this implementation wasn't ordered, even though cPython and Pypy maintained ordering. Also in 0.8.3. [ticket:2794]
* - spot checking of imports, obsolete functionsMike Bayer2013-08-171-2/+1
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-422/+7
| | | | | | | | | - 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
* remove double methodsMike Bayer2013-06-171-19/+0
|
* - rework PropComparator.adapted() to be PropComparator.adapt_to_entity(),Mike Bayer2013-06-171-81/+100
| | | | | | | passes in AliasedInsp and allows more flexibility. - rework the AliasedClass/AliasedInsp relationship so that AliasedInsp has all state and functionality. AliasedClass is just a facade. [ticket:2756]
* Fixed the interaction between composite attributes andMike Bayer2013-06-101-1/+0
| | | | | | the :func:`.aliased` function. Previously, composite attributes wouldn't work correctly in comparison operations when aliasing was applied. Also in 0.8.2. [ticket:2755]
* - tests for the alias() APIMike Bayer2013-06-081-0/+26
| | | | - docs docs docs
* - Fixed an obscure bug where the wrong results would beMike Bayer2013-06-071-2/+7
| | | | | | | | | | | fetched when joining/joinedloading across a many-to-many relationship to a single-table-inheriting subclass with a specific discriminator value, due to "secondary" rows that would come back. The "secondary" and right-side tables are now inner joined inside of parenthesis for all ORM joins on many-to-many relationships so that the left->right join can accurately filtered. [ticket:2369]
* dial back the default "flatness" a bit, it will be there for joinedload and ↵Mike Bayer2013-06-061-9/+11
| | | | | | | query.join(), but if you're dealing with aliased() or with_polymorphic() you need to say "flat=True". Just the one flag though, "flat" implies "aliased".
* - eager loadsMike Bayer2013-06-041-1/+1
| | | | - two suite of SQL assertions converted
* here's the flat join thing. it just works. Changing the existing compiled ↵Mike Bayer2013-06-041-2/+3
| | | | | | SQL assertions might even be most of the tests we need (though dedicated sql tests would be needed anyway)
* - blow away context._attributesMike Bayer2013-06-021-11/+11
| | | | | - to account for query._attributes/context.attributes, just pass the attributes dict directly to the PathRegistry methods
* repair py3kisms in key ORM modulesMike Bayer2013-05-261-5/+5
|
* merge defaultMike Bayer2013-05-131-1/+8
|\
| * Fixed a regression from 0.7 caused by this ticket, whichMike Bayer2013-05-131-1/+8
| | | | | | | | | | | | | | | | made the check for recursion overflow in self-referential eager joining too loose, missing a particular circumstance where a subclass had lazy="joined" or "subquery" configured and the load was a "with_polymorphic" against the base. [ticket:2481]
* | most of ORM passing...Mike Bayer2013-05-041-0/+1
| |
* | - the raw 2to3 runMike Bayer2013-04-271-12/+12
|/ | | | - went through examples/ and cleaned out excess list() calls
* we can always adapt to right also. suppose if rightMike Bayer2013-04-251-5/+1
| | | | were an alias of a table, should add tests for that.
* cleanupMike Bayer2013-04-251-51/+15
|
* everything passes with this!!!!!!! holy crap !!!!! and its the simplest of allMike Bayer2013-04-251-57/+69
|
* - attempt to replace the whole idea of "join_to_left" with a moreMike Bayer2013-04-241-10/+22
| | | | | fundamental and general purpose heuristic. this initial approach has about 60 tests failing but seems to have gone pretty far
* - Fixed bug in unit of work whereby a joined-inheritanceMike Bayer2013-04-011-0/+37
| | | | | | | | | | | subclass could insert the row for the "sub" table before the parent table, if the two tables had no ForeignKey constraints set up between them. Also in 0.7.11. [ticket:2689] - fix a glitch in the assertsql.CompiledSQL fixture regarding when a multiparam compiledSQL is used within an AllOf - add a new utility function randomize_unitofwork() which does the function of --reversetop
* - Added new helper function :func:`.was_deleted`, returns TrueMike Bayer2013-02-201-0/+21
| | | | | | | | | if the given object was the subject of a :meth:`.Session.delete` operation. - An object that's deleted from a session will be de-associated with that session fully after the transaction is committed, that is the :func:`.object_session` function will return None. [ticket:2658]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* - refactor of pathing mechanics, to address #2614, #2617Mike Bayer2012-12-011-56/+133
| | | | | | | | | | | | | | | | | | | - paths now store Mapper + MapperProperty now instead of string key, so that the parent mapper for the property is known, supports same-named properties on multiple subclasses - the Mapper within the path is now always relevant to the property to the right of it. PathRegistry does the translation now, instead of having all the outside users of PathRegistry worry about it, to produce a path that is much more consistent. Paths are now consistent with mappings in all cases. Special logic to get at "with_polymorphic" structures and such added also. - AliasedClass now has two modes, "use_mapper_path" and regular; "use_mapper_path" is for all those situations where we put an AliasedClass in for a plain class internally, and want it to "path" with the plain mapper. - The AliasedInsp is now the first class "entity" for an AliasedClass, and is passed around internally and used as attr._parententity and such. it is the AliasedClass analogue for Mapper.
* Added a new exception to detect the case where twoMike Bayer2012-11-241-0/+6
| | | | | | | | | | | subclasses are being loaded using with_polymorphic(), each subclass contains a relationship attribute of the same name, and eager loading is being applied to one or both. This is an ongoing bug which can't be immediately fixed, so since the results are usually wrong in any case it raises an exception for now. 0.7 has the same issue, so an exception raise here probably means the code was returning the wrong data in 0.7. [ticket:2614]
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-1/+35
|
* - do a straight __subclasses__ traversal here, so that we aren'tMike Bayer2012-10-281-1/+2
| | | | | | iterating through all mappers in memory when a new event is tacked onto an unmapped superclass, also removes the strong ref that was breaking some GC teardown tests
* - more docsMike Bayer2012-10-261-1/+1
| | | | - it appears we can get rid of all those "XYZ_toplevel" names and use :doc:.
* - add class_ to AliasedInspMike Bayer2012-10-261-0/+9
| | | | | | - redefine inspect(Class.attrname).parent to be always an inspectable target; either Mapper or AliasedInsp - add most major features to 08 migration, document, link
* - some naming changes on PropComparator, Comparator:Mike Bayer2012-10-251-1/+1
| | | | | | | | | | | | | 1. all Comparators now have "parent" which is always the parent mapper or AliasedClass instance 2. only RelationshipProperty.Comparator has "mapper" now, which is the target mapper 3. The names "parententity" and "parentmapper" are underscored also improved the message with the "neither comparator nor instruentedattribute...." to include the classname + attribute name
* - [feature] "scalar" selects now have a WHERE methodMike Bayer2012-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | to help with generative building. Also slight adjustment regarding how SS "correlates" columns; the new methodology no longer applies meaning to the underlying Table column being selected. This improves some fairly esoteric situations, and the logic that was there didn't seem to have any purpose. - [feature] Some support for auto-rendering of a relationship join condition based on the mapped attribute, with usage of core SQL constructs. E.g. select([SomeClass]).where(SomeClass.somerelationship) would render SELECT from "someclass" and use the primaryjoin of "somerelationship" as the WHERE clause. This changes the previous meaning of "SomeClass.somerelationship" when used in a core SQL context; previously, it would "resolve" to the parent selectable, which wasn't generally useful. Related to [ticket:2245].
* - add support for integer indexes and slices to PathRegistryMike Bayer2012-10-111-3/+15
| | | | - write a full test suite for PathRegistry
* - remove an unused function, hoorayMike Bayer2012-08-081-14/+0
|
* - [bug] Improvements to joined/subquery eagerMike Bayer2012-08-061-1/+1
| | | | | | | | | loading dealing with chains of subclass entities sharing a common base, with no specific "join depth" provided. Will chain out to each subclass mapper individually before detecting a "cycle", rather than considering the base class to be the source of the "cycle". [ticket:2481]
* - [feature] ORM entities can be passedMike Bayer2012-07-231-7/+0
| | | | | | | to select() as well as the select_from(), correlate(), and correlate_except() methods, where they will be unwrapped into selectables. [ticket:2245]
* a lot of docsMike Bayer2012-07-181-45/+90
|
* - document the inspection systemMike Bayer2012-07-181-9/+50
|
* - totally remove _entity_info and _extended_entity_info, replacing all usageMike Bayer2012-07-161-39/+18
| | | | with inspect()
* some test fixes and cleanupMike Bayer2012-07-161-8/+10
|
* - express most of the orm.util functions in terms of the inspection systemMike Bayer2012-07-161-241/+259
| | | | | | | | | | | | | | - modify inspection system: 1. raise a new exception for any case where the inspection context can't be returned. this supersedes the "not mapped" errors. 2. don't configure mappers on a mapper inspection. this allows the inspectors to be used during mapper config time. instead, the mapper configures on "with_polymorphic_selectable" now, which is needed for all queries - add a bunch of new "is_XYZ" attributes to inspectors - finish making the name change of "compile" -> "configure", for some reason this was only done partially
* - move all of orm to use absolute importsMike Bayer2012-06-231-11/+11
| | | | | | | | - 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
* - [feature] The of_type() construct on attributesMike Bayer2012-06-201-22/+182
| | | | | | | | | | | | | | | | | | | | | | | | now accepts aliased() class constructs as well as with_polymorphic constructs, and works with query.join(), any(), has(), and also eager loaders subqueryload(), joinedload(), contains_eager() [ticket:2438] [ticket:1106] - a rewrite of the query path system to use an object based approach for more succinct usage. the system has been designed carefully to not add an excessive method overhead. - [feature] select() features a correlate_except() method, auto correlates all selectables except those passed. Is needed here for the updated any()/has() functionality. - remove some old cruft from LoaderStrategy, init(),debug_callable() - use a namedtuple for _extended_entity_info. This method should become standard within the orm internals - some tweaks to the memory profile tests, number of runs can be customized to work around pysqlite's very annoying behavior - try to simplify PropertyOption._get_paths(), rename to _process_paths(), returns a single list now. overall works more completely as was needed for of_type() functionality
* - [bug] Fixed identity_key() function whichMike Bayer2012-06-111-1/+1
| | | | | | was not accepting a scalar argument for the identity. [ticket:2508]. Also in 0.7.8.
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-12/+11
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.