Hey guys -
I forgot about the really obvious way to do this - class decorators:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
def common_columns(cls):
cls.created_at = Column(DateTime,
Hi again,
I took the approach with creating a Mixin with 4 staticmethods and
call them in each of my models, which works quite good. But now i face
another, i think related, problem.
i get the following columns produced:
created_by_id = Column(Integer, ForeignKey('worker.id',
onupdate=cascade,
On Dec 17, 2009, at 2:35 PM, Daishy wrote:
Hi again,
I took the approach with creating a Mixin with 4 staticmethods and
call them in each of my models, which works quite good. But now i face
another, i think related, problem.
i get the following columns produced:
created_by_id =
Hi,
I think you are right, messing with the metaclass for 4 columns is not
really what i want :)
Instead i will use your approach. Put those Columns in the function
within the mixin along with all other functions and then call them
within the column-definition.
Thanks for fast answer!
Greetings,