this is my demo of Redash's data.
and here is my Jupyter demo code:
from redash_dynamic_query import RedashDynamicQuery
import pandas as pd
import json
redash = RedashDynamicQuery(
endpoint='http://demo.redash.io/',
apikey='ejsbcH7u2gqCzKjgjltaJhBfrRqkSuTCy1pi5Lur',
#取得したいデータソースIDを設定
data_source_id=1
)
#取得したいクエリIDを設定
query_id = 8174
bind = {
"start_date": '2017-01-01T00:00:00',
"end_date": '2019-12-31T23:59:59',
}
#redashのクエリ結果を取得
result = redash.query(query_id, bind)
res = result['query_result']['data']
#jsonを整形
res_format_json = json.dumps(res, indent=4, separators=(',', ': '))
print(res_format_json)
But i got this error:
ExceptionTraceback (most recent call last)
<ipython-input-19-6bc390f7a5bf> in <module>
15
16 #redashのクエリ結果を取得
---> 17 result = redash.query(query_id, bind)
18 res = result['query_result']['data']
19
/opt/conda/lib/python3.7/site-packages/redash_dynamic_query/__init__.py in query(self, query_id, bind, as_csv)
26
27 # post query result
---> 28 response = self._api_query_results(self._build_query(query_id, query_body, query_data_source_id))
29 if 'query_result' in response:
30 return response
/opt/conda/lib/python3.7/site-packages/redash_dynamic_query/__init__.py in _api_query_results(self, query_string)
90 )
91 if response.status_code != 200:
---> 92 raise Exception('query_results failed. [%d]' % response.status_code)
93
94 return response.json()
Exception: query_results failed. [404]
Am I setting something wrong. I just did base on origin document of redash_dynamic_query library. Thank you for reading and please give me a hand if you have the answer.