Re: [sqlalchemy] mapping to a dictionary-based collection using a select

2013-06-21 Thread Chris Withers
On 17/06/2013 17:35, Michael Bayer wrote: On Jun 17, 2013, at 2:36 AM, Chris Withersch...@simplistix.co.uk wrote: Hi All, I have a model roughly like this: class Instrument(Base): __tablename__ = 'instrument' id = Column(String(10), primary_key=True) name = Column(String(100))

Re: [sqlalchemy] mapping to a dictionary-based collection using a select

2013-06-21 Thread Michael Bayer
On Jun 21, 2013, at 1:39 PM, Chris Withers ch...@simplistix.co.uk wrote: well you're going to have relationship with primaryjoin=and_(Symbol.instrument_id==Instrument.id, Symbol.period.contains(func.now())) (what does contains(func.now()) do ? # select now(); now

[sqlalchemy] mapping to a dictionary-based collection using a select

2013-06-17 Thread Chris Withers
Hi All, I have a model roughly like this: class Instrument(Base): __tablename__ = 'instrument' id = Column(String(10), primary_key=True) name = Column(String(100)) class Symbol(Base): __tablename__ = 'symbol' instrument_id = Column(String(10),

Re: [sqlalchemy] mapping to a dictionary-based collection using a select

2013-06-17 Thread Michael Bayer
On Jun 17, 2013, at 2:36 AM, Chris Withers ch...@simplistix.co.uk wrote: Hi All, I have a model roughly like this: class Instrument(Base): __tablename__ = 'instrument' id = Column(String(10), primary_key=True) name = Column(String(100)) class Symbol(Base): __tablename__