[sqlalchemy] declarative __table__ columns
Is there a way to access the parameters to the Column() call used to set up a database table when given either an instance field or class field? For example: class MyClass(Base): ... f1 = Column(Integer, nullable=False, info={'min':0}) ... If I have MyClass.f1 or my_class.f1 (where my_class is an instance of MyClass) is there a way to get nullable or info? The only way I've come up with so far is to match the __table__.columns elements on the name parameter. Thanks, Mark -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] declarative __table__ columns
On Aug 12, 2011, at 5:05 PM, Mark Erbaugh wrote: Is there a way to access the parameters to the Column() call used to set up a database table when given either an instance field or class field? For example: class MyClass(Base): ... f1 = Column(Integer, nullable=False, info={'min':0}) ... If I have MyClass.f1 or my_class.f1 (where my_class is an instance of MyClass) is there a way to get nullable or info? The only way I've come up with so far is to match the __table__.columns elements on the name parameter. if you have MyClass.fi, column is MyClass.f1.property.columns[0]. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] declarative __table__ columns
On Aug 12, 2011, at 5:26 PM, Michael Bayer wrote: Is there a way to access the parameters to the Column() call used to set up a database table when given either an instance field or class field? For example: class MyClass(Base): ... f1 = Column(Integer, nullable=False, info={'min':0}) ... If I have MyClass.f1 or my_class.f1 (where my_class is an instance of MyClass) is there a way to get nullable or info? The only way I've come up with so far is to match the __table__.columns elements on the name parameter. if you have MyClass.fi, column is MyClass.f1.property.columns[0]. Thanks - just what I was looking for! Mark -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.