redash-python


Nameredash-python JSON
Version 0.3.27 PyPI version JSON
download
home_page
SummaryA more complete Python client for the Redash API
upload_time2023-06-07 05:43:22
maintainer
docs_urlNone
author
requires_python>=3.7
licenseBSD-2-Clause
keywords redash
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Redash API Python Client

python package for interacting with the Redash API

[![view - Documentation](https://img.shields.io/badge/PyPi-0.3.27-blue?style=for-the-badge)](https://pypi.org/project/redash-python "view package on PyPi")
   
[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](https://redash.blacksuan19.dev/ "go to documentation")
   
[![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)](# "Build with 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

- [x] Dashboards
- [x] Queries
- [x] Data Sources
- [x] Alerts
- [x] Users
- [x] Destinations
- [x] Groups
- [x] query_snippets
- [x] 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

```bash
pip install redash-python
```

### Usage

```python
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.

```python
>>> 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:

```bash
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:

```python
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

```bash
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](https://img.shields.io/badge/License-BSD%202%20Clause-green?style=for-the-badge)](https://github.com/Blacksuan19/redash-python/blob/master/LICENSE "View License")

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "redash-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "redash",
    "author": "",
    "author_email": "blacksuan19 <py@blacksuan19.dev>",
    "download_url": "https://files.pythonhosted.org/packages/c8/a8/fa8cb96cf9bf6a852544443c1e5faccdf4c9ee4dd6097b72c37a1c3257d6/redash-python-0.3.27.tar.gz",
    "platform": null,
    "description": "# Redash API Python Client\n\npython package for interacting with the Redash API\n\n[![view - Documentation](https://img.shields.io/badge/PyPi-0.3.27-blue?style=for-the-badge)](https://pypi.org/project/redash-python \"view package on PyPi\")\n&nbsp;&nbsp;&nbsp;\n[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](https://redash.blacksuan19.dev/ \"go to documentation\")\n&nbsp;&nbsp;&nbsp;\n[![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)](# \"Build with github actions\")\n\n## Features\n\n- Complete access to all endpoints in the Redash API.\n- Pagination by default.\n- Duplicate dashboards.\n- Manage users and groups.\n- Duplicate queries with different source tables.\n\n### Implemented Services\n\n- [x] Dashboards\n- [x] Queries\n- [x] Data Sources\n- [x] Alerts\n- [x] Users\n- [x] Destinations\n- [x] Groups\n- [x] query_snippets\n- [x] Widgets\\*\n\n\\* widgets endpoint does not support GET requests, only update, delete and\ncreate.\n\n## Getting Started\n\nan API key is required in addition to the instance's host URL.\n\n### Installation\n\n```bash\npip install redash-python\n```\n\n### Usage\n\n```python\nfrom redash_python import Redash\n\nrd = Redash(base_url=\"\", api_key=\"\")\n\n\n# get all dashboards\ndashboards = rd.dashboards.get_all()\n\n# get specific dashboards by id\ndash = rd.dashboards.get(1)\n\n# get by slug or name\nquery = rd.queries.get_by_name(\"my-dashboard\")\n\n# get by tags\nq = rd.queries.get_by_tags([\"my-tag\"])\n\n# get without tags\ndash = rd.dashboards.get_by_tags([\"my-tag\"], without=True)\n\n# Duplicate query with a different table as source\nques = rd.queries\nques.duplicate_query_table(\n    query=ques.get(1),\n    table_map={\"old_table\": \"new_table\"},\n    tags=[\"admin\", \"test\"],\n    publish=True,\n)\n\n# get a list of implemented API endpoints\nprint(rd.services)\n\n# get a list of implemented endpoints in a service\nprint(rd.users)\n```\n\nfor a full list of implemented methods in each service, print the service\nobject.\n\n```python\n>>> print(client.dashboards)\nDashboardsService(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'])\n```\n\nfor more examples on usage, see examples folder on github.\n\n## Development\n\nbefore starting development, install dev dependencies:\n\n```bash\npip install redash-python[dev]\n```\n\n### Architecture\n\nthis library implements a services based architecture splitting each API\nendpoint group to its own service, on top of which is the `Redash` class. all\nthe services share base classes from mixins that make it easier to share common\nbehavior and allows rapid development for any new endpoints. for instance adding\nquery_snippets is as simple as:\n\n```python\nfrom .base import BaseService\nfrom .mixins import CommonMixin, NameMixin, PrintMixin\n\n\nclass QSnipsService(CommonMixin, NameMixin, PrintMixin):\n    def __init__(self, base: BaseService) -> None:\n        # init mixins\n        CommonMixin.__init__(self, base)\n\n        self.__base = base\n        self.endpoint = \"/api/query_snippets\"\n```\n\n### Directory Structure\n\n```bash\nredash_python\n\u251c\u2500\u2500 __init__.py\n\u251c\u2500\u2500 redash.py               # Services wrapper\n\u2514\u2500\u2500 services                # implemented services\n    \u251c\u2500\u2500 base.py             # Base service class\n    \u2514\u2500\u2500 mixins.py           # Mixins for services with shared functionality\n```\n\n## Contributing\n\nContributions are welcome, please open an issue or PR to propose any changes.\n\n## License\n\n[![view - Documentation](https://img.shields.io/badge/License-BSD%202%20Clause-green?style=for-the-badge)](https://github.com/Blacksuan19/redash-python/blob/master/LICENSE \"View License\")\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "A more complete Python client for the Redash API",
    "version": "0.3.27",
    "project_urls": {
        "Documentation": "https://redash.blacksuan19.dev/",
        "Homepage": "https://redash.blacksuan19.dev/",
        "Issues": "https://github.com/blacksuan19/redash-python/issues",
        "Repository": "https://github.com/blacksuan19/redash-python/"
    },
    "split_keywords": [
        "redash"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f120be4b4ac4b51437afea147bc0c84350797887bb6fea86b3d110a6d2a144b",
                "md5": "4a477b3c7c996c436e2c9240e3a12f22",
                "sha256": "4f131711d1291627d86838ce53f56dce2137883065e2a2a9d40159a68139d765"
            },
            "downloads": -1,
            "filename": "redash_python-0.3.27-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a477b3c7c996c436e2c9240e3a12f22",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 13248,
            "upload_time": "2023-06-07T05:43:20",
            "upload_time_iso_8601": "2023-06-07T05:43:20.462549Z",
            "url": "https://files.pythonhosted.org/packages/3f/12/0be4b4ac4b51437afea147bc0c84350797887bb6fea86b3d110a6d2a144b/redash_python-0.3.27-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8a8fa8cb96cf9bf6a852544443c1e5faccdf4c9ee4dd6097b72c37a1c3257d6",
                "md5": "03914966d3b920d04718f959db69fddb",
                "sha256": "6ed066591403765586ce98f60b96f4c499a539715c3f1997684590cdef62799d"
            },
            "downloads": -1,
            "filename": "redash-python-0.3.27.tar.gz",
            "has_sig": false,
            "md5_digest": "03914966d3b920d04718f959db69fddb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10500,
            "upload_time": "2023-06-07T05:43:22",
            "upload_time_iso_8601": "2023-06-07T05:43:22.130138Z",
            "url": "https://files.pythonhosted.org/packages/c8/a8/fa8cb96cf9bf6a852544443c1e5faccdf4c9ee4dd6097b72c37a1c3257d6/redash-python-0.3.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-07 05:43:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blacksuan19",
    "github_project": "redash-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "redash-python"
}
        
Elapsed time: 0.09605s