-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Managing more than one entity in AstToSqlAlchemyClauseVisitor
#24
Comments
Hmm, I haven't really used queries that select multiple entities before. Our usual approach is to select a single entity and let OData handle any joining and filtering through attributes, e.g.: But your case definitely sounds like something we should support as well! I'll have to think about how this should behave and how we can make it work. |
In some way, I made it work... The problem is that I do not know if it behaves has it should. I made |
Hey @AndiZeta, One minor thing I would add is to allow passing the model "namespaces" as a dict, instead of always relying on
One other thing I'll have to keep in mind is whether this behavior can somehow map onto Django as well, as I'd like to keep the implementations as close as possible. I'd happily accept a PR, or otherwise I can cook something up myself based on your code when I find some more time. |
…cts as requested in issue gorilla-co#24
Hi,
I faced a problem that very likely has a simple solution that I do not see. I am using release v0.5.2 to modify sqlalchemy queries.
I tried to use the module to filter a query that selects more than one ORM entity. I faced the problem that
AstToSqlAlchemyClauseVisitor
expects a single type on entity, but the query gets and filter fields from ORM entities of different types. I guess there is a way of doing this and I do not realize which is it.As an example, using the models from
models.py
used in testing, I did not find a proper way to freely filter the following query:Using a similar approach as in
shorthand.apply_odata_query
I can apply filters on fields of any of the two entities (usingAliasRewriter
if needed), but sinceAstToSqlAlchemyClauseVisitor
accepts a single entity I do not see a way to filter on both.Please let me know if there is a proper way to manage this kind of queries. Meanwhile, I made an ugly hack to circumvent this, that it probably breaks many things.
The text was updated successfully, but these errors were encountered: