summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
Commit message (Collapse)AuthorAgeFilesLines
* - merged #1401 branch from bitbucketMike Bayer2012-04-221-36/+128
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - resolved some serious speed hits I missed, we need to ensure only deannotated columns are used in the local/remote collections and soforth so that hash lookups against mapped columns don't dig into __eq__() - fix some other parity mismatches regarding stuff from [ticket:2453], including finding another case where _deep_annotate() was doing the wrong thing, new tests. - [feature] Major rewrite of relationship() internals now allow join conditions which include columns pointing to themselves within composite foreign keys. A new API for very specialized primaryjoin conditions is added, allowing conditions based on SQL functions, CAST, etc. to be handled by placing the annotation functions remote() and foreign() inline within the expression when necessary. Previous recipes using the semi-private _local_remote_pairs approach can be upgraded to this new approach. [ticket:1401]
| * start to work on error messages, allow foreign_keys as only argumentMike Bayer2012-02-251-3/+11
| | | | | | | | if otherwise can't determine join condition due to no fks
| * - figured out again why deannotate must clone()Mike Bayer2012-02-111-2/+2
| | | | | | | | | | - got everything working. just need to update error strings
| * many fixes but still can't get heuristics to work as well as what's existing,Mike Bayer2012-02-111-2/+1
| | | | | | | | tests still failing
| * tweak for correlated subqueries here, seems to work for ↵Mike Bayer2012-02-101-1/+6
| | | | | | | | test_eager_relations:CorrelatedSubqueryTest but need some more testing here
| * - got m2m, local_remote_pairs, etc. workingMike Bayer2012-02-091-6/+70
| | | | | | | | | | | | | | | | - using new traversal that returns the product of both sides of a binary, starting to work with (a+b) == (c+d) types of joins. primaryjoins on functions working - annotations working, including reversing local/remote when doing backref
| * initial annotations approach to join conditions. all tests pass, plus ↵Mike Bayer2012-02-061-17/+31
| | | | | | | | | | | | additional tests in #1401 pass. would now like to reorganize RelationshipProperty more around the annotations concept.
* | - [bug] Fixed bug in expression annotationMike Bayer2012-03-311-9/+21
|/ | | | | | | mechanics which could lead to incorrect rendering of SELECT statements with aliases and joins, particularly when using column_property(). [ticket:2453]
* - Fixed regression from 0.6 whereby ifMike Bayer2012-01-101-7/+1
| | | | | | | "load_on_pending" relationship() flag were used where a non-"get()" lazy clause needed to be emitted on a pending object, it would fail to load.
* happy new yearMike Bayer2012-01-041-1/+1
|
* - added "adapt_on_names" boolean flag to orm.aliased()Mike Bayer2011-09-191-2/+4
| | | | | | | | construct. Allows an aliased() construct to link the ORM entity to a selectable that contains aggregates or other derived forms of a particular attribute, provided the name is the same as that of the entity mapped column.
* - Improvement to multi-param statement logging,Mike Bayer2011-08-221-0/+22
| | | | | | | | long lists of bound parameter sets will be compressed with an informative indicator of the compression taking place. Exception messages use the same improved formatting. [ticket:2243]
* - rework Annotated to no longer use __cmp__(), supply an __eq__() thatMike Bayer2011-07-241-2/+6
| | | | | works with ColumnElement as well as works with non-__eq__() suppliers, works with sets, on Py3K as well.
* - rewrite cloned_traverse() and replacement_traverse() to use a straightMike Bayer2011-07-241-1/+12
| | | | | | | | | | | | | | | | recursive descent with clone() + _copy_internals(). This is essentially what it was doing anyway with lots of unnecessary steps. Fix Alias() to honor the given clone() function which may have been the reason the traversal hadn't been fixed sooner. Alias._copy_internals() will specifically skip an alias of a Table as a more specific form of what it was doing before. This may need to be further improved such that ClauseAdapter or replacement_traverse() send it some specific hints what not to dig into; **kw has been added to all _copy_internals() to support this. replacement/clone traversal is at least clear now. - apply new no_replacement_traverse annotation to join created by _create_joins(), fixes [ticket:2195] - can replace orm.query "_halt_adapt" with "no_replacement_traverse"
* - The join condition produced by with_parentMike Bayer2011-07-061-2/+4
| | | | | | | | as well as when using a "dynamic" relationship against a parent will generate unique bindparams, rather than incorrectly repeating the same bindparam. [ticket:2207]. Also in 0.6.9.
* - Fixed subtle bug that caused SQL to blowMike Bayer2011-06-271-2/+26
| | | | | | | up if: column_property() against subquery + joinedload + LIMIT + order by the column property() occurred. [ticket:2188]. Also in 0.6.9
* - Changed the handling in determination of joinMike Bayer2011-05-071-14/+13
| | | | | | | | | | | conditions such that foreign key errors are only considered between the two given tables. That is, t1.join(t2) will report FK errors that involve 't1' or 't2', but anything involving 't3' will be skipped. This affects join(), as well as ORM relationship and inherit condition logic. Will keep the more conservative approach to [ticket:2153] in 0.6.
* corrected a bunch of spelling typosDiana Clarke2011-02-281-1/+1
|
* - whitespace removal bonanzaMike Bayer2011-01-021-73/+73
|
* - clean up copyright, update for 2011, stamp every file withMike Bayer2011-01-021-0/+6
| | | | | a consistent tag - AUTHORS file
* - remove OrderedSet usage from a critical areaMike Bayer2010-12-221-3/+8
|
* - move topological, queue into utilMike Bayer2010-12-051-1/+2
| | | | | - move function_named into test.lib.util - use @decorator for all decorators in test/
* - Patched a case where query.join() would adapt theMike Bayer2010-09-211-0/+19
| | | | | right side to the right side of the left's join inappropriately [ticket:1925]
* - lazy loads for relationship attributes now useMike Bayer2010-09-121-0/+25
| | | | | | | | | | | | | | | | | | | | | the current state, not the "committed" state, of foreign and primary key attributes when issuing SQL, if a flush is not in process. Previously, only the database-committed state would be used. In particular, this would cause a many-to-one get()-on-lazyload operation to fail, as autoflush is not triggered on these loads when the attributes are determined and the "committed" state may not be available. [ticket:1910] - A new flag on relationship(), load_on_pending, allows the lazy loader to fire off on pending objects without a flush taking place, as well as a transient object that's been manually "attached" to the session. Note that this flag blocks attribute events from taking place when an object is loaded, so backrefs aren't available until after a flush. The flag is only intended for very specific use cases.
* - Fixed bug that would prevent overridden clauseMike Bayer2010-06-261-3/+5
| | | | | compilation from working for "annotated" expression elements, which are often generated by the ORM.
* - Modified the internals of "column annotation" such thatMike Bayer2010-06-141-1/+1
| | | | | | | a custom Column subclass can safely override _constructor to return Column, for the purposes of making "configurational" column classes that aren't involved in proxying, etc.
* - Added table.add_is_dependent_on(othertable), allows manualMike Bayer2010-05-131-0/+5
| | | | | | placement of dependency rules between two Table objects for use within create_all(), drop_all(), sorted_tables. [ticket:1801]
* - the _make_proxy() method of ColumnClause and Column now useMike Bayer2010-05-101-0/+4
| | | | | | | self.__class__ to determine the class of object to be returned instead of hardcoding to ColumnClause/Column, making it slightly easier to produce specific subclasses of these which work in alias/subquery situations.
* remove a few superfluous importsMike Bayer2010-04-291-1/+0
|
* breakthrough, wowMike Bayer2010-04-051-1/+1
|
* deletes, rudimentary many-to-onesMike Bayer2010-03-311-2/+0
|
* really got topological going. now that we aren't putting fricking mapped ↵Mike Bayer2010-03-311-2/+5
| | | | | | objects into it all that id() stuff can go
* - Fixed bug in Query whereby the usage of aliased() constructsMike Bayer2010-03-231-4/+6
| | | | | | would fail if the underlying table (but not the actual alias) were referenced inside the subquery generated by q.from_self() or q.select_from().
* - join() will now simulate a NATURAL JOIN by default. Meaning,Mike Bayer2010-03-191-25/+53
| | | | | | | | if the left side is a join, it will attempt to join the right side to the rightmost side of the left first, and not raise any exceptions about ambiguous join conditions if successful even if there are further join targets across the rest of the left. [ticket:1714]
* - fixed internal error which would occur if calling has()Mike Bayer2010-03-111-1/+3
| | | | | or similar complex expression on a single-table inheritance relation(). [ticket:1731]
* - The type/expression system now does a more complete jobMike Bayer2010-02-111-86/+0
| | | | | | | | | | | | | | | | | | of determining the return type from an expression as well as the adaptation of the Python operator into a SQL operator, based on the full left/right/operator of the given expression. In particular the date/time/interval system created for Postgresql EXTRACT in [ticket:1647] has now been generalized into the type system. The previous behavior which often occured of an expression "column + literal" forcing the type of "literal" to be the same as that of "column" will now usually not occur - the type of "literal" is first derived from the Python type of the literal, assuming standard native Python types + date types, before falling back to that of the known type on the other side of the expression. Also part of [ticket:1683].
* fixed DDL quoting with literal strings that have ' [ticket:1640]Mike Bayer2010-01-031-1/+8
|
* merge r6591, r6592 from 0.5 branch for PGInterval etc. /extractMike Bayer2009-12-291-0/+3
|
* - merge r6586 from 0.5 branch, for [ticket:1647]Mike Bayer2009-12-291-1/+85
|
* - Session.execute() now locates table- andMike Bayer2009-12-081-2/+8
| | | | | | mapper-specific binds based on a passed in expression which is an insert()/update()/delete() construct. [ticket:1054]
* - reworked the DDL generation of ENUM and similar to be more platform agnostic.Mike Bayer2009-12-061-0/+20
| | | | | | | Uses a straight CheckConstraint with a generic expression. Preparing for boolean constraint in [ticket:1589] - CheckConstraint now accepts SQL expressions, though support for quoting of values will be very limited. we don't want to get into formatting dates and such.
* - query.get() can be used with a mapping to an outer joinMike Bayer2009-11-091-0/+18
| | | | | where one or more of the primary key values are None. [ticket:1135]
* some cleanupMike Bayer2009-10-211-11/+22
|
* merge from branches/clauseelement-nonzeroPhilip Jenvey2009-09-241-7/+7
| | | | | | adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash collisions (which only occur on Jython) fixes #1547
* - Fixed an obscure issue whereby a joined-table subclassMike Bayer2009-08-281-1/+12
| | | | | | | with a self-referential eager load on the base class would populate the related object's "subclass" table with data from the "subclass" table of the parent. [ticket:1485]
* merged [ticket:1486] fix from 0.6Mike Bayer2009-07-281-1/+1
|
* - Fixed bug whereby a load/refresh of joined tableMike Bayer2009-07-251-7/+4
| | | | | | inheritance attributes which were based on column_property() or similar would fail to evaluate. [ticket:1480]
* - It is now an error to specify both columns of a binary primaryjoinMike Bayer2009-05-081-4/+4
| | | | | | condition in the foreign_keys or remote_side collection. Whereas previously it was just nonsensical, but would succeed in a non-deterministic way.
* - Fixed bug in relation(), introduced in 0.5.3,Mike Bayer2009-04-021-0/+1
| | | | | | whereby a self referential relation from a base class to a joined-table subclass would not configure correctly.
* - Query.join() can now construct multiple FROM clauses, ifMike Bayer2009-03-151-8/+24
| | | | | | | needed. Such as, query(A, B).join(A.x).join(B.y) might say SELECT A.*, B.* FROM A JOIN X, B JOIN Y. Eager loading can also tack its joins onto those multiple FROM clauses. [ticket:1337]