Mike Bayer [Sat, 23 Oct 2010 20:40:39 +0000 (16:40 -0400)]
- Added type_coerce(expr, type_) expression element.
Treats the given expression as the given type when evaluating
expressions and processing result rows, but does not
affect the generation of SQL, other than an anonymous label.
Mike Bayer [Sat, 23 Oct 2010 19:27:21 +0000 (15:27 -0400)]
- Oracle - the implicit_retunring argument to create_engine()
is now honored regardless of detected version of
Oracle. Previously, the flag would be forced
to False if server version info was < 10.
[ticket:1878]
Mike Bayer [Sat, 23 Oct 2010 17:07:56 +0000 (13:07 -0400)]
- New Query methods: query.label(name), query.as_scalar(),
return the query's statement as a scalar subquery
with /without label [ticket:1920];
query.with_entities(*ent), replaces the SELECT list of
the query with new entities.
Roughly equivalent to a generative form of query.values()
which accepts mapped entities as well as column
expressions.
Mike Bayer [Thu, 21 Oct 2010 20:42:32 +0000 (16:42 -0400)]
- Fixed bug in TypeDecorator whereby the dialect-specific
type was getting pulled in to generate the DDL for a
given type, which didn't always return the correct result.
- TypeDecorator can now have a fully constructed type
specified as its "impl", in addition to a type class.
- TypeDecorator will now place itself as the resulting
type for a binary expression where the type coercion
rules would normally return its impl type - previously,
a copy of the impl type would be returned which would
have the TypeDecorator embedded into it as the "dialect"
impl, this was probably an unintentional way of achieving
the desired effect.
- TypeDecorator.load_dialect_impl() returns "self.impl" by
default, i.e. not the dialect implementation type of
"self.impl". This to support compilation correctly.
Behavior can be user-overridden in exactly the same way
as before to the same effect.
Mike Bayer [Wed, 20 Oct 2010 21:58:35 +0000 (17:58 -0400)]
- document is_modified() caveats including that the "old" value isn't always
present, and that this results in a positive response for "changed"
[ticket:1928]
Mike Bayer [Sun, 17 Oct 2010 19:23:14 +0000 (15:23 -0400)]
- the NoseSQLAlchemyPlugin has been moved to a
new package "sqlalchemy_nose" which installs
along with "sqlalchemy". This so that the "nosetests"
script works as always but also allows the
--with-coverage option to turn on coverage before
SQLAlchemy modules are imported, allowing coverage
to work correctly.
- added some new ignores
Mike Bayer [Fri, 15 Oct 2010 15:59:02 +0000 (11:59 -0400)]
- Added a new "lazyload" option "immediateload".
Issues the usual "lazy" load operation automatically
as the object is populated. The use case
here is when loading objects to be placed in
an offline cache, or otherwise used after
the session isn't available, and straight 'select'
loading, not 'joined' or 'subquery', is desired.
[ticket:1914]
Mike Bayer [Fri, 15 Oct 2010 15:43:59 +0000 (11:43 -0400)]
- engine_from_config() now accepts 'debug' for
'echo', 'echo_pool', 'force' for 'convert_unicode',
boolean values for 'use_native_unicode'.
[ticket:1899]
Mike Bayer [Sun, 3 Oct 2010 17:11:41 +0000 (13:11 -0400)]
- default compilation of a type will check if the type class's module is
inside of sqlalchemy.dialects, in which case that dialect's default
will be used instead of DefaultDialect.
Mike Bayer [Sat, 2 Oct 2010 05:30:17 +0000 (01:30 -0400)]
- this test began working for oracle as of r14af1f73fbbd. Additionally,
the operation wasn't actually "working" on sqlite, mysql prior to that
rev, but no assertions checked. added assertions for those.
Mike Bayer [Sat, 2 Oct 2010 00:55:42 +0000 (20:55 -0400)]
- Fixed bug in query.update() where 'evaluate' or 'fetch'
expiration would fail if the column expression key was
a class attribute with a different keyname as the
actual column name. [ticket:1935]
Mike Bayer [Sat, 2 Oct 2010 00:29:04 +0000 (20:29 -0400)]
- add additional logic that duplicates mapper's prop.copy(); prop.columns.append(col)
logic when columns are present in a joined subclass with an attribute name different
than the column name itself [ticket:1931]
- add coverage to verify that we need to check (obj.name or name) when
deciding if a Column from a mixin should be added to the mapped table
Mike Bayer [Wed, 29 Sep 2010 06:11:38 +0000 (02:11 -0400)]
- CircularDependencyError now has .cycles and .edges
members, which are the set of elements involved in
one or more cycles, and the set of edges as 2-tuples.
[ticket:1890]
Mike Bayer [Tue, 28 Sep 2010 16:43:36 +0000 (12:43 -0400)]
- Fixed bug whereby columns on a mixin wouldn't propagate
correctly to a single-table inheritance scheme where
the attribute name is different than that of the column.
[ticket:1930]. Note [ticket:1931] which is the same
issue for joined inh, not yet resolved.
Mike Bayer [Sat, 25 Sep 2010 23:25:31 +0000 (19:25 -0400)]
- @classproperty 's official name/location for usage
with declarative is sqlalchemy.ext.declarative.mapperproperty.
Same thing, but moving there since it is more of a
"marker" that's specific to declararative,
not just an attribute technique. [ticket:1915]
Mike Bayer [Sat, 25 Sep 2010 22:38:01 +0000 (18:38 -0400)]
- Fixed recursion overflow which could occur when operating
with two expressions both of type "NullType", but
not the singleton NULLTYPE instance. [ticket:1907]
Mike Bayer [Wed, 22 Sep 2010 18:22:16 +0000 (14:22 -0400)]
- in depth docs about some merge() tips
- docs about backref cascade
- Another new flag on relationship(), cascade_backrefs,
disables the "save-update" cascade when the event was
initiated on the "reverse" side of a bidirectional
relationship. This is a cleaner behavior so that
many-to-ones can be set on a transient object without
it getting sucked into the child object's session,
while still allowing the forward collection to
cascade. We *might* default this to False in 0.7.
Mike Bayer [Tue, 21 Sep 2010 22:09:29 +0000 (18:09 -0400)]
- Query.select_from() has been beefed up to help
ensure that a subsequent call to query.join()
will use the select_from() entity, assuming it's
a mapped entity and not a plain selectable,
as the default "left" side, not the first entity
in the Query object's list of entities.
Mike Bayer [Mon, 20 Sep 2010 16:00:14 +0000 (12:00 -0400)]
- @classproperty (soon/now @mapperproperty) takes effect for
__mapper_args__, __table_args__, __tablename__ on
a base class that is not a mixin, as well as mixins.
[ticket:1922]
Mike Bayer [Sat, 18 Sep 2010 17:18:44 +0000 (13:18 -0400)]
- An informative error message is raised if a Column
which has not yet been assigned a name, i.e. as in
declarative, is used in a context where it is
exported to the columns collection of an enclosing
select() construct, or if any construct involving
that column is compiled before its name is
assigned. [ticket:1862]
Mike Bayer [Sat, 18 Sep 2010 15:40:25 +0000 (11:40 -0400)]
- use "key in dict" rather than KeyError if the usual case
is that the key is not present.
- don't need to uniquify Index schemes, just don't copy Indexes
that were known to be generated from the index=True flag
- user facing changes go in CHANGES
- Table.c allows string lookup
Mike Bayer [Thu, 16 Sep 2010 15:29:01 +0000 (11:29 -0400)]
- Fixed a regression in 0.6.4 whereby the change that
allowed cursor errors to be raised consistently broke
the result.lastrowid accessor. Test coverage has
been added for result.lastrowid. Note that lastrowid
is only supported by Pysqlite and some MySQL drivers,
so isn't super-useful in the general case.
Mike Bayer [Thu, 16 Sep 2010 02:20:01 +0000 (22:20 -0400)]
- fix test_single test to use default dialect
- The exception raised by Session when it is used
subsequent to a subtransaction rollback (which is what
happens when a flush fails in autocommit=False mode) has
now been reworded (this is the "inactive due to a
rollback in a subtransaction" message). In particular,
if the rollback was due to an exception during flush(),
the message states this is the case, and reiterates the
string form of the original exception that occurred
during flush. If the session is closed due to explicit
usage of subtransactions (not very common), the message
just states this is the case.
- The exception raised by Mapper when repeated requests to
its initialization are made after initialization already
failed no longer assumes the "hasattr" case, since
there's other scenarios in which this message gets
emitted, and the message also does not compound onto
itself multiple times - you get the same message for
each attempt at usage. The misnomer "compiles" is being
traded out for "initialize".
Mike Bayer [Tue, 14 Sep 2010 02:55:54 +0000 (22:55 -0400)]
- Fixed bug that would prevent "subqueryload" from
working correctly with single table inheritance
for a relationship from a subclass - the "where
type in (x, y, z)" only gets placed on the inside,
instead of repeatedly.
- When using from_self() with single table inheritance,
the "where type in (x, y, z)" is placed on the outside
of the query only, instead of repeatedly. May make
some more adjustments to this.
Mike Bayer [Mon, 13 Sep 2010 06:09:38 +0000 (02:09 -0400)]
- Fixed recursion bug which could occur when moving
an object from one reference to another, with
backrefs involved, where the initiating parent
was a subclass (with its own mapper) of the
previous parent.
Mike Bayer [Sun, 12 Sep 2010 23:18:08 +0000 (19:18 -0400)]
- lazy loads for relationship attributes now use
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.
Mike Bayer [Sun, 12 Sep 2010 16:37:43 +0000 (12:37 -0400)]
- Slight improvement to the behavior of "passive_updates=False"
when placed only on the many-to-one side of a
relationship; documentation has been clarified
that passive_updates=False should really be on the
one-to-many side.
- Placing passive_deletes=True on a many-to-one emits
a warning, since you probably intended to put it on
the one-to-many side.
Mike Bayer [Thu, 9 Sep 2010 23:21:23 +0000 (19:21 -0400)]
- collection docs
- Added an assertion during flush which ensures
that no NULL-holding identity keys were generated
on "newly persistent" objects.
This can occur when user defined code inadvertently
triggers flushes on not-fully-loaded objects.
Mike Bayer [Tue, 7 Sep 2010 16:37:43 +0000 (12:37 -0400)]
- Applied patches from [ticket:1904] to get
basic Informix functionality up again. We
rely upon end-user testing to ensure that
Informix is working to some degree.
Mike Bayer [Tue, 7 Sep 2010 16:16:29 +0000 (12:16 -0400)]
- Added a mutex to the identity map which mutexes
remove operations against iteration methods,
which now pre-buffer before returning an
iterable. This because asyncrhonous gc
can remove items via the gc thread at any time.
[ticket:1891]