With sqlalchemy, how do I filter on a literal column?
So I have a query.
session.query (Object.att1, Object.att2, literal_column ('x'). Label ('xVar')) Where now I Literally column! = X.
For this reason I want to do this, because I have two questions which I have found in a joint query, so every query has a literal column and the identifier who asks is. And sometimes I have to filter the union query to return one of only two questions.
I think the answer is:
let me query the query in a new subquery And then I can filter that question, as an example.
union = session.query (Object .att1, object.att2, literal_column ('x'). Label ('xVar')). Subquery () toFilter = session.query (unionQuery) .filter (unionQuery.c.xvar! = 'X')
No comments:
Post a Comment