This is an artificial example but it would help my application become more
modular if I could pass a Query object to my session.
I see in the docs it says "Query
<http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query>
objects
are normally initially generated using the query()
<http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.query>
method
of Session
<http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session>.
For a full walkthrough of Query
<http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query>
usage,
see the Object Relational Tutorial
<http://docs.sqlalchemy.org/en/latest/orm/tutorial.html>.", which makes me
think this is possible.
class Thing(Base):
__tablename__ = 'thing'
id = Column(Integer, primary_key=True)
e = create_engine('...')
s = Session(engine)
q = Query(Thing).filter(Thing.id == 5)
r = s.query(q).one() # How do I do this? if at all?
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.