summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/events.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-09-10 16:54:23 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-09-10 16:54:23 -0400
commitbb62d80217e584acf3f899804bb66b19f71205e2 (patch)
tree72fb88a12bcf660be5408f5acd64518eb3381dbf /lib/sqlalchemy/orm/events.py
parente61a4438493c812990382ec5f1fc46016b319a4c (diff)
downloadsqlalchemy-bb62d80217e584acf3f899804bb66b19f71205e2.tar.gz
- New event hook, MapperEvents.after_configured().
Called after a configure() step has completed and mappers were in fact affected. Theoretically this event is called once per application, unless new mappings are constructed after existing ones have been used already. - New declarative features: - __declare_last__() method, establishes an event listener for the class method that will be called when mappers are completed with the final "configure" step. - __abstract__ flag. The class will not be mapped at all when this flag is present on the class. - New helper classes ConcreteBase, AbstractConcreteBase. Allow concrete mappings using declarative which automatically set up the "polymorphic_union" when the "configure" mapper step is invoked. - The mapper itself has semi-private methods that allow the "with_polymorphic" selectable to be assigned to the mapper after it has already been configured. [ticket:2239]
Diffstat (limited to 'lib/sqlalchemy/orm/events.py')
-rw-r--r--lib/sqlalchemy/orm/events.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py
index 714cc9245..d551ecf7a 100644
--- a/lib/sqlalchemy/orm/events.py
+++ b/lib/sqlalchemy/orm/events.py
@@ -404,6 +404,21 @@ class MapperEvents(event.Events):
"""
# TODO: need coverage for this event
+ def after_configured(self):
+ """Called after a series of mappers have been configured.
+
+ This corresponds to the :func:`.orm.configure_mappers` call, which
+ note is usually called automatically as mappings are first
+ used.
+
+ Theoretically this event is called once per
+ application, but is actually called any time new mappers
+ have been affected by a :func:`.orm.configure_mappers` call. If new mappings
+ are constructed after existing ones have already been used,
+ this event can be called again.
+
+ """
+
def translate_row(self, mapper, context, row):
"""Perform pre-processing on the given result row and return a
new row instance.