Skip to content
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

[feature?] cannot query on collection like Event.categories #271

Closed
toyg opened this issue Jul 7, 2019 · 2 comments
Closed

[feature?] cannot query on collection like Event.categories #271

toyg opened this issue Jul 7, 2019 · 2 comments
Milestone

Comments

@toyg
Copy link
Contributor

toyg commented Jul 7, 2019

When I want to retrieve all Event instances with a specific category, I must use a filter like this:

categories/any(a:a eq 'Billable')

There seems to be no way to express this in a Query. .iterable() and .any() force me to specify an attribute, which ends up in the filter (e.g. categories/any(a:a/someattribute eq 'Billable')), breaking the query.

Is there a different way to specify a filter like this? Maybe the attribute should be made optional...? I tried looking through utils.py but the filter mechanics look pretty obscure.

Edit: I see that I can pass a literal string instead of a Query object to get_events, so I guess I can use that. Still, it would be nice if Query could handle this case properly.

@alejcas
Copy link
Member

alejcas commented Jul 9, 2019

Yes, you can use the filter parameter instead of using a query instance.

However I agree this should be added to the Query.

Thanks

@alejcas alejcas added this to the v2.0 milestone Jul 15, 2019
alejcas pushed a commit that referenced this issue Jul 15, 2019
Query: Now it's possible to pass attribute=None to the iterable method so you can iterate on the object itself
@alejcas
Copy link
Member

alejcas commented Jul 15, 2019

This will be released on version 2.0

@alejcas alejcas closed this as completed Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants