SQL-like filter queries
Closed this issue · 1 comments
mafrosis commented
Replace the IssueFilter
as it stands with a new SQL-like interface based on moz-sql-parser
The --filter
param will only accept the WHERE
clause, but with a basic select 1 from blah
prefix, we can extract a structured query.
>>> from moz_sql_parser import parse
>>> parse('select 1 from blah where assignee = mafro')
{'select': {'value': 1}, 'from': 'blah', 'where': {'eq': ['assignee', 'mafro']}}
>>> parse('select 1 from blah where assignee = mafro and fixversion = PI12')
{'select': {'value': 1}, 'from': 'blah', 'where': {'and': [{'eq': ['assignee', 'mafro']}, {'eq': ['fixversion', 'PI12']}]}}
Pair this with pandas query()
method to execute dynamic filters on the underlying DataFrame.
Expose on the CLI via a --filter
param, and drop the --projects
filter.