Mike Bayer [Tue, 23 Feb 2010 00:57:08 +0000 (00:57 +0000)]
- a change to the previous __mapper_args__ commit.
- the __mapper_args__ dict is copied when propagating to a subclass,
and is taken straight off the class __dict__ to avoid any
propagation from the parent. mapper inheritance already
propagates the things you want from the parent mapper.
[ticket:1393]
Mike Bayer [Tue, 23 Feb 2010 00:39:35 +0000 (00:39 +0000)]
- the __mapper_args__ dict is copied when propagating to a subclass.
Still need to decide how the argument propagation should
work in the bigger picture. [ticket:1393]
Mike Bayer [Tue, 23 Feb 2010 00:35:56 +0000 (00:35 +0000)]
- session.merge() will not expire existing scalar attributes
on an existing target if the target has a value for that
attribute, even if the incoming merged doesn't have
a value for the attribute. This prevents unnecessary loads
on existing items. Will still mark the attr as expired
if the destination doesn't have the attr, though, which
fulfills some contracts of deferred cols. [ticket:1681]
- session.merge() works with relations that specifically
don't include "merge" in their cascade options - the target
is ignored completely.
Michael Trier [Tue, 23 Feb 2010 00:27:34 +0000 (00:27 +0000)]
Modified unittests docs to explain that --first-package-wins=True is required on Windows. Also modified the setup.cfg to add this option so that if using the default config there will be consistent behavior on all platforms.
Mike Bayer [Mon, 22 Feb 2010 23:53:35 +0000 (23:53 +0000)]
- The "allow_null_pks" flag is now called "allow_partial_pks",
defaults to True, acts like it did in 0.5 again. Except,
it also is implemented within merge() such that a SELECT
won't be issued for an incoming instance with partially
NULL primary key if the flag is False. [ticket:1680]
Mike Bayer [Mon, 22 Feb 2010 22:31:49 +0000 (22:31 +0000)]
- DeclarativeMeta exclusively uses cls.__dict__ (not dict_)
as the source of class information; _as_declarative exclusively
uses the dict_ passed to it as the source of class information
(which when using DeclarativeMeta is cls.__dict__). This should
in theory make it easier for custom metaclasses to modify
the state passed into _as_declarative.
Mike Bayer [Mon, 22 Feb 2010 20:37:44 +0000 (20:37 +0000)]
- added util.portable_instancemethod to provide a quick way to make an instancemethod "serializable"
- SchemaType and subclasses Boolean, Enum are now serializable,
including their ddl listener and other event callables.
[ticket:1694] [ticket:1698]
- AddConstraint/DropConstraint use the wrapper for _create_rule
- added test coverage for AddConstraint override of _create_rule
Mike Bayer [Mon, 22 Feb 2010 19:28:25 +0000 (19:28 +0000)]
- Composite PK table on InnoDB where the "autoincrement" column
isn't first will emit an explicit "KEY" phrase within
CREATE TABLE thereby avoiding errors, [ticket:1496]
Mike Bayer [Tue, 16 Feb 2010 19:47:54 +0000 (19:47 +0000)]
- A change to the solution for [ticket:1579] - an end-user
defined bind parameter name that directly conflicts with
a column-named bind generated directly from the SET or
VALUES clause of an update/insert generates a compile error.
This reduces call counts and eliminates some cases where
undesirable name conflicts could still occur.
Mike Bayer [Sun, 14 Feb 2010 19:23:35 +0000 (19:23 +0000)]
- query.one() no longer applies LIMIT to the query, this to
ensure that it fully counts all object identities present
in the result, even in the case where joins may conceal
multiple identities for two or more rows. As a bonus,
one() can now also be called with a query that issued
from_statement() to start with since it no longer modifies
the query. [ticket:1688]
Gaëtan de Menten [Sat, 13 Feb 2010 22:53:39 +0000 (22:53 +0000)]
- Added an optional C extension to speed up the sql layer by
reimplementing the highest impact functions.
The actual speedups will depend heavily on your DBAPI and
the mix of datatypes used in your tables, and can vary from
a 50% improvement to more than 200%. It also provides a modest
(~20%) indirect improvement to ORM speed for large queries.
Note that it is *not* built/installed by default.
See README for installation instructions.
- The most common result processors conversion function were
moved to the new "processors" module. Dialect authors are
encouraged to use those functions whenever they correspond
to their needs instead of implementing custom ones.
Mike Bayer [Sat, 13 Feb 2010 21:16:08 +0000 (21:16 +0000)]
- reduced a bit of overhead in attribute expiration, particularly
the version called by column loaders on an incomplete row (i.e.
joined table inheritance). there are more dramatic changes
that can be made here but this one is conservative so far
as far as how much we're altering how InstanceState tracks
"expired" attributes.
Mike Bayer [Sat, 13 Feb 2010 19:27:14 +0000 (19:27 +0000)]
- For those who might use debug logging on
sqlalchemy.orm.strategies, most logging calls during row
loading have been removed. These were never very helpful
and cluttered up the code.
- Some internal streamlining of object loading grants a
small speedup for large results, estimates are around
10-15%.
Mike Bayer [Sat, 13 Feb 2010 01:42:52 +0000 (01:42 +0000)]
- Improved the installation/test setup regarding Python 3,
now that Distribute runs on Py3k. distribute_setup.py
is now included. See README.py3k for Python 3 installation/
testing instructions.
Mike Bayer [Fri, 12 Feb 2010 21:43:19 +0000 (21:43 +0000)]
- Changed the beaker cache example a bit to have a separate
RelationCache option for lazyload caching. This object
does a lookup among any number of potential attributes
more efficiently by grouping several into a common structure.
Both FromCache and RelationCache are simpler individually.
Mike Bayer [Fri, 12 Feb 2010 19:54:49 +0000 (19:54 +0000)]
- Made sqlalchemy.sql.expressions.Executable part of public
API, used for any expression construct that can be sent to
execute(). FunctionElement now inherits Executable so that
it gains execution_options(), which are also propagated
to the select() that's generated within execute().
Executable in turn subclasses _Generative which marks
any ClauseElement that supports the @_generative
decorator - these may also become "public" for the benefit
of the compiler extension at some point.
Mike Bayer [Thu, 11 Feb 2010 19:33:06 +0000 (19:33 +0000)]
- The type/expression system now does a more complete job
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].
Mike Bayer [Thu, 11 Feb 2010 02:23:32 +0000 (02:23 +0000)]
- Added "native_datetime=True" flag to create_engine().
This will cause the DATE and TIMESTAMP types to skip
all bind parameter and result row processing, under
the assumption that PARSE_DECLTYPES has been enabled
on the connection. Note that this is not entirely
compatible with the "func.current_date()", which
will be returned as a string. [ticket:1685]
Mike Bayer [Mon, 8 Feb 2010 18:37:47 +0000 (18:37 +0000)]
- Query called in the context of an expression will render
disambiguating labels in all cases. Note that this does
not apply to the existing .statement and .subquery()
accessor/method, which still honors the .with_labels()
setting that defaults to False.
- Query.union() retains disambiguating labels within the
returned statement, thus avoiding various SQL composition
errors which can result from column name conflicts.
[ticket:1676]
Mike Bayer [Sun, 7 Feb 2010 23:58:17 +0000 (23:58 +0000)]
- Now uses sqlalchemy.orm.exc.DetachedInstanceError when an
attribute load or refresh action fails due to object
being detached from any Session. UnboundExecutionError
is specific to engines bound to sessions and statements.
Mike Bayer [Sun, 7 Feb 2010 00:56:05 +0000 (00:56 +0000)]
- FunctionElement subclasses are now directly executable the
same way any func.foo() construct is, with automatic
SELECT being applied when passed to execute().
- The "type" and "bind" keyword arguments of a func.foo()
construct are now local to "func." constructs and are
not part of the FunctionElement base class, allowing
a "type" to be handled in a custom constructor or
class-level variable.
Mike Bayer [Fri, 5 Feb 2010 19:16:10 +0000 (19:16 +0000)]
- Slight improvement to the fix for [ticket:1362] to not issue
needless updates of the primary key column during a so-called
"row switch" operation, i.e. add + delete of two objects
with the same PK.
Mike Bayer [Fri, 5 Feb 2010 18:12:38 +0000 (18:12 +0000)]
- Fixed bug in session.rollback() which involved not removing
formerly "pending" objects from the session before
re-integrating "deleted" objects, typically occured with
natural primary keys. If there was a primary key conflict
between them, the attach of the deleted would fail
internally. The formerly "pending" objects are now expunged
first. [ticket:1674]
Mike Bayer [Tue, 2 Feb 2010 23:26:34 +0000 (23:26 +0000)]
the order of rollback()s wasn't correct. slightly disturbing as the test usually passed,
began failing on PG as of somewhat unrelated commit r6705, and only when the full test/engine series
of tests were run. very heisenbuggy. may want to add tests to assert that TLEngine is enforcing
nesting even with subtransactions.
Mike Bayer [Tue, 2 Feb 2010 22:56:19 +0000 (22:56 +0000)]
- Primary key values can now be changed on a joined-table inheritance
object, and ON UPDATE CASCADE will be taken into account when
the flush happens. Set the new "passive_updates" flag to False
on mapper() when using SQLite or MySQL/MyISAM. [ticket:1362]
- flush() now detects when a primary key column was updated by
an ON UPDATE CASCADE operation from another primary key, and
can then locate the row for a subsequent UPDATE on the new PK
value. This occurs when a relation() is there to establish
the relationship as well as passive_updates=True. [ticket:1671]