summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* - several ORM attributes have been removed or made private:Mike Bayer2007-12-011-2/+3
| | | | | | | | mapper.get_attr_by_column(), mapper.set_attr_by_column(), mapper.pks_by_table, mapper.cascade_callable(), MapperProperty.cascade_callable(), mapper.canload() - refinements to mapper PK/table column organization, session cascading, some naming convention work
* - decruftify old visitors used by orm, convert to functions thatMike Bayer2007-11-241-99/+44
| | | | | | use a common traversal function. - TranslatingDict is finally gone, thanks to column.proxy_set simpleness...hooray ! - shoved "slice" use case on RowProxy into an exception case. knocks noticeable time off of large result set operations.
* - all kinds of cleanup, tiny-to-slightly-significant speed improvementsMike Bayer2007-11-241-0/+2
|
* - DeferredColumnLoader checks row for column, if present sends it toMike Bayer2007-11-141-0/+5
| | | | | ColumnLoader to create the row processor - eager loaders ensure deferred foreign key cols are present in the primary list of columns (and secondary...). because eager loading with LIMIT/OFFSET doesn't re-join to the parent table anymore this is now necessary. [ticket:864]
* more changes to traverse-and-clone; a particular element will only be cloned ↵Mike Bayer2007-11-081-8/+15
| | | | | | | | once and is then re-used. the FROM calculation of a Select normalizes the list of hide_froms against all previous incarnations of each FROM clause, using a tag attached from cloned clause to previous.
* - base_columns on ColumnElement becomes a list; as usual, because columns in ↵Mike Bayer2007-11-051-2/+2
| | | | | | | | | | | | | | | | CompoundSelects may extend from more than one root column. - keys_ok argument from corresponding_column() removed. no more name-based matching of columns anywhere. - DictDecorator is gone. all row translators provided by orm.util.create_row_adapter(). Mapper and contains_alias() cache the adapters on target mapper to avoid re-computation of adapters. - create_row_adapter() accepts an "equivalent_columns" map as produced by Mapper, so that row adapters can take join conditions into account (as usual again, to help with the CompoundSelects produced by polymorphic_union). - simplified TableSingleton to just provide lookup; moved all initialization into Table. - the "properties" accessor on Mapper is removed; it now throws an informative exception explaining the usage of mapper.get_property() and mapper.iterate_properties
* - rewritten ClauseAdapter merged from the eager_minus_join branch; this is a ↵Mike Bayer2007-11-031-73/+68
| | | | | | | | much simpler and "correct" version which will copy all elements exactly once, except for those which were replaced with target elements. It also can match a wider variety of target elements including joins and selects on identity alone.
* - merged factor_down_bindparams branch.Mike Bayer2007-11-011-101/+0
| | | | | | - removed ClauseParameters object; compiled.params returns a regular dictionary now, as well as result.last_inserted_params()/last_updated_params(). - various code trimming, method removals.
* Inlined ClauseParameters.set_parameter (simple assignment) in construct_paramsJason Kirtland2007-08-211-17/+23
| | | | Big drop in function count for inserts (22%) with about a 3% wall clock improvement.
* - implemented __len__() accessor on RowProxyMike Bayer2007-08-211-21/+14
| | | | - implemented jek's ClauseParameters optimization for named params
* A couple critical path optimizationsJason Kirtland2007-08-211-3/+14
| | | | (some sql operations faster by nearly 10% wallclock, general orm around 3%)
* 1. Module layout. sql.py and related move into a package called "sql".Mike Bayer2007-08-181-0/+342
2. compiler names changed to be less verbose, unused classes removed. 3. Methods on Dialect which return compilers, schema generators, identifier preparers have changed to direct class references, typically on the Dialect class itself or optionally as attributes on an individual Dialect instance if conditional behavior is needed. This takes away the need for Dialect subclasses to know how to instantiate these objects, and also reduces method overhead by one call for each one. 4. as a result of 3., some internal signatures have changed for things like compiler() (now statement_compiler()), preparer(), etc., mostly in that the dialect needs to be passed explicitly as the first argument (since they are just class references now). The compiler() method on Engine and Connection is now also named statement_compiler(), but as before does not take the dialect as an argument. 5. changed _process_row function on RowProxy to be a class reference, cuts out 50K method calls from insertspeed.py