Mike Bayer [Sun, 25 Nov 2007 23:14:03 +0000 (23:14 +0000)]
- added new flag to String and create_engine(), assert_unicode=(True|False|None).
When convert_unicode=True, this flag also defaults to `True`, and results in all
unicode conversion operations raising an exception when a non-unicode bytestring
is passed as a bind parameter. It is strongly advised that all unicode-aware
applications make proper use of Python unicode objects (i.e. u'hello' and
not 'hello').
Mike Bayer [Sun, 25 Nov 2007 03:28:49 +0000 (03:28 +0000)]
- named_with_column becomes an attribute
- cleanup within compiler visit_select(), column labeling
- is_select() removed from dialects, replaced with returns_rows_text(), returns_rows_compiled()
- should_autocommit() removed from dialects, replaced with should_autocommit_text() and
should_autocommit_compiled()
- typemap and column_labels collections removed from Compiler, replaced with single "result_map" collection.
- ResultProxy uses more succinct logic in combination with result_map to target columns
Mike Bayer [Sat, 24 Nov 2007 01:59:29 +0000 (01:59 +0000)]
- decruftify old visitors used by orm, convert to functions that
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.
Mike Bayer [Fri, 23 Nov 2007 19:01:40 +0000 (19:01 +0000)]
more changes to merge(dont_load); since we now have a guarantee that
all merged instances aren't dirty, we can copy the attribues without using
any append/replace events, and therefore don't have any concern of lazy loaders
firing off. added tests to ensure that '_is_orphan()' doesn't get screwed up,
and also that the 'dirty' list on the new session stays empty, which is an
extra bonus of this approach.
Mike Bayer [Fri, 23 Nov 2007 05:24:32 +0000 (05:24 +0000)]
- some clarifications and fixes to merge(instance, dont_load=True).
fixed bug where lazy loaders were getting disabled on returned instances.
Also, we currently do not support merging an instance which has uncommitted
changes on it, in the case that dont_load=True is used....this will
now raise an error. This is due to complexities in merging the
"committed state" of the given instance to correctly correspond to the
newly copied instance. Since the use case for dont_load=True is
caching, the given instances shouldn't have any uncommitted changes on them
anyway.
Mike Bayer [Tue, 20 Nov 2007 15:55:36 +0000 (15:55 +0000)]
- clarified the error message which occurs when you try to update()
an instance with the same identity key as an instance already present
in the session.
- opened up the recursive checks in session.merge() a little bit
Jason Kirtland [Sun, 18 Nov 2007 18:19:52 +0000 (18:19 +0000)]
Migrated Connection.properties to Connection.info ('info' is the new standard name for user-writable property collections that came out of [ticket:573]). 'properties' is now an alias, will be removed in 0.5.
Mike Bayer [Sun, 18 Nov 2007 16:32:47 +0000 (16:32 +0000)]
- PickleType will compare using `==` when set up with mutable=False,
and not the `is` operator. To use `is` or any other comparator, send
in a custom comparison function using PickleType(comparator=my_custom_comparator).
Mike Bayer [Sun, 18 Nov 2007 02:13:56 +0000 (02:13 +0000)]
- session.refresh() and session.expire() now support an additional argument
"attribute_names", a list of individual attribute keynames to be refreshed
or expired, allowing partial reloads of attributes on an already-loaded
instance.
- finally simplified the behavior of deferred attributes, deferred polymorphic
load, session.refresh, session.expire, mapper._postfetch to all use a single
codepath through query._get(), which now supports a list of individual attribute names
to be refreshed. the *one* exception still remaining is mapper._get_poly_select_loader(),
which may stay that way since its inline with an already processing load operation.
otherwise, query._get() is the single place that all "load this instance's row" operation
proceeds.
- cleanup all over the place
Mike Bayer [Wed, 14 Nov 2007 16:43:21 +0000 (16:43 +0000)]
- DeferredColumnLoader checks row for column, if present sends it to
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]
Mike Bayer [Sat, 10 Nov 2007 03:02:16 +0000 (03:02 +0000)]
- anonymous column expressions are automatically labeled.
e.g. select([x* 5]) produces "SELECT x * 5 AS anon_1".
This allows the labelname to be present in the cursor.description
which can then be appropriately matched to result-column processing
rules. (we can't reliably use positional tracking for result-column
matches since text() expressions may represent multiple columns).
- operator overloading is now controlled by TypeEngine objects - the
one built-in operator overload so far is String types overloading
'+' to be the string concatenation operator.
User-defined types can also define their own operator overloading
by overriding the adapt_operator(self, op) method.
- untyped bind parameters on the right side of a binary expression
will be assigned the type of the left side of the operation, to better
enable the appropriate bind parameter processing to take effect
[ticket:819]
Jason Kirtland [Fri, 9 Nov 2007 19:55:31 +0000 (19:55 +0000)]
- mysql float types now do an end run around the base class and respect precision=None and length=None
- Added the mysteriously missing mysql cast support
- Added mysql REAL synonym for schema generation
Mike Bayer [Fri, 9 Nov 2007 16:36:46 +0000 (16:36 +0000)]
- fixed error where Query.add_column() would not accept a class-bound
attribute as an argument; Query also raises an error if an invalid
argument was sent to add_column() (at instances() time) [ticket:858]
Mike Bayer [Thu, 8 Nov 2007 18:06:21 +0000 (18:06 +0000)]
more changes to traverse-and-clone; a particular element will only be cloned 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.
Mike Bayer [Thu, 8 Nov 2007 00:26:23 +0000 (00:26 +0000)]
- identified some cases where Alias needs to be cloned; but still cant clone
when its an alias of a Table; added some test coverage for one particular
case from the doctests
- fixed "having" example in doctests, updated eager load example
Mike Bayer [Wed, 7 Nov 2007 01:36:16 +0000 (01:36 +0000)]
adjusted "blank out primary key" rule to check for "allow_null_pks" on target mapper. this was revealed by
recent attributes.py change in r3695 that causes a value of "None" to register as part of the attribute history's
added_items() collection (i.e. since AttributeHistory compares against NO_VALUE instead of None).
Mike Bayer [Mon, 5 Nov 2007 19:23:08 +0000 (19:23 +0000)]
- adjustments to oracle ROWID logic...recent oid changes mean we have to
use "rowid" against the select itself (i.e. its just...'rowid', no table name).
seems to work OK but not sure if issues will arise
- fixes to oracle bind param stuff to account for recent removal of ClauseParameters object.
Mike Bayer [Mon, 5 Nov 2007 18:30:30 +0000 (18:30 +0000)]
- oid_column proxies more intelligently off of Select, CompoundSelect - fixes platform-affected bugs in missing the correct "oid" column
- locate_all_froms() is expensive; added an attribute-level cache for it
- put a huge warning on all select.append_XXX() methods stating that derived collections like locate_all_froms() may become invalid if
already initialized
Mike Bayer [Mon, 5 Nov 2007 17:18:21 +0000 (17:18 +0000)]
- base_columns on ColumnElement becomes a list; as usual, because columns in 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
Mike Bayer [Mon, 5 Nov 2007 00:59:19 +0000 (00:59 +0000)]
- rewrote and simplified the system used to "target" columns across
selectable expressions. On the SQL side this is represented by the
"corresponding_column()" method. This method is used heavily by the ORM
to "adapt" elements of an expression to similar, aliased expressions,
as well as to target result set columns originally bound to a
table or selectable to an aliased, "corresponding" expression. The new
rewrite features completely consistent and accurate behavior.
- the "orig_set" and "distance" elements as well as all associated
fanfare are gone (hooray !)
- columns now have an optional "proxies" list which is a list of all
columns they are a "proxy" for; only CompoundSelect cols proxy more than one column
(just like before). set operations are used to determine lineage.
- CompoundSelects (i.e. unions) only create one public-facing proxy column per
column name. primary key collections come out with just one column per embedded
PK column.
- made the alias used by eager load limited subquery anonymous.
Mike Bayer [Sat, 3 Nov 2007 23:17:34 +0000 (23:17 +0000)]
- eager loading with LIMIT/OFFSET applied no longer adds the primary
table joined to a limited subquery of itself; the eager loads now
join directly to the subquery which also provides the primary table's
columns to the result set. This eliminates a JOIN from all eager loads
with LIMIT/OFFSET. [ticket:843]
Mike Bayer [Sat, 3 Nov 2007 22:13:17 +0000 (22:13 +0000)]
- rewritten ClauseAdapter merged from the eager_minus_join branch; this is a 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.
Mike Bayer [Sat, 3 Nov 2007 20:12:59 +0000 (20:12 +0000)]
- removed "name" attribute from FromClause, Join, Select, CompoundSelect. its needless
and led to some very strange anonymous label names
- removed what was apparently cruft in some column-targeting code
Mike Bayer [Fri, 2 Nov 2007 17:58:20 +0000 (17:58 +0000)]
- merge() includes a keyword argument "dont_load=True". setting this flag will cause
the merge operation to not load any data from the database in response to incoming
detached objects, and will accept the incoming detached object as though it were
already present in that session. Use this to merge detached objects from external
caching systems into the session.
Mike Bayer [Thu, 1 Nov 2007 20:12:36 +0000 (20:12 +0000)]
- session checks more carefully when determining "object X already in another session";
e.g. if you pickle a series of objects and unpickle (i.e. as in a Pylons HTTP session
or similar), they can go into a new session without any conflict
- added stricter checks around session.delete() similar to update()
- shored up some old "validate" stuff in session/uow