Redash Dynamic Query
Project description
## Redash Dynamic Query
A tool for executing dynamic query of redash.
## Install
```
pip install redash-dynamic-query
```
## SYNOPSIS
```python
from redash_dynamic_query import RedashDynamicQuery
redash = RedashDynamicQuery(
endpoint='http://myredash-host',
apikey='secret_apikey',
data_source_id=2, # Optional, default auto fill
max_age=0, # Optional, default value is 0
max_wait=60, # Optional, default value is 60
)
query_id = 111
bind = {
'start_date': '2017-01-01T00:00:00',
'end_date': '2017-01-01T23:59:59',
}
result = redash.query(query_id, bind)
print(result['query_result']['data'])
# {
# 'rows': [
# {'mydata': 'xxx'}
# ],
# 'columns': [
# {
# 'type': 'string',
# 'friendly_name': 'mydata',
# 'name': 'mydata'
# }
# ]
# }
```
## CLI
```
% rdq
```
```
% rdq --help
usage: rdq [-h] [-d N] [-a N] [-w N] [-k APIKEY] [-e ENDPOINT] -q QUERY_ID
[-p QUERY_PARAMETERS] [-f {csv,tsv,json,redash_csv}]
Process some integers.
optional arguments:
-h, --help show this help message and exit
-d N, --data-source-id N
an integer for the data_source_id
-a N, --max-age N an integer for the max_age
-w N, --max-wait N an integer for the max_wait(timeout)
-k APIKEY, --apikey APIKEY
required: redash apikey (can also be specified using
REDASH_APIKEY environment variable)
-e ENDPOINT, --endpoint ENDPOINT
required: redash endpoint (can also be specified using
REDASH_ENDPOINT environment variable)
-q QUERY_ID, --query-id QUERY_ID
required: redash query id
-p QUERY_PARAMETERS, --query-parameters QUERY_PARAMETERS
redash query parameters(eg. key1=val1,key2=val2)
-f {csv,tsv,json,redash_csv}, --output-format {csv,tsv,json,redash_csv}
redash output format
```
```
# example
% rdq -e http://myredash-host -k secret_apikey -q 111 -p start_date=2017-01-01T00:00:00,end_date=2017-01-01T23:59:59 -f csv
```
## LICENSE
MIT
A tool for executing dynamic query of redash.
## Install
```
pip install redash-dynamic-query
```
## SYNOPSIS
```python
from redash_dynamic_query import RedashDynamicQuery
redash = RedashDynamicQuery(
endpoint='http://myredash-host',
apikey='secret_apikey',
data_source_id=2, # Optional, default auto fill
max_age=0, # Optional, default value is 0
max_wait=60, # Optional, default value is 60
)
query_id = 111
bind = {
'start_date': '2017-01-01T00:00:00',
'end_date': '2017-01-01T23:59:59',
}
result = redash.query(query_id, bind)
print(result['query_result']['data'])
# {
# 'rows': [
# {'mydata': 'xxx'}
# ],
# 'columns': [
# {
# 'type': 'string',
# 'friendly_name': 'mydata',
# 'name': 'mydata'
# }
# ]
# }
```
## CLI
```
% rdq
```
```
% rdq --help
usage: rdq [-h] [-d N] [-a N] [-w N] [-k APIKEY] [-e ENDPOINT] -q QUERY_ID
[-p QUERY_PARAMETERS] [-f {csv,tsv,json,redash_csv}]
Process some integers.
optional arguments:
-h, --help show this help message and exit
-d N, --data-source-id N
an integer for the data_source_id
-a N, --max-age N an integer for the max_age
-w N, --max-wait N an integer for the max_wait(timeout)
-k APIKEY, --apikey APIKEY
required: redash apikey (can also be specified using
REDASH_APIKEY environment variable)
-e ENDPOINT, --endpoint ENDPOINT
required: redash endpoint (can also be specified using
REDASH_ENDPOINT environment variable)
-q QUERY_ID, --query-id QUERY_ID
required: redash query id
-p QUERY_PARAMETERS, --query-parameters QUERY_PARAMETERS
redash query parameters(eg. key1=val1,key2=val2)
-f {csv,tsv,json,redash_csv}, --output-format {csv,tsv,json,redash_csv}
redash output format
```
```
# example
% rdq -e http://myredash-host -k secret_apikey -q 111 -p start_date=2017-01-01T00:00:00,end_date=2017-01-01T23:59:59 -f csv
```
## LICENSE
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file redash-dynamic-query-1.0.4.tar.gz.
File metadata
- Download URL: redash-dynamic-query-1.0.4.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.20.0 setuptools/36.6.0 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/2.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2756ad2f7fd21f33cbf8c751ec3fccaf9ad350a27b968cd56b3d1783650b5f9
|
|
| MD5 |
aeef5a184f18db32b49b2de4330383f7
|
|
| BLAKE2b-256 |
c9aa8a7dc9ffaf83907957f10b6db9789bc7b1d811c58c200a6ac07e837ccc0e
|