changeset 1258:
http://www.sqlalchemy.org/trac/changeset/1258
This is a significant step in migrating SQLAlchemy's schema and
constructed SQL objects to being more engine independent. The
behavior with TypeEngine objects was that when they were first
specified to a Table or other ClauseElement, the engine was queried
for an engine-specific version of that type, which then replaced the
old type. The ProxyEngine had to get around this behavior by
creating its own ProxyTypeEngine, which would defer this engine
lookup until later.
What the change does is for the BindParamClause, the ResultProxy, and
all the SchemaGenerator objects to receive the TypeEngine object as
its generic version at query generation time, and to receive the
engine-specific type via the new engine_impl() method. The
ProxyTypeEngine code has been removed from ProxyEngine since its no
longer needed.
Things to note about this change:
- the original design was based on the fact that most TypeEngine
objects in memory would be those attached to Table objects, and that
Table objects were typically only created at the module level.
Therefore, to do the type conversion up front when Tables were
created offered the greatest performance, as no special lookup step
would be required at query compile time. While the engine_impl()
method only does the engine-specific conversion once and then stores
the result in a dictionary, there is now one extra method call plus
one extra dictionary call of overhead per bind parameter/received
column, in addition to the original type object remaining in memory.
- from a "codepath" perspective, this change is pretty much
equivalent to the ProxyTypeEngine being installed as core behavior
(although it didnt seem like the PTE was caching its results, now
they are).
- Robert, I had to change your "cast" function a bit but I think
youll see this change makes it a little cleaner.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users