django-sql-explorer
django-sql-explorer copied to clipboard
Sql explorer save query params
Description
This provides the functionality to save query params so that the queries execute with them each time one comes to the Query Detail page.
Resolves: #482
Deployment Procedures
- [ ] Migration (Please specify app(s) below)
./manage.py migrate explorer
Tests
Execute Manual UI Tests like the following:
- Create a new query with a query param and save, note the same functionality exists as previously where the query does not execute due to no value for the new param:
-
Input a value for the parameter and save:

-
Now add a new parameter and save:
- Now save a new value to the second parameter:
- Now navigate back to the Query List page and click on the test query:
- Validate that the new
QueryParamspersist and the query executed:
Also, you will want to verify that the csv and JSON exports still work correctly like:

Note: This is tested with Python3.8 and Django3.2
It looks like I need to update some tests and there is one change I think will be best when creating/deleting the query parameters. Will try to get to those today.
@dwmorrison33 yeah I've not had time to look at the tests but think I saw a change to the way the params attribute works in the view
Whoa whoa whoa -- there actually IS a way to do this! The param syntax supports providing a default value. As per the docs:
You can combine both a default and label to your parameter but you must start with the label: $$paramName|label:defaultValue$$.
Does that hit the bid?
Whoa whoa whoa -- there actually IS a way to do this! The param syntax supports providing a default value. As per the docs:
You can combine both a default and label to your parameter but you must start with the label: paramName|label:defaultValue.
Does that hit the bid?
@chrisclark Thank you for the info, but this PR is stale. I’m thankful we didn’t move forward with this request last year, I will close this PR now.
All good! I really appreciate you taking the time and sorry it took uh...a year to weigh in.