Yep, much nicer:
def add_constraints(mapper, class_):
table = class_.__table__
elements = [('period', '')]
for col in table.primary_key.columns:
if col.name!='period':
elements.append((col, '='))
table.append_constraint(ExcludeConstraint(*elements))
the individual event classes should talk about it as it's available:
http://docs.sqlalchemy.org/en/rel_0_8/orm/events.html?highlight=instrument_class#sqlalchemy.orm.events.MapperEvents
On May 26, 2013, at 11:39 AM, Chris Withers ch...@simplistix.co.uk wrote:
Yep, much nicer:
def
I would apply a single event listener to Temporal, and do all the work of
adding the constraints and all that in the one event handler. I'd skip
__table_args__.
If you're on 0.8, you can apply listeners to mixins and unmapped classes using
propagate=True, and the events should trigger for all
Hi All,
I have a mixin defined like this:
def add_exclude_constraint(mapper, class_):
table = class_.__table__
elements = [('period', '')]
for col in table.primary_key.columns:
if col.name!='period':
elements.append((col, '='))