Mike Bayer [Sun, 13 Mar 2011 17:59:00 +0000 (13:59 -0400)]
- Updated the association, association proxy examples
to use declarative, added a new example
dict_of_sets_with_default.py, a "pushing the envelope"
example of association proxy.
That is, "select count(1) from (<full query>)".
This produces a subquery in all cases, but
vastly simplifies all the guessing count()
tried to do previously, which would still
fail in many scenarios particularly when
joined table inheritance and other joins
were involved. If the subquery produced
for an otherwise very simple count is really
an issue, use query(func.count()) as an
optimization. [ticket:2093]
Mike Bayer [Sun, 6 Mar 2011 20:37:18 +0000 (15:37 -0500)]
- A tweak to the unit of work causes it to order
the flush along relationship() dependencies even if
the given objects don't have any inter-attribute
references in memory, which was the behavior in
0.5 and earlier, so a flush of Parent/Child with
only foreign key/primary key set will succeed.
This while still maintaining 0.6 and above's not
generating a ton of useless internal dependency
structures within the flush that don't correspond
to state actually within the current flush.
[ticket:2082]
Mike Bayer [Sat, 5 Mar 2011 01:52:22 +0000 (20:52 -0500)]
- some changes to the identity map regarding
rare weakref callbacks during iterations.
The mutex has been removed as it apparently
can cause a reentrant (i.e. in one thread) deadlock,
perhaps when gc collects objects at the point of
iteration in order to gain more memory. It is hoped
that "dictionary changed during iteration" will
be exceedingly rare as iteration methods internally
acquire the full list of objects in a single values()
call. [ticket:2087]
Mike Bayer [Mon, 28 Feb 2011 17:47:04 +0000 (12:47 -0500)]
- Added a fully descriptive error message for the
case where Column is subclassed and _make_proxy()
fails to make a copy due to TypeError on the
constructor. The method _constructor should
be implemented in this case.
Mike Bayer [Fri, 25 Feb 2011 18:20:43 +0000 (13:20 -0500)]
- establish an "insert" option for events to control ordering if needed (not needed yet tho)
- render foreign key constraints in the order in which they were cerated
Mike Bayer [Fri, 18 Feb 2011 01:43:17 +0000 (20:43 -0500)]
- Fixed regression from 0.6 where SMALLINT and
BIGINT types would both generate SERIAL
on an integer PK column, instead of
SMALLINT and BIGSERIAL [ticket:2065]
Mike Bayer [Fri, 18 Feb 2011 01:27:35 +0000 (20:27 -0500)]
- The Column.references() method now returns True
if it has a foreign key referencing the
given column exactly, not just it's parent
table. [ticket:2064]
Mike Bayer [Fri, 18 Feb 2011 00:59:45 +0000 (19:59 -0500)]
- rename EngineEvents to ConnectionEvents
- simplify connection event model to be inline inside Connection, don't use ad-hoc
subclasses (technically would leak memory for the app that keeps creating engines
and adding events)
- not doing listen-per-connection yet. this is closer. overall things
are much simpler now (until we put listen-per-connection in...)
Mike Bayer [Mon, 14 Feb 2011 17:51:53 +0000 (12:51 -0500)]
- Fixed regression whereby composite() with
Column objects placed inline would fail
to initialize. The Column objects can now
be inline with the composite() or external
and pulled in via name or object ref.
[ticket:2058]
Mike Bayer [Mon, 14 Feb 2011 03:30:00 +0000 (22:30 -0500)]
- Beaker example now takes into account 'limit'
and 'offset', bind params within embedded
FROM clauses (like when you use union() or
from_self()) when generating a cache key.
Mike Bayer [Mon, 14 Feb 2011 01:20:34 +0000 (20:20 -0500)]
- Association proxy now has correct behavior for
any(), has(), and contains() when proxying
a many-to-one scalar attribute to a one-to-many
collection (i.e. the reverse of the 'typical'
association proxy use case) [ticket:2054]
Mike Bayer [Mon, 14 Feb 2011 00:32:00 +0000 (19:32 -0500)]
- The Sequence() construct, when passed a MetaData()
object via its 'metadata' argument, will be
included in CREATE/DROP statements within
metadata.create_all() and metadata.drop_all(),
including "checkfirst" logic. [ticket:2055]
Mike Bayer [Sun, 13 Feb 2011 03:20:47 +0000 (22:20 -0500)]
- Fixed bug whereby Session.merge() would call the
load() event with one too few arguments.
[ticket:2053]
- Added logic which prevents the generation of
events from a MapperExtension or SessionExtension
from generating do-nothing events for all the methods
not overridden. [ticket:2052]
Mike Bayer [Sat, 12 Feb 2011 23:00:45 +0000 (18:00 -0500)]
- remove some remaining sys.modules shenanigans
- The "sqlalchemy.exceptions" alias in sys.modules
has been removed. Base SQLA exceptions are
available via "from sqlalchemy import exc".
The "exceptions" alias for "exc" remains in
"sqlalchemy" for now, it's just not patched into
sys.modules.
Mike Bayer [Fri, 11 Feb 2011 22:58:49 +0000 (17:58 -0500)]
- fix long lines in test_attributes
- add deprecation warning to get_history() when passed
True or False, convert
- rearrange symbol() so we can get sphinx autodata to work
Mike Bayer [Fri, 11 Feb 2011 20:37:44 +0000 (15:37 -0500)]
- replace all usage of True and False for passive with PASSIVE_NO_INITIALIZE,
PASSIVE_OFF, now expresed as non-boolean symbols
- make "passive" available positionally on all get_history() methods,
call it like that
Mike Bayer [Fri, 11 Feb 2011 19:41:29 +0000 (14:41 -0500)]
- Additional tuning to "many-to-one" relationship
loads during a flush(). A change in version 0.6.6
([ticket:2002]) required that more "unnecessary" m2o
loads during a flush could occur. Extra loading modes have
been added so that the SQL emitted in this
specific use case is trimmed back, while still
retrieving the information the flush needs in order
to not miss anything. [ticket:2049]
Mike Bayer [Fri, 11 Feb 2011 03:27:45 +0000 (22:27 -0500)]
- The concept of associating a ".bind" directly with a
ClauseElement has been explicitly moved to Executable,
i.e. the mixin that describes ClauseElements which represent
engine-executable constructs. This change is an improvement
to internal organization and is unlikely to affect any
real-world usage. [ticket:2048]
Mike Bayer [Fri, 11 Feb 2011 02:57:44 +0000 (21:57 -0500)]
- Added over() function, method to FunctionElement
classes, produces the _Over() construct which
in turn generates "window functions", i.e.
"<window function> OVER (PARTITION BY <partition by>,
ORDER BY <order by>)".
[ticket:1844]
Mike Bayer [Thu, 10 Feb 2011 20:03:11 +0000 (15:03 -0500)]
- The path given as the location of a sqlite database is now
normalized via os.path.abspath(), so that directory changes
within the process don't affect the ultimate location
of a relative file path. [ticket:2036]
Mike Bayer [Thu, 10 Feb 2011 19:17:08 +0000 (14:17 -0500)]
- Query.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
as DISTINCT ON (<expr>). [ticket:1069]
- select.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
as DISTINCT ON (<expr>). Note this was already
available via passing a list to the `distinct`
keyword argument to select(). [ticket:1069]
- select.prefix_with() accepts multiple expressions
(i.e. *expr), 'prefix' keyword argument to select()
accepts a list or tuple.
- Passing a string to the `distinct` keyword argument
of `select()` for the purpose of emitting special
MySQL keywords (DISTINCTROW etc.) is deprecated -
use `prefix_with()` for this.
- put kw arguments to select() in order
- restore docs for _SelectBase, renamed from _SelectBaseMixin
Mike Bayer [Thu, 10 Feb 2011 16:30:23 +0000 (11:30 -0500)]
- An exception is raised in the unusual case that an
append or similar event on a collection occurs after
the parent object has been dereferenced, which
prevents the parent from being marked as "dirty"
in the session. Will commit as a warning in 0.6.
[ticket:2046]
Mike Bayer [Thu, 10 Feb 2011 00:18:33 +0000 (19:18 -0500)]
- py3k fix regarding new exception system
- this test keeps throwing a TNS error on Oracle on the buildbot only, runs locally,
seems to be related to some scaling/memory type of issue on the bot
Mike Bayer [Wed, 9 Feb 2011 23:11:40 +0000 (18:11 -0500)]
- Non-DBAPI errors which occur in the scope of an `execute()`
call are now wrapped in sqlalchemy.exc.StatementError,
and the text of the SQL statement and repr() of params
is included. This makes it easier to identify statement
executions which fail before the DBAPI becomes
involved. [ticket:2015]
Mike Bayer [Wed, 9 Feb 2011 21:30:49 +0000 (16:30 -0500)]
- figured out the ::autodata directive, can move the docstring for
expression.func into the .py module
- added a note about logging only being checked on new connections,
as one user had this issue awhile back, and I suspect it for
a current ML user issue
Mike Bayer [Wed, 9 Feb 2011 20:45:15 +0000 (15:45 -0500)]
- The compiler extension now supports overriding the default
compilation of expression._BindParamClause including that
the auto-generated binds within the VALUES/SET clause
of an insert()/update() statement will also use the new
compilation rules. [ticket:2042]
Mike Bayer [Wed, 9 Feb 2011 20:14:54 +0000 (15:14 -0500)]
- Fixed bug where a column with a SQL or server side default
that was excluded from a mapping with include_properties
or exclude_properties would result in UnmappedColumnError.
[ticket:1995]
Mike Bayer [Wed, 9 Feb 2011 20:06:32 +0000 (15:06 -0500)]
- add connection and cursor to is_disconnect(). We aren't using it yet,
but we'd like to. Most DBAPIs don't give us anything we can do with it.
Some research was done on psycopg2 and it still seems like they give us
no adequate method (tried connection.closed, cursor.closed, connection.status).
mxodbc claims their .closed attribute will work (but I am skeptical).
- remove beahvior in pool that auto-invalidated a connection when
the cursor failed to create. That's not the pool's job. we need the conn
for the error logic. Can't get any tests to fail, curious why that
behavior was there, guess we'll find out (or not).
- add support for psycopg2 version detection. even though we have
no use for it yet...
- adjust one of the reconnect tests to work with oracle's
horrendously slow connect speed
Mike Bayer [Mon, 7 Feb 2011 21:12:24 +0000 (16:12 -0500)]
- Adjusted flush accounting step to occur before
the commit in the case of autocommit=True. This allows
autocommit=True to work appropriately with
expire_on_commit=True, and also allows post-flush session
hooks to operate in the same transactional context
as when autocommit=False. [ticket:2041]
Mike Bayer [Sat, 5 Feb 2011 21:09:49 +0000 (16:09 -0500)]
- A single contains_eager() call across
multiple entities will indicate all collections
along that path should load, instead of requiring
distinct contains_eager() calls for each endpoint
(which was never correctly documented).
[ticket:2032]
- The "name" field used in orm.aliased() now renders
in the resulting SQL statement.
Mike Bayer [Fri, 4 Feb 2011 23:33:49 +0000 (18:33 -0500)]
- apply optimizations to alternate row proxies, [ticket:1787]
- add check to fetchmany() for None, don't send argument if not present,
helps DBAPIs which don't accept "None" for default (ie. pysqlite, maybe others)
- add tests to test_execute to provide 100% coverage for the three alternate
result proxy classes
Mike Bayer [Fri, 4 Feb 2011 22:37:36 +0000 (17:37 -0500)]
- When explicit sequence execution derives the name
of the auto-generated sequence of a SERIAL column,
which currently only occurs if implicit_returning=False,
now accommodates if the table + column name is greater
than 63 characters using the same logic Postgresql uses.
[ticket:1083]