Hi,

I would like to be able to write a query like:

session.query(Post).recent().include_authors().limit(10).all()

that would translate into:

session.query(Post).order_by(Post.created_at.desc()).options(joinedload('author')).limit(10).all()

The former code hides persistence details from the user. Methods
recent() and include_authors() are specific for the Post class.

Is this possible to achieve that kind of syntax on top of SQLAlchemy,
for example, by extending the Query class? I know that I can pass a
custom Query class to the constructor of a Session. It is possible to
set a different Query class for each mapped class?



Regards,
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to