Skip to main content

Modification in fetch page to be able to get all queries instead of 25

Project description

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 differerent 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-modification

Usage

from redash_python_modification 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 depndencies:

pip install redash-python-modification[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 propse any changes.

License

view - Documentation

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

redash-python-modification-0.0.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redash_python_modification-0.0.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file redash-python-modification-0.0.3.tar.gz.

File metadata

File hashes

Hashes for redash-python-modification-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c199778ac0ddd86f7d72d3937591d2d42d933611e1aff73f5f2a7d8969c1634e
MD5 13c9173be6badc69f264a0cd98c6d48e
BLAKE2b-256 0ef8852c034d6281fb63330973fbb38a316cfca8d96795adc90b5744b5f8aedf

See more details on using hashes here.

File details

Details for the file redash_python_modification-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for redash_python_modification-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 96739c81643c212bd18aa54914cf720af7f03fe015956cc1248fe189876db88a
MD5 852af9bfeb59753223bce127c6084433
BLAKE2b-256 1537c15dc68b726c832655a0563cabecdf8da1612b73e674c86fb48f0bad9deb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page