Skip to main content

Redash API Client

Project description

Redash-API-Client

Redash API Client written in Python.

Dependencies

  • Python3.6+

Installation

Install using pip:

pip install redash-api-client

Getting Started

from redashAPI.client import RedashAPIClient

# Create Client instance
"""
    :args:
    API_KEY
    REDASH_HOST (optional): 'http://localhost:5000' by default
"""
Redash = RedashClient(API_KEY, REDASH_HOST)


# Connect to a Data Source
"""
    :args:
    DATA_SOURCE_NAME
    DATA_SOURCE_TYPE: ["sqlite", "mysql", "pg", "mongodb", "mssql" ...]
    OPTIONS
"""
Redash.connect_data_source("First Data Source", "pg", {
    "dbname": DB_NAME,
    "host": DB_HOST,
    "user": DB_USER,
    "passwd": DB_PASSWORD,
    "port": DB_PORT
})


# Create Query
"""
    :args:
    QUERY_NAME
    DATA_SOURCE_ID
    QUERY_STRING
    WITH_RESULT (optional): Generate query_result automatically, True by default
"""
Redash.create_query("First Query", 1, "SELECT * FROM table_name;", False)


# Generate Query Result
"""
    :args:
    DATA_SOURCE_ID
    QUERY_STRING
    QUERY_ID
"""
Redash.generate_query_result(1, "SELECT * FROM table_name;", 1)


# Create Visualization
"""
    :args:
    NAME
    QUERY_ID
    CHART_TYPE: ["line", "column", "area", "pie", "scatter", "bubble", "box"]
    X_AXIS_COLUMN
    Y_AXIS_COLUMN
    Y_LABEL (optional): Custom name for legend
"""
Redash.create_visualization("First Visualization", 1, "line", X_AXIS_COLUMN, Y_AXIS_COLUMN, Y_LABEL)


# Create Dashboard
"""
    :args:
    NAME
"""
Redash.create_dashboard("First Dashboard")


# Add Visualization into Dashboard
"""
    :args:
    DASHBOARD_ID
    VISUALIZATION_ID
    FULL_WIDTH (optional): Full width or not on dashboard, False by default
"""
Redash.add_to_dashboard(1, 1, True)


# Get Dashboard public URL
"""
    :args:
    DASHBOARD_ID
"""
url = Redash.get_dashboard_public_url(1)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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-api-client-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

redash_api_client-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file redash-api-client-0.1.2.tar.gz.

File metadata

  • Download URL: redash-api-client-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for redash-api-client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2b0e1599620167af5c992c676f6c14b0e4d077874376b3bf49de9ba1f3b8d29b
MD5 366909edc85b1e6f530de70fe43dcad0
BLAKE2b-256 e293a0e7ee1d21154cda50e453cd307ed6bfffca642931e64af780bbd3994361

See more details on using hashes here.

File details

Details for the file redash_api_client-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: redash_api_client-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for redash_api_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1dd165fa1f0e0b80a40f401353c5fc8361e3f51ca5ff4029a9b2c0e4523980ad
MD5 072bd22178ac7d1334b50f62a85dd587
BLAKE2b-256 98d8bcdd091d402fa666e174bb91f98bda502ab13c99463c634057241f5ba729

See more details on using hashes here.

Supported by

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