Local Redash
local-redash is a command line client for redash.
Description
local-redash is a command line tool that can list queries, list data sources, execute queries and display results.
Supported Python Versions
3.10.x and greater
Installation
Use the package manager pip to install local-redash.
pip install local-redash
Configuration
The configuration file is automatically created in ~/.config/local_redash/config.yml at first startup. See the file itself for a description of all available options.
The data is displayed using python-tabulate, which can be configured in the table_format of the config.yml.
Usage
Set environment variables
- Set the redash api url and api key to environment variables
- REDASH_URL: Sets the API endpoint, which will be the base URL for Redash.
- API_KEY: Set the redash API key.You can find it on the User Profiles page.
- Check the redash documentation for details.
$ export REDASH_URL=YOUR_REDASH_API_URL
$ export API_KEY=YOUR_REDASH_API_KEY
CLI Usage
- Show help
$ local-redash --help
Usage: local-redash [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
data-source-list
export-query
query
query-list
show-query
- Show data source list
$ local-redash data-source-list
+------+--------+----------------+----------+----------+-------------+--------+
| id | name | pause_reason | syntax | paused | view_only | type |
+======+========+================+==========+==========+=============+========+
| 1 | test | None | sql | 0 | False | pg |
+------+--------+----------------+----------+----------+-------------+--------+
- Show query list
- Columns to be displayed are set in config.yml.
$ local-redash query-list
+------+-------------------------+------------------+-----------------------+--------------------------+--------------------------+
| id | name | data_source_id | runtime | retrieved_at | created_at |
+======+=========================+==================+=======================+==========================+==========================+
| 1 | test-01 | 1 | 0.0031499862670898438 | 2023-01-01T00:00:00.000Z | 2023-01-01T00:00:00.000Z |
+------+-------------------------+------------------+-----------------------+--------------------------+--------------------------+
| 2 | test-02 | 1 | 0.0031499862670898438 | 2023-01-01T00:00:00.000Z | 2023-01-01T00:00:00.000Z |
+------+-------------------------+------------------+-----------------------+--------------------------+--------------------------+
| 3 | test-03 | 1 | 18.041463136672974 | 2023-01-01T00:00:00.000Z | 2023-01-01T00:00:00.000Z |
+------+-------------------------+------------------+-----------------------+--------------------------+--------------------------+
- Show query
$ local-redash show-query --query-id [query id]
+----------------------------------------------------------------------------------------------------------------------+
| query |
+======================================================================================================================+
| select film.film_id, film.title, film, description, rating from film inner join film_category on |
| film.film_id = film_category.film_id inner join category on film_category.category_id = category.category_id where |
| category.name = 'Comedy' |
+----------------------------------------------------------------------------------------------------------------------+
- Run query
$ local-redash query --query-file [query file path] --data-source-id [data source]
ex. $ local-redash query --query-file ./select_test.sql --data-source-id 1
+---------------+----------+----------------------+
| language_id | name | last_update |
+===============+==========+======================+
| 1 | English | 2022-02-15T10:02:19Z |
+---------------+----------+----------------------+
| 2 | Italian | 2022-02-15T10:02:19Z |
+---------------+----------+----------------------+
| 3 | Japanese | 2022-02-15T10:02:19Z |
+---------------+----------+----------------------+
| 4 | Mandarin | 2022-02-15T10:02:19Z |
+---------------+----------+----------------------+
| 5 | French | 2022-02-15T10:02:19Z |
+---------------+----------+----------------------+
| 6 | German | 2022-02-15T10:02:19Z |
+---------------+----------+----------------------+
- Export query
$ local-redash export-query --query-name [query name] ----file-path [file path]
ex. $ local-redash export-query --query-name "query_test" --file-path ./
+------------------------+
| exported-query |
+========================+
| select * from language |
+------------------------+
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Metadata
Release files for local-redash 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| local_redash-0.0.2.tar.gz | 11.2 kB | Without provenance | Details for local_redash-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| local_redash-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for local_redash-0.0.2-py3-none-any.whl |
Total release size: 25.6 kB
Release files / local_redash-0.0.2.tar.gz
| Download URL | local_redash-0.0.2.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fe0b0f35cc90c8cf0840c214c53d83a951b00bd4e9023b7767aa11bbfa67500
|
|
BLAKE2b-256 checksum How to use checksums |
d5bbb53a8b5802a4961aad19935afea787d4ea2bc7f81847286a88fe74e09064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Release files / local_redash-0.0.2-py3-none-any.whl
| Download URL | local_redash-0.0.2-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0dd968aee1b6af45121f73f581e357436c73f0dc7692cd91e5122a3f0be8c4f
|
|
BLAKE2b-256 checksum How to use checksums |
a0c0e345342add472de6908fe30b8e0e7291ed2237a94dd645a0ddff71f93c2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Security for local-redash 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.