-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enable multiple filters to be supplied by using get_resource_sql
#54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice solution!
@csillasch if you're happy with this approach, would you have time to add any more tests to it? Also should we have the message? I'm leaning towards removing it, as I'm no longer sure that the user needs to know how we are doing the filtering :D |
Yes sounds good, I will look at adding some more tests. |
add test for invalid row filter & col select add test for multiple filters in get dataset
If there's no column filter supplied, use the SQL wildcard `*` to indicate all columns.
I was working with @peterl04. He was using https://www.opendata.nhs.scot/dataset/prescriptions-in-the-community but needed data on specific drugs from a number of practices for ~2 years (24 resources). Each resource takes 30+ seconds to fully download, so filtering is super useful. However, only being able to filter by one drug and practice at a time is quite limiting and makes the code more complicated.
This change worked for me. It just uses
get_resource_sql
when multiple filters are supplied and generates some appropriate SQL.I think it could probably do with more tests, especially for incorrect or weird/edge cases. I tried to do it using existing functions as much as possible.
One thing to note is that
get_resource_sql
is slower thanget_resource
so there could be a better way of doing this...