I've the following class
class Comision(Base):
__tablename__ = 'comision'
id = Column(Integer, primary_key=True)
key = Column(Integer, default=process())
in the column key i've the def process and i need to make some operations with the primary key of that table, it is possible to pass it like argument?
Try
key = Column(Integer, default=process)
or
key = Column(Integer, default=lambda:process())
Defined as key = Column(Integer, default=process()), process() is called once only when class Comision is defined.
Take a look at Context-Sensitive Default Functions in http://docs.sqlalchemy.org/en/rel_0_8/core/defaults.html for more detail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With