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]
Mike Bayer [Sat, 30 Jan 2010 18:28:37 +0000 (18:28 +0000)]
- the "save-update" cascade will now cascade the pending *removed*
values from a scalar or collection attribute into the new session
during an add() operation. This so that the flush() operation
will also delete or modify rows of those disconnected items.
Mike Bayer [Fri, 29 Jan 2010 22:20:55 +0000 (22:20 +0000)]
- the "connection" argument from engine.transaction() and
engine.run_callable() is removed - Connection itself
now has those methods. All four methods accept
*args and **kwargs which are passed to the given callable,
as well as the operating connection.
Mike Bayer [Fri, 29 Jan 2010 18:55:03 +0000 (18:55 +0000)]
for string deferred evals, don't return the underlying Column, rely upon the original propcomparator to do what it wants.
reduces duplication of the "columns[0]" rule and removes potentially surprise behavior from the eval
Mike Bayer [Thu, 28 Jan 2010 23:49:22 +0000 (23:49 +0000)]
- the "autocommit" flag on select() and text() as well
as select().autocommit() are deprecated - now call
.execution_options(autocommit=True) on either of those
constructs, also available directly on Connection and orm.Query.
Mike Bayer [Mon, 25 Jan 2010 21:04:50 +0000 (21:04 +0000)]
- Added a tuple_() construct, allows sets of expressions
to be compared to another set, typically with IN against
composite primary keys or similar. Also accepts an
IN with multiple columns. The "scalar select can
have only one column" error message is removed - will
rely upon the database to report problems with
col mismatch.