[sqlalchemy] mapping objects to arbitary selects, read and write

2010-07-08 Thread Chris Withers
Hi All, Say we have the following model: class Price(Base): __tablename__ = 'price' id = Column(Integer, primary_key=True) value = Column(Numeric(precision=36, scale=12)) class Instrument(Base): __tablename__ = 'instrument' id = Column(Integer, primary_key=True) ticker

Re: [sqlalchemy] mapping objects to arbitary selects, read and write

2010-07-08 Thread Michael Bayer
On Jul 8, 2010, at 2:42 PM, Chris Withers wrote: Hi All, Say we have the following model: class Price(Base): __tablename__ = 'price' id = Column(Integer, primary_key=True) value = Column(Numeric(precision=36, scale=12)) class Instrument(Base): __tablename__ =

Re: [sqlalchemy] mapping objects to arbitary selects, read and write

2010-07-08 Thread Chris Withers
Michael Bayer wrote: class Allocation(Base): __tablename__ = 'data' id = Column(Integer, primary_key=True) trade_id = Column(Integer, index=True) instrument_id = Column(ForeignKey(Instrument.id)) instrument = relationship(Instrument) quantity = Column(Integer) price_id =