summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
Commit message (Collapse)AuthorAgeFilesLines
* - 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]
* docstrings for the hated fold_equivalents argument/functionMike Bayer2009-01-031-1/+4
|
* missed an ordering on a set. attempting to nail down linux-specific ↵Mike Bayer2008-12-191-1/+1
| | | | buildbot errors
* merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 ↵Mike Bayer2008-12-181-8/+9
| | | | | | | | 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.
* - turn __visit_name__ into an explicit member.Mike Bayer2008-12-111-2/+4
| | | | [ticket:1244]
* dont use names to find Annotated subclassesMike Bayer2008-12-091-4/+9
|
* - Two fixes to help prevent out-of-band columns fromMike Bayer2008-12-031-3/+3
| | | | | | | | | | | | | | | | | | being rendered in polymorphic_union inheritance scenarios (which then causes extra tables to be rendered in the FROM clause causing cartesian products): - improvements to "column adaption" for a->b->c inheritance situations to better locate columns that are related to one another via multiple levels of indirection, rather than rendering the non-adapted column. - the "polymorphic discriminator" column is only rendered for the actual mapper being queried against. The column won't be "pulled in" from a subclass or superclass mapper since it's not needed.
* - Fixed bug in Query involving order_by() in conjunction withMike Bayer2008-11-061-3/+26
| | | | | | | | | | | | | | | | multiple aliases of the same class (will add tests in [ticket:1218]) - Added a new extension sqlalchemy.ext.serializer. Provides Serializer/Deserializer "classes" which mirror Pickle/Unpickle, as well as dumps() and loads(). This serializer implements an "external object" pickler which keeps key context-sensitive objects, including engines, sessions, metadata, Tables/Columns, and mappers, outside of the pickle stream, and can later restore the pickle using any engine/metadata/session provider. This is used not for pickling regular object instances, which are pickleable without any special logic, but for pickling expression objects and full Query objects, such that all mapper/engine/session dependencies can be restored at unpickle time.
* - Improved the behavior of aliased() objects such that they moreMike Bayer2008-11-031-7/+63
| | | | | | | | | | | accurately adapt the expressions generated, which helps particularly with self-referential comparisons. [ticket:1171] - Fixed bug involving primaryjoin/secondaryjoin conditions constructed from class-bound attributes (as often occurs when using declarative), which later would be inappropriately aliased by Query, particularly with the various EXISTS based comparators.
* - Fixed bug whereby mapper couldn't initialize if a compositeMike Bayer2008-09-041-2/+14
| | | | | primary key referenced another table that was not defined yet [ticket:1161]
* - fixed a bug in declarative test which was looking for old version of historyMike Bayer2008-08-191-6/+2
| | | | | | | | | | - Added "sorted_tables" accessor to MetaData, which returns Table objects sorted in order of dependency as a list. This deprecates the MetaData.table_iterator() method. The "reverse=False" keyword argument has also been removed from util.sort_tables(); use the Python 'reversed' function to reverse the results. [ticket:1033]
* commentMike Bayer2008-08-081-1/+5
|
* - Dropped `reversed` emulationJason Kirtland2008-07-151-1/+1
|
* - Removed 2.3 set emulations/enhancements.Jason Kirtland2008-07-151-6/+6
| | | | (sets.Set-based collections & DB-API returns still work.)
* - PropertyLoader.foreign_keys becomes privateMike Bayer2008-05-241-1/+1
| | | | | - removed most __foo() defs from properties.py - complexity reduction in PropertyLoader.do_init()
* - fixed a fairly critical bug in clause adaption/corresponding column in ↵Mike Bayer2008-05-091-1/+6
| | | | | | | conjunction with annotations - implicit order by is removed, modified many tests to explicitly set ordering, probably many more to go once it hits the buildbot.
* r4695 merged to trunk; trunk now becomes 0.5.Mike Bayer2008-05-091-112/+171
| | | | 0.4 development continues at /sqlalchemy/branches/rel_0_4
* - an unfortunate naming conflictMike Bayer2008-05-021-3/+3
| | | | - needed sql import on and()
* - factored out the logic used by Join to create its join conditionMike Bayer2008-05-021-1/+57
| | | | | | | - With declarative, joined table inheritance mappers use a slightly relaxed function to create the "inherit condition" to the parent table, so that other foreign keys to not-yet-declared Table objects don't trigger an error.
* - merged -r4458:4466 of query_columns branchMike Bayer2008-04-071-0/+36
| | | | | | | - this branch changes query.values() to immediately return an iterator, adds a new "aliased" construct which will be the primary method to get at aliased columns when using values() - tentative ORM versions of _join and _outerjoin are not yet public, would like to integrate with Query better (work continues in the branch) - lots of fixes to expressions regarding cloning and correlation. Some apparent ORM bug-workarounds removed. - to fix a recursion issue with anonymous identifiers, bind parameters generated against columns now just use the name of the column instead of the tablename_columnname label (plus the unique integer counter). this way expensive recursive schemes aren't needed for the anon identifier logic. This, as usual, impacted a ton of compiler unit tests which needed a search-n-replace for the new bind names.
* - merged sync_simplify branchMike Bayer2008-04-041-2/+40
| | | | | | | | | | | | | | | | - The methodology behind "primaryjoin"/"secondaryjoin" has been refactored. Behavior should be slightly more intelligent, primarily in terms of error messages which have been pared down to be more readable. In a slight number of scenarios it can better resolve the correct foreign key than before. - moved collections unit test from relationships.py to collection.py - PropertyLoader now has "synchronize_pairs" and "equated_pairs" collections which allow easy access to the source/destination parent/child relation between columns (might change names) - factored out ClauseSynchronizer (finally) - added many more tests for priamryjoin/secondaryjoin error checks
* - merged with_polymorphic branch, which was merged with query_columns branchMike Bayer2008-03-291-39/+44
| | | | | | | | | | | | | | | | | - removes everything to do with select_table, which remains as a keyword argument synonymous with with_polymorphic=('*', select_table). - all "polymorphic" selectables find their way to Query by way of _set_select_from() now, so that all joins/aliasing/eager loads/etc. is handled consistently. Mapper has methods for producing polymorphic selectables so that Query and eagerloaders alike can get to them. - row aliasing simplified, so that they don't need to nest. they only need the source selectable and adapt to whatever incoming columns they get. - Query is more egalitarian about mappers/columns now. Still has a strong sense of "entity zero", but also introduces new unpublished/experimental _values() method which sets up a columns-only query. - Query.order_by() and Query.group_by() take *args now (also still take a list, will likely deprecate in 0.5). May want to do this for select() as well. - the existing "check for False discriminiator" "fix" was not working completely, added coverage - orphan detection was broken when the target object was a subclass of the mapper with the orphaned relation, fixed that too.
* removed AbstractClauseProcessor, merged its copy-and-visit behavior into ↵Mike Bayer2008-03-241-101/+14
| | | | ClauseVisitor
* - fixed bug which was preventing UNIONS from being cloneable,Mike Bayer2008-03-041-0/+6
| | | | [ticket:986]
* - Fixed a couple pyflakes, cleaned up imports & whitespaceJason Kirtland2008-02-141-40/+38
|
* more capability added to reduce_columnsMike Bayer2008-01-231-3/+7
|
* factor create_row_adapter into sql.util.row_adapterMike Bayer2008-01-201-0/+41
|
* maintain the ordering of the given collection of columns when reducing so ↵Mike Bayer2008-01-151-1/+1
| | | | | | that primary key collections remain ordered the same as in the mapped table
* finally, a really straightforward reduce() method which reduces colsMike Bayer2008-01-151-12/+24
| | | | | | | to the minimal set for every test case I can come up with, and now replaces all the cruft in Mapper._compile_pks() as well as Join.__init_primary_key(). mappers can now handle aliased selects and figure out the correct PKs pretty well [ticket:933]
* - select_table mapper turns straight join into aliased select + custom PK, ↵Mike Bayer2008-01-151-1/+29
| | | | | | | to allow joins onto select_table mappers - starting a generalized reduce_columns func
* - applying some refined versions of the ideas in the smarter_polymorphicMike Bayer2008-01-141-0/+19
| | | | | | | | | | | | branch - slowly moving Query towards a central "aliasing" paradigm which merges the aliasing of polymorphic mappers to aliasing against arbitrary select_from(), to the eventual goal of polymorphic mappers which can also eagerload other relations - supports many more join() scenarios involving polymorphic mappers in most configurations - PropertyAliasedClauses doesn't need "path", EagerLoader doesn't need to guess about "towrap"
* - cleanup; lambdas removed from properties; properties mirror same-named ↵Mike Bayer2007-12-181-2/+2
| | | | | | functions (more like eventual decorator syntax); remove some old methods, factor out some "raiseerr" ugliness to outer lying functions. - corresponding_column() integrates "require_embedded" flag with other set arithmetic
* - more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads,Mike Bayer2007-12-161-7/+10
| | | | | | | | in this case when mapped against a select statement [ticket:904] - _hide_froms logic in expression totally localized to Join class, including search through previous clone sources - removed "stop_on" from main visitors, not used - "stop_on" in AbstractClauseProcessor part of constructor, ClauseAdapter sets it up based on given clause - fixes to is_derived_from() to take previous clone sources into account, Alias takes self + cloned sources into account. this is ultimately what the #904 bug was.
* - flush() refactor merged from uow_nontree branch r3871-r3885Mike Bayer2007-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - topological.py cleaned up, presents three public facing functions which return list/tuple based structures, without exposing any internals. only the third function returns the "hierarchical" structure. when results include "cycles" or "child" items, 2- or 3- tuples are used to represent results. - unitofwork uses InstanceState almost exclusively now. new and deleted lists are now dicts which ref the actual object to provide a strong ref for the duration that they're in those lists. IdentitySet is only used for the public facing versions of "new" and "deleted". - unitofwork topological sort no longer uses the "hierarchical" version of the sort for the base sort, only for the "per-object" secondary sort where it still helps to group non-dependent operations together and provides expected insert order. the default sort deals with UOWTasks in a straight list and is greatly simplified. Tests all pass but need to see if svilen's stuff still works, one block of code in _sort_cyclical_dependencies() seems to not be needed anywhere but i definitely put it there for a reason at some point; if not hopefully we can derive more test coverage from that. - the UOWEventHandler is only applied to object-storing attributes, not scalar (i.e. column-based) ones. cuts out a ton of overhead when setting non-object based attributes. - InstanceState also used throughout the flush process, i.e. dependency.py, mapper.save_obj()/delete_obj(), sync.execute() all expect InstanceState objects in most cases now. - mapper/property cascade_iterator() takes InstanceState as its argument, but still returns lists of object instances so that they are not dereferenced. - a few tricks needed when dealing with InstanceState, i.e. when loading a list of items that are possibly fresh from the DB, you *have* to get the actual objects into a strong-referencing datastructure else they fall out of scope immediately. dependency.py caches lists of dependent objects which it loads now (i.e. history collections). - AttributeHistory is gone, replaced by a function that returns a 3-tuple of added, unchanged, deleted. these collections still reference the object instances directly for the strong-referencing reasons mentiontioned, but it uses less IdentitySet logic to generate.
* a little refinement to topological options, more to comeMike Bayer2007-12-071-1/+1
|