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),
                  ForeignKey('instrument.id', onupdate='cascade'),
                  primary_key=True)
    instrument = relationship("Instrument")
    name = Column(String(20), nullable=False)
    period = Column(TSRANGE(), nullable=False, primary_key=True)

How can I set up a 'symbols' dictionary-based collection on Instrument which uses the following query to populate:

session.query(Symbol).filter(
    instrument_id==self.id,
    Symbol.period.contains(func.now())
    )

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to