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

Cannot refresh query using API #45

Closed
goWithK opened this issue Apr 16, 2021 · 1 comment
Closed

Cannot refresh query using API #45

goWithK opened this issue Apr 16, 2021 · 1 comment

Comments

@goWithK
Copy link

goWithK commented Apr 16, 2021

I have a query but one of parameters is type "query based dropdown list". I do not know the format of json for this parameter.
Please help me!!!

Here is the example I've followed: https://github.com/getredash/redash-toolbelt/blob/master/redash_toolbelt/examples/refresh_query.py

@susodapop
Copy link
Collaborator

See the below script:

from redash_toolbelt.examples.refresh_query import get_fresh_query_result

HOST = "<your Redash url>"
KEY = "<your api key>"
ID = "<your query id>"

# My test query uses a query-based dropdown parameter named `foo`
# The underlying query returns integers 1 - 5. These are acceptable parameter values.

# The following call succeeds
result = get_fresh_query_result(
    redash_url=HOST,
    query_id=ID,
    api_key=KEY,
    params={"foo": 1},
)

# But this fails...
result = get_fresh_query_result(
    redash_url=HOST,
    query_id=ID,
    api_key=KEY,
    params={"foo": 6},
)

# Because 6 is not an allowed value for `foo`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants