[Sqlalchemy-commits] sqlalchemy: some fixes here
Brought to you by:
zzzeek
From: <co...@sq...> - 2012-06-17 01:33:19
|
details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/10075961ad68 changeset: 8384:10075961ad68 user: Mike Bayer <mi...@zz...> date: Sat Jun 16 21:29:08 2012 -0400 description: some fixes here Subject: sqlalchemy: some fixes details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/d36d078358a3 changeset: 8385:d36d078358a3 user: Mike Bayer <mi...@zz...> date: Sat Jun 16 21:29:47 2012 -0400 description: some fixes diffstat: .hgtags | 2 + CHANGES | 426 +- README.rst | 19 +- doc/build/conf.py | 6 +- doc/build/core/connections.rst | 45 - doc/build/core/tutorial.rst | 4 +- doc/build/core/types.rst | 6 + doc/build/index.rst | 3 +- doc/build/intro.rst | 10 +- doc/build/orm/deprecated.rst | 1 - doc/build/orm/examples.rst | 9 + doc/build/orm/extensions/declarative.rst | 1 - doc/build/orm/extensions/index.rst | 1 + doc/build/orm/extensions/sqlsoup.rst | 11 + doc/build/orm/inheritance.rst | 527 +- doc/build/orm/relationships.rst | 7 - doc/build/orm/tutorial.rst | 4 +- examples/declarative_reflection/__init__.py | 47 + examples/declarative_reflection/declarative_reflection.py | 98 + examples/inheritance/joined.py | 135 - examples/inheritance/polymorph.py | 125 + lib/sqlalchemy/__init__.py | 12 +- lib/sqlalchemy/dialects/__init__.py | 28 - lib/sqlalchemy/dialects/firebird/base.py | 7 +- lib/sqlalchemy/dialects/informix/base.py | 10 +- lib/sqlalchemy/dialects/mssql/base.py | 59 +- lib/sqlalchemy/dialects/mysql/base.py | 10 +- lib/sqlalchemy/dialects/oracle/base.py | 33 +- lib/sqlalchemy/dialects/oracle/cx_oracle.py | 5 +- lib/sqlalchemy/dialects/postgresql/base.py | 142 +- lib/sqlalchemy/dialects/sqlite/base.py | 132 +- lib/sqlalchemy/engine/__init__.py | 8 - lib/sqlalchemy/engine/base.py | 174 +- lib/sqlalchemy/engine/default.py | 3 - lib/sqlalchemy/engine/reflection.py | 39 +- lib/sqlalchemy/engine/url.py | 57 +- lib/sqlalchemy/events.py | 6 +- lib/sqlalchemy/exc.py | 7 - lib/sqlalchemy/ext/associationproxy.py | 8 +- lib/sqlalchemy/ext/declarative.py | 339 +- lib/sqlalchemy/ext/sqlsoup.py | 811 ++++ lib/sqlalchemy/inspection.py | 44 - lib/sqlalchemy/orm/__init__.py | 38 +- lib/sqlalchemy/orm/attributes.py | 214 +- lib/sqlalchemy/orm/descriptor_props.py | 3 +- lib/sqlalchemy/orm/dynamic.py | 12 +- lib/sqlalchemy/orm/events.py | 28 +- lib/sqlalchemy/orm/identity.py | 15 +- lib/sqlalchemy/orm/instrumentation.py | 10 +- lib/sqlalchemy/orm/mapper.py | 39 +- lib/sqlalchemy/orm/persistence.py | 261 +- lib/sqlalchemy/orm/properties.py | 735 +++- lib/sqlalchemy/orm/query.py | 555 ++- lib/sqlalchemy/orm/relationships.py | 920 ----- lib/sqlalchemy/orm/session.py | 227 +- lib/sqlalchemy/orm/state.py | 261 +- lib/sqlalchemy/orm/strategies.py | 110 +- lib/sqlalchemy/orm/unitofwork.py | 20 +- lib/sqlalchemy/orm/util.py | 195 +- lib/sqlalchemy/processors.py | 8 +- lib/sqlalchemy/schema.py | 17 +- lib/sqlalchemy/sql/compiler.py | 27 +- lib/sqlalchemy/sql/expression.py | 108 +- lib/sqlalchemy/sql/operators.py | 5 - lib/sqlalchemy/sql/util.py | 175 +- lib/sqlalchemy/sql/visitors.py | 12 +- lib/sqlalchemy/types.py | 185 +- lib/sqlalchemy/util/__init__.py | 2 +- lib/sqlalchemy/util/langhelpers.py | 59 +- test/aaa_profiling/test_memusage.py | 48 + test/aaa_profiling/test_orm.py | 8 +- test/aaa_profiling/test_resultset.py | 8 +- test/aaa_profiling/test_zoomark.py | 3 +- test/base/test_inspect.py | 62 - test/base/test_utils.py | 21 - test/dialect/test_mssql.py | 11 +- test/dialect/test_oracle.py | 54 +- test/dialect/test_postgresql.py | 120 +- test/dialect/test_sqlite.py | 103 +- test/engine/test_execute.py | 54 - test/engine/test_parseconnect.py | 39 - test/engine/test_reflection.py | 132 +- test/ext/test_associationproxy.py | 10 +- test/ext/test_declarative.py | 2260 ++++++++++++- test/ext/test_declarative_inheritance.py | 1043 ----- test/ext/test_declarative_mixin.py | 1082 ------ test/ext/test_declarative_reflection.py | 449 -- test/ext/test_serializer.py | 25 +- test/ext/test_sqlsoup.py | 447 ++ test/lib/requires.py | 27 +- test/orm/_fixtures.py | 45 +- test/orm/inheritance/test_abc_inheritance.py | 6 +- test/orm/inheritance/test_basic.py | 8 +- test/orm/inheritance/test_with_poly.py | 113 - test/orm/test_attributes.py | 137 +- test/orm/test_backref_mutations.py | 4 +- test/orm/test_cascade.py | 21 +- test/orm/test_events.py | 49 +- test/orm/test_froms.py | 82 +- test/orm/test_inspect.py | 290 - test/orm/test_joins.py | 12 +- test/orm/test_legacy_mutable.py | 375 ++ test/orm/test_load_on_fks.py | 51 +- test/orm/test_mapper.py | 10 +- test/orm/test_query.py | 57 +- test/orm/test_rel_fn.py | 973 ----- test/orm/test_relationships.py | 759 +-- test/orm/test_session.py | 7 +- test/orm/test_transaction.py | 71 +- test/orm/test_update_delete.py | 12 - test/sql/test_compiler.py | 14 +- test/sql/test_constraints.py | 43 +- test/sql/test_generative.py | 98 +- test/sql/test_query.py | 70 +- test/sql/test_selectable.py | 122 +- 115 files changed, 7426 insertions(+), 9671 deletions(-) diffs (truncated from 22367 to 300 lines): diff -r c140b8588fd1 -r d36d078358a3 .hgtags --- a/.hgtags Sat Jun 16 20:56:32 2012 -0400 +++ b/.hgtags Sat Jun 16 21:29:47 2012 -0400 @@ -87,3 +87,5 @@ 19a7e3a6058878ecc07a40ea563e9cf92110be3a rel_0_7_4 ebe9514a69a4b4ec6209f0e9aa43053ba28d080b rel_0_7_5 d557287431986274a796348750f1c6ce885b196c rel_0_7_6 +faa9d921eb84651e755839072edf7cc929888119 rel_0_7_7 +78b2833fb74f63423a5daa4837364ec1d7b56152 rel_0_7_8 diff -r c140b8588fd1 -r d36d078358a3 CHANGES --- a/CHANGES Sat Jun 16 20:56:32 2012 -0400 +++ b/CHANGES Sat Jun 16 21:29:47 2012 -0400 @@ -3,120 +3,14 @@ ======= CHANGES ======= - -0.8.0b1 -======= -- general - - SQLAlchemy 0.8 now targets Python 2.5 and - above. Python 2.4 is no longer supported. - - - [removed] The "sqlalchemy.exceptions" - synonym for "sqlalchemy.exc" is removed - fully. [ticket:2433] - +0.7.8 +===== - orm - - [removed] The legacy "mutable" system of the - ORM, including the MutableType class as well - as the mutable=True flag on PickleType - and postgresql.ARRAY has been removed. - In-place mutations are detected by the ORM - using the sqlalchemy.ext.mutable extension, - introduced in 0.7. The removal of MutableType - and associated constructs removes a great - deal of complexity from SQLAlchemy's internals. - The approach performed poorly as it would incur - a scan of the full contents of the Session - when in use. [ticket:2442] - - - [feature] Major rewrite of relationship() - internals now allow join conditions which - include columns pointing to themselves - within composite foreign keys. A new - API for very specialized primaryjoin conditions - is added, allowing conditions based on - SQL functions, CAST, etc. to be handled - by placing the annotation functions - remote() and foreign() inline within the - expression when necessary. Previous recipes - using the semi-private _local_remote_pairs - approach can be upgraded to this new - approach. [ticket:1401] - - - [feature] New standalone function with_polymorphic() - provides the functionality of query.with_polymorphic() - in a standalone form. It can be applied to any - entity within a query, including as the target - of a join in place of the "of_type()" modifier. - [ticket:2333] - - - [feature] The "deferred declarative - reflection" system has been moved into the - declarative extension itself, using the - new DeferredReflection class. This - class is now tested with both single - and joined table inheritance use cases. - [ticket:2485] - - - [feature] Added new core function "inspect()", - which serves as a generic gateway to - introspection into mappers, objects, - others. The Mapper and InstanceState - objects have been enhanced with a public - API that allows inspection of mapped - attributes, including filters for column-bound - or relationship-bound properties, inspection - of current object state, history of - attributes, etc. [ticket:2208] - - - [feature] Calling rollback() within a - session.begin_nested() will now only expire - those objects that had net changes within the - scope of that transaction, that is objects which - were dirty or were modified on a flush. This - allows the typical use case for begin_nested(), - that of altering a small subset of objects, to - leave in place the data from the larger enclosing - set of objects that weren't modified in - that sub-transaction. [ticket:2452] - - - [feature] Added utility feature - Session.enable_relationship_loading(), - supersedes relationship.load_on_pending. - Both features should be avoided, however. - [ticket:2372] - - [bug] Fixed bug whereby subqueryload() from a polymorphic mapping to a target would incur a new invocation of the query for each distinct class encountered in the polymorphic - result. [ticket:2480]. Also in 0.7.8. - - - [bug] Fixed issue in unit of work - whereby setting a non-None self-referential - many-to-one relationship to None - would fail to persist the change if the - former value was not already loaded. - [ticket:2477]. Also in 0.7.7 - - - [bug] Fixed bug in relationship comparisons - whereby calling unimplemented methods like - SomeClass.somerelationship.like() would - produce a recursion overflow, instead - of NotImplementedError. Also in 0.7.7. - - - [bug] The "passive" flag on Session.is_modified() - no longer has any effect. is_modified() in - all cases looks only at local in-memory - modified flags and will not emit any - SQL or invoke loader callables/initializers. - [ticket:2320] - - - [bug] The warning emitted when using - delete-orphan cascade with one-to-many - or many-to-many without single-parent=True - is now an error. The ORM - would fail to function subsequent to this - warning in any case. [ticket:2405] + result. [ticket:2480] - [bug] Fixed bug in declarative whereby the precedence of columns @@ -129,40 +23,86 @@ entity attributes to be incorrect. Related to [ticket:1892] as this was supposed to be part of that, this is [ticket:2491]. - Also in 0.7.8. - [feature] The 'objects' argument to flush() is no longer deprecated, as some valid use cases have been identified. - Also in 0.7.8. - [bug] Fixed identity_key() function which was not accepting a scalar argument - for the identity. [ticket:2508]. Also - in 0.7.8. - - - [feature] Query now "auto correlates" by - default in the same way as select() does. - Previously, a Query used as a subquery - in another would require the correlate() - method be called explicitly in order to - correlate a table on the inside to the - outside. As always, correlate(None) - disables correlation. [ticket:2179] + for the identity. [ticket:2508]. + + - [bug] Fixed bug whereby populate_existing + option would not propagate to subquery + eager loaders. [ticket:2497]. + +- sql + - [bug] added BIGINT to types.__all__, + BIGINT, BINARY, VARBINARY to sqlalchemy + module namespace, plus test to ensure + this breakage doesn't occur again. + [ticket:2499] + + - [bug] Repaired common table expression + rendering to function correctly when the + SELECT statement contains UNION or other + compound expressions, courtesy btbuilder. + [ticket:2490] + + - [bug] Fixed bug whereby append_column() + wouldn't function correctly on a cloned + select() construct, courtesy + Gunnlaugur Ãór Briem. [ticket:2482] + +- engine + - [bug] Fixed memory leak in C version of + result proxy whereby DBAPIs which don't deliver + pure Python tuples for result rows would + fail to decrement refcounts correctly. + The most prominently affected DBAPI + is pyodbc. [ticket:2489] + + - [bug] Fixed bug affecting Py3K whereby + string positional parameters passed to + engine/connection execute() would fail to be + interpreted correctly, due to __iter__ + being present on Py3K string. + [ticket:2503]. + +- postgresql + - [bug] removed unnecessary table clause when + reflecting enums, [ticket:2510]. Courtesy + Gunnlaugur Ãór Briem. + +- oracle + - [bug] Added ROWID to oracle.*, [ticket:2483] + +- mysql + - [feature] Added a new dialect for Google App + Engine. Courtesy Richie Foreman. [ticket:2484] + + +0.7.7 +===== +- orm + - [bug] Fixed issue in unit of work + whereby setting a non-None self-referential + many-to-one relationship to None + would fail to persist the change if the + former value was not already loaded. + [ticket:2477]. - [feature] Added prefix_with() method to Query, calls upon select().prefix_with() to allow placement of MySQL SELECT directives in statements. Courtesy Diana Clarke [ticket:2443] - also in 0.7.7. - [bug] Fixed bug in 0.7.6 introduced by [ticket:2409] whereby column_mapped_collection used against columns that were mapped as joins or other indirect selectables would fail to function. - also in 0.7.7. - [feature] Added new flag to @validates include_removes. When True, collection @@ -170,212 +110,56 @@ will also be sent to the validation function, which accepts an additional argument "is_remove" when this flag is used. - also in 0.7.7. - - - [feature] The after_attach event is now - emitted after the object is established - in Session.new or Session.identity_map - upon Session.add(), Session.merge(), - etc., so that the object is represented - in these collections when the event - is called. Added before_attach - event to accommodate use cases that - need autoflush w pre-attached object. - [ticket:2464] - [bug] Fixed bug whereby polymorphic_on column that's not otherwise mapped on the class would be incorrectly included in a merge() operation, raising an error. [ticket:2449] - also in 0.7.7. - [bug] Fixed bug in expression annotation mechanics which could lead to incorrect rendering of SELECT statements with aliases and joins, particularly when using column_property(). [ticket:2453] - also in 0.7.7. - [bug] Fixed bug which would prevent OrderingList from being pickleable [ticket:2454]. Courtesy Jeff Dairiki - also in 0.7.7. - - - [bug] Fixed bug whereby populate_existing - option would not propagate to subquery - eager loaders. [ticket:2497]. Also - in 0.7.8. - -- engine - - [bug] Fixed memory leak in C version of - result proxy whereby DBAPIs which don't deliver - pure Python tuples for result rows would - fail to decrement refcounts correctly. - The most prominently affected DBAPI - is pyodbc. Also in 0.7.8. [ticket:2489] - - - [bug] Fixed bug affecting Py3K whereby - string positional parameters passed to - engine/connection execute() would fail to be - interpreted correctly, due to __iter__ - being present on Py3K string. - [ticket:2503]. Also in 0.7.8. - - - [feature] Added a new system - for registration of new dialects in-process - without using an entrypoint. See the - docs for "Registering New Dialects". - [ticket:2462] - |