What do you think about the pattern I've implemented for this purpose using
metaclasses?
https://gist.github.com/aelaguiz/7691751
I've also pasted the code here but it's nicer to look at on github via the
link above:
import logging
import sqlalchemy as sqla
import sqlalchemy.ext.declarative
if it works, that’s fine. as far as metaclasses I like to recommend using
SQLAlchemy class instrumentation events instead so that there’s no complication
re: declarative’s own metaclass and such.
On Nov 28, 2013, at 8:24 AM, Amir Elaguizy aelag...@gmail.com wrote:
What do you think about
If I have a model like:
class Test(Base):
value = sqlalchemy.Column(db.String)
and I have a function like:
def on_value_change(model, oldValue):
# Do stuff
I'd like on_value_change called *after* Test.value has been changed
I know it's possible to do it *before* Test.value has
On Nov 27, 2013, at 12:48 PM, Amir Elaguizy aelag...@gmail.com wrote:
If I have a model like:
class Test(Base):
value = sqlalchemy.Column(db.String)
and I have a function like:
def on_value_change(model, oldValue):
# Do stuff
I'd like on_value_change called *after*