Skip to main content

Redash API Python Client

python package for interacting with the Redash API

view - Documentation     view - Documentation     GitHub Actions

Features

  • Complete access to all endpoints in the Redash API.
  • Pagination by default.
  • Duplicate dashboards.
  • Manage users and groups.
  • Duplicate queries with different source tables.

Implemented Services

  • Dashboards
  • Queries
  • Data Sources
  • Alerts
  • Users
  • Destinations
  • Groups
  • query_snippets
  • Widgets*

* widgets endpoint does not support GET requests, only update, delete and create.

Getting Started

an API key is required in addition to the instance's host URL.

Installation

pip install redash-python

Usage

from redash_python import Redash

rd = Redash(base_url="", api_key="")


# get all dashboards
dashboards = rd.dashboards.get_all()

# get specific dashboards by id
dash = rd.dashboards.get(1)

# get by slug or name
query = rd.queries.get_by_name("my-dashboard")

# get by tags
q = rd.queries.get_by_tags(["my-tag"])

# get without tags
dash = rd.dashboards.get_by_tags(["my-tag"], without=True)

# Duplicate query with a different table as source
ques = rd.queries
ques.duplicate_query_table(
    query=ques.get(1),
    table_map={"old_table": "new_table"},
    tags=["admin", "test"],
    publish=True,
)

# get a list of implemented API endpoints
print(rd.services)

# get a list of implemented endpoints in a service
print(rd.users)

for a full list of implemented methods in each service, print the service object.

>>> print(client.dashboards)
DashboardsService(attributes: ['endpoint'], methods: ['create', 'create_widget', 'delete', 'duplicate', 'exists', 'favorite', 'favorited', 'get', 'get_all', 'get_by_name', 'get_by_tags', 'get_id', 'get_slug', 'paginate', 'publish', 'refresh', 'share', 'unfavorite', 'unpublish', 'update'])

for more examples on usage, see examples folder on github.

Development

before starting development, install dev dependencies:

pip install redash-python[dev]

Architecture

this library implements a services based architecture splitting each API endpoint group to its own service, on top of which is the Redash class. all the services share base classes from mixins that make it easier to share common behavior and allows rapid development for any new endpoints. for instance adding query_snippets is as simple as:

from .base import BaseService
from .mixins import CommonMixin, NameMixin, PrintMixin


class QSnipsService(CommonMixin, NameMixin, PrintMixin):
    def __init__(self, base: BaseService) -> None:
        # init mixins
        CommonMixin.__init__(self, base)

        self.__base = base
        self.endpoint = "/api/query_snippets"

Directory Structure

redash_python
├── __init__.py
├── redash.py               # Services wrapper
└── services                # implemented services
    ├── base.py             # Base service class
    └── mixins.py           # Mixins for services with shared functionality

Contributing

Contributions are welcome, please open an issue or PR to propose any changes.

License

view - Documentation

Release files for redash-python 0.3.27

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redash-python 0.3.27
File Size Uploaded
redash-python-0.3.27.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redash-python 0.3.27
File Interpreter ABI Platform
redash_python-0.3.27-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / redash-python-0.3.27.tar.gz

Download URL redash-python-0.3.27.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6ed066591403765586ce98f60b96f4c499a539715c3f1997684590cdef62799d
BLAKE2b-256 checksum
How to use checksums
c8a8fa8cb96cf9bf6a852544443c1e5faccdf4c9ee4dd6097b72c37a1c3257d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / redash_python-0.3.27-py3-none-any.whl

Download URL redash_python-0.3.27-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f131711d1291627d86838ce53f56dce2137883065e2a2a9d40159a68139d765
BLAKE2b-256 checksum
How to use checksums
3f120be4b4ac4b51437afea147bc0c84350797887bb6fea86b3d110a6d2a144b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.3.27 This release

2 release files

0.3.26

2 release files

0.3.25

2 release files

0.3.24

2 release files

0.3.23

2 release files

0.3.22

2 release files

0.3.21

2 release files

0.3.17

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.26

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.22

2 release files

0.2.21

2 release files

0.2.20

2 release files

0.2.19

2 release files

0.2.18

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page