redash-python-modification


Nameredash-python-modification JSON
Version 0.0.3 PyPI version JSON
download
home_page
SummaryModification in fetch page to be able to get all queries instead of 25
upload_time2023-01-27 18:37:40
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.20-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://www.blacksuan19.dev/redash-python/ "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 differerent 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-modification
```

### Usage

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

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

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

```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 propse 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-modification",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "redash",
    "author": "",
    "author_email": "karenarcoverde <arcoverdek@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/0e/f8/852c034d6281fb63330973fbb38a316cfca8d96795adc90b5744b5f8aedf/redash-python-modification-0.0.3.tar.gz",
    "platform": null,
    "description": "# Redash API Python Client\r\n\r\npython package for interacting with the Redash API\r\n\r\n[![view - Documentation](https://img.shields.io/badge/PyPi-0.3.20-blue?style=for-the-badge)](https://pypi.org/project/redash-python \"view package on PyPi\")\r\n&nbsp;&nbsp;&nbsp;\r\n[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](https://www.blacksuan19.dev/redash-python/ \"go to documentation\")\r\n&nbsp;&nbsp;&nbsp;\r\n[![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)](# \"Build with github actions\")\r\n\r\n## Features\r\n\r\n- Complete access to all endpoints in the Redash API\r\n- Pagination by default\r\n- Duplicate dashboards\r\n- Manage users and groups\r\n- Duplicate queries with differerent source tables\r\n\r\n### Implemented Services\r\n\r\n- [x] Dashboards\r\n- [x] Queries\r\n- [x] Data Sources\r\n- [x] Alerts\r\n- [x] Users\r\n- [x] Destinations\r\n- [x] Groups\r\n- [x] query_snippets\r\n- [x] Widgets\\*\r\n\r\n\\* widgets endpoint does not support GET requests, only update, delete and\r\ncreate.\r\n\r\n## Getting Started\r\n\r\nan API key is required in addition to the instance's host URL.\r\n\r\n### Installation\r\n\r\n```bash\r\npip install redash-python-modification\r\n```\r\n\r\n### Usage\r\n\r\n```python\r\nfrom redash_python_modification import Redash\r\n\r\nrd = Redash(base_url=\"\", api_key=\"\")\r\n\r\n\r\n# get all dashboards\r\ndashboards = rd.dashboards.get_all()\r\n\r\n# get specific dashboards by id\r\ndash = rd.dashboards.get(1)\r\n\r\n# get by slug or name\r\nquery = rd.queries.get_by_name(\"my-dashboard\")\r\n\r\n# get by tags\r\nq = rd.queries.get_by_tags([\"my-tag\"])\r\n\r\n# get without tags\r\ndash = rd.dashboards.get_by_tags([\"my-tag\"], without=True)\r\n\r\n# Duplicate query with a different table as source\r\nques = rd.queries\r\nques.duplicate_query_table(\r\n    query=ques.get(1),\r\n    table_map={\"old_table\": \"new_table\"},\r\n    tags=[\"admin\", \"test\"],\r\n    publish=True,\r\n)\r\n\r\n# get a list of implemented API endpoints\r\nprint(rd.services)\r\n\r\n# get a list of implemented endpoints in a service\r\nprint(rd.users)\r\n```\r\n\r\nfor a full list of implemented methods in each service, print the service\r\nobject.\r\n\r\n```python\r\n>>> print(client.dashboards)\r\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'])\r\n```\r\n\r\nfor more examples on usage, see examples folder on github.\r\n\r\n## Development\r\n\r\nbefore starting development, install dev depndencies:\r\n\r\n```bash\r\npip install redash-python-modification[dev]\r\n```\r\n\r\n### Architecture\r\n\r\nthis library implements a services based architecture splitting each API\r\nendpoint group to its own service, on top of which is the `Redash` class. all\r\nthe services share base classes from mixins that make it easier to share common\r\nbehavior and allows rapid development for any new endpoints. for instance adding\r\nquery_snippets is as simple as:\r\n\r\n```python\r\nfrom .base import BaseService\r\nfrom .mixins import CommonMixin, NameMixin, PrintMixin\r\n\r\n\r\nclass QSnipsService(CommonMixin, NameMixin, PrintMixin):\r\n    def __init__(self, base: BaseService) -> None:\r\n        # init mixins\r\n        CommonMixin.__init__(self, base)\r\n\r\n        self.__base = base\r\n        self.endpoint = \"/api/query_snippets\"\r\n```\r\n\r\n### Directory Structure\r\n\r\n```bash\r\nredash_python\r\n\u251c\u2500\u2500 __init__.py\r\n\u251c\u2500\u2500 redash.py               # Services wrapper\r\n\u2514\u2500\u2500 services                # implemented services\r\n    \u251c\u2500\u2500 base.py             # Base service class\r\n    \u2514\u2500\u2500 mixins.py           # Mixins for services with shared functionality\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome, please open an issue or PR to propse any changes.\r\n\r\n## License\r\n\r\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\")\r\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "Modification in fetch page to be able to get all queries instead of 25",
    "version": "0.0.3",
    "split_keywords": [
        "redash"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1537c15dc68b726c832655a0563cabecdf8da1612b73e674c86fb48f0bad9deb",
                "md5": "852af9bfeb59753223bce127c6084433",
                "sha256": "96739c81643c212bd18aa54914cf720af7f03fe015956cc1248fe189876db88a"
            },
            "downloads": -1,
            "filename": "redash_python_modification-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "852af9bfeb59753223bce127c6084433",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 13696,
            "upload_time": "2023-01-27T18:37:38",
            "upload_time_iso_8601": "2023-01-27T18:37:38.391582Z",
            "url": "https://files.pythonhosted.org/packages/15/37/c15dc68b726c832655a0563cabecdf8da1612b73e674c86fb48f0bad9deb/redash_python_modification-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ef8852c034d6281fb63330973fbb38a316cfca8d96795adc90b5744b5f8aedf",
                "md5": "13c9173be6badc69f264a0cd98c6d48e",
                "sha256": "c199778ac0ddd86f7d72d3937591d2d42d933611e1aff73f5f2a7d8969c1634e"
            },
            "downloads": -1,
            "filename": "redash-python-modification-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "13c9173be6badc69f264a0cd98c6d48e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10616,
            "upload_time": "2023-01-27T18:37:40",
            "upload_time_iso_8601": "2023-01-27T18:37:40.375360Z",
            "url": "https://files.pythonhosted.org/packages/0e/f8/852c034d6281fb63330973fbb38a316cfca8d96795adc90b5744b5f8aedf/redash-python-modification-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-27 18:37:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "redash-python-modification"
}
        
Elapsed time: 0.03318s