Hello,
I'm new to SQLAlchemy and have searched high and low for a solution to my
problem so I'm hoping someone here can help. I have a query where I need to
apply the 'order by' clause dynamically (both the column and the
direction). So a 'static' version of my query would be:
studies = session.query(Study).options(
joinedload(Study.system),
joinedload(Study.site)).
filter(System.system_id=41).
order_by(Study.study_id.desc()).
all()
However the order can be asc or desc and it could be any column from the 3
tables. I found this post on Stackoverflow which helps with a dynamic sort
direction (asc, desc), but it doesn't help me with the dynamic column:
http://stackoverflow.com/questions/20904226/python-sqlalchemy-dynamic-order-by
Thanks in advance.
-Tony
--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.