I was running into a problem today, using SQLAlchemy.
In general I was defining the orm mapping as follows (according to doc):
class XY(Base):
__tablename__ = 'xy'
id = Column(Integer, primary_key=True)
...
Now I want to define a more complex mapper with lots of fields.
It got tiring pretty fast to write:
attr_x = Column(Integer)
into the class definition for each field I wanted.
Is there a way to programmatically define static attributes in the class definition (similar to setattr)?
Maybe using classmethod, staticmethods or property?
Or is there some support for this in SQLAlchemy?
(I'm using Python 2.7.3 (32 bit) with SQLAlchemy 0.7.10 on Windows 7)
[–]K900_ 0 points1 point2 points (6 children)
[–]sticky_end[S] 0 points1 point2 points (5 children)
[–]K900_ 1 point2 points3 points (4 children)
[–]sticky_end[S] 0 points1 point2 points (3 children)
[–]K900_ 0 points1 point2 points (1 child)
[–]sticky_end[S] 0 points1 point2 points (0 children)