Hi All,
Suppose I have the following:
from sqlalchemyimport Column, Integer, Text, ForeignKey, and_
from sqlalchemy.dialects.postgresqlimport TSRANGEas Range
from sqlalchemy.ext.declarativeimport declarative_base
Base = declarative_base()
class A(Base):
id = Column(Integer(),primary_key=True)
period = Column(Range(),nullable=False,primary_key=True)
data = Column(Text())
class B(Base):
id = Column(Integer(),primary_key=True)
period = Column(Range(),nullable=False,primary_key=True)
data = Column(Text())
a_id = Column('a_id', Integer(), ForeignKey('a.id'))
data = Column(Text())
class C(Base):
id = Column(Integer(),primary_key=True)
period = Column(Range(),nullable=False,primary_key=True)
data = Column(Text())
b_id = Column('b_id', Integer(), ForeignKey('b.id'))
How would I write something that molested the session such that instead
of writing:
session.query(A, B, C)
.select_from(A).join(B, and_(A.id==B.a_id,
A.period.contains(now),
B.period.contains(now)).
.join(C, and_(B.id==C.b_id,
C.period.contains(now)))
...I could write:
session.query(A, B, C).as_at(now)
And instead of writing:
session.query(A).filter(A.id>10).filter(A.period.contains(now))
I could write:
session.query(A).filter(A.id>10).as_at(now))
Lazily yours,
Chris
--
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/d/optout.