In my application, some tables have several fields that need to have the same
type and default value, i.e.:
field1 = Column(Integer, default=2)
field2 = Column(Integer, default=2)
...
Is there some way to refactor the Common(Integer, default=2), short of creating
a custom column type? I could see the possibility that in a future version of
the application, I would want to globally change the column type or default
value for all these fields at once.
So far, I've come up with creating a function that returns the column.
def common_field():
return Column(Integer, default=2)
field1 = common_field()
field2 = common_field()
Is there a better way?
Mark
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.