cube-http-client


Namecube-http-client JSON
Version 0.3.7 PyPI version JSON
download
home_pagehttps://github.com/mharrisb1/cube-http-client
SummaryPythonic HTTP client for Cube.js REST API (sync + async)
upload_time2024-10-09 18:47:40
maintainerNone
docs_urlNone
authorMichael Harris
requires_python<4.0,>=3.9
licenseMIT
keywords cube.js cube js cube.dev cube
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cube-http-client

Pythonic HTTP client for [Cube.dev](https://cube.dev) REST API (sync + async support)

## Installation

[![PyPI version](https://badge.fury.io/py/cube-http-client.svg)](https://badge.fury.io/py/cube-http-client)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cube-http-client.svg)](https://pypi.org/project/cube-http-client)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/cube-http-client)](https://pypi.org/project/cube-http-client/)

Available on [PyPI](https://pypi.org/project/cube-http-client)

```bash
pip install cube-http-client
```

## Quickstart

```python
import cube_http

cube = cube_http.Client({"url": "...", "token": "..."})

# get metadata
meta = cube.v1.meta()

# load query results
results = cube.v1.load({
    "measures": ["..."],
    "dimensions": ["..."],
})

# compile to SQL
compiled_sql = cube.v1.sql({
    "measures": ["..."],
    "dimensions": ["..."],
})
```

## Support Coverage

| Endpoint                    | Description                                                                                                                                                               | Supported? |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `/v1/load`                  | Get the data for a query.                                                                                                                                                 | ✅         |
| `/v1/sql`                   | Get the SQL Code generated by Cube to be executed in the database.                                                                                                        | ✅         |
| `/v1/meta`                  | Get meta-information for cubes and views defined in the data model. Information about cubes and views with `public: false` will not be returned.                          | ✅         |
| `/v1/run-scheduled-refresh` | Trigger a scheduled refresh run to refresh pre-aggregations.                                                                                                              | ❌         |
| `/v1/pre-aggregations/jobs` | Trigger pre-aggregation build jobs or retrieve statuses of such jobs.                                                                                                     | ❌         |
| `/readyz`                   | Returns the ready state of the deployment.                                                                                                                                | ❌         |
| `/livez`                    | Returns the liveness state of the deployment. This is confirmed by testing any existing connections to dataSource. If no connections exist, it will report as successful. | ❌         |

## Usage

### Synchronous

```python
import cube_http

cube = cube_http.Client(...)
```

### Asynchronous

```python
import cube_http

cube = cube_http.AsyncClient(...)
```

### Error handling

Error classes are available for each endpoint. For example, handling an API error when calling `/v1/meta` endpoint:

```python
import cube_http
from cube_http.exc.v1 import V1MetaError

cube = cube_http.Client(...)

try:
    meta = cube.v1.meta()
except V1MetaError as e:
    print(e)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mharrisb1/cube-http-client",
    "name": "cube-http-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "cube.js, cube js, cube.dev, cube",
    "author": "Michael Harris",
    "author_email": "mharris@definite.app",
    "download_url": "https://files.pythonhosted.org/packages/b1/c7/18195b65b9e63e84c6163f1c261c16f4b28f438b4a873d4ccc6e17492d88/cube_http_client-0.3.7.tar.gz",
    "platform": null,
    "description": "# cube-http-client\n\nPythonic HTTP client for [Cube.dev](https://cube.dev) REST API (sync + async support)\n\n## Installation\n\n[![PyPI version](https://badge.fury.io/py/cube-http-client.svg)](https://badge.fury.io/py/cube-http-client)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cube-http-client.svg)](https://pypi.org/project/cube-http-client)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/cube-http-client)](https://pypi.org/project/cube-http-client/)\n\nAvailable on [PyPI](https://pypi.org/project/cube-http-client)\n\n```bash\npip install cube-http-client\n```\n\n## Quickstart\n\n```python\nimport cube_http\n\ncube = cube_http.Client({\"url\": \"...\", \"token\": \"...\"})\n\n# get metadata\nmeta = cube.v1.meta()\n\n# load query results\nresults = cube.v1.load({\n    \"measures\": [\"...\"],\n    \"dimensions\": [\"...\"],\n})\n\n# compile to SQL\ncompiled_sql = cube.v1.sql({\n    \"measures\": [\"...\"],\n    \"dimensions\": [\"...\"],\n})\n```\n\n## Support Coverage\n\n| Endpoint                    | Description                                                                                                                                                               | Supported? |\n| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |\n| `/v1/load`                  | Get the data for a query.                                                                                                                                                 | \u2705         |\n| `/v1/sql`                   | Get the SQL Code generated by Cube to be executed in the database.                                                                                                        | \u2705         |\n| `/v1/meta`                  | Get meta-information for cubes and views defined in the data model. Information about cubes and views with `public: false` will not be returned.                          | \u2705         |\n| `/v1/run-scheduled-refresh` | Trigger a scheduled refresh run to refresh pre-aggregations.                                                                                                              | \u274c         |\n| `/v1/pre-aggregations/jobs` | Trigger pre-aggregation build jobs or retrieve statuses of such jobs.                                                                                                     | \u274c         |\n| `/readyz`                   | Returns the ready state of the deployment.                                                                                                                                | \u274c         |\n| `/livez`                    | Returns the liveness state of the deployment. This is confirmed by testing any existing connections to dataSource. If no connections exist, it will report as successful. | \u274c         |\n\n## Usage\n\n### Synchronous\n\n```python\nimport cube_http\n\ncube = cube_http.Client(...)\n```\n\n### Asynchronous\n\n```python\nimport cube_http\n\ncube = cube_http.AsyncClient(...)\n```\n\n### Error handling\n\nError classes are available for each endpoint. For example, handling an API error when calling `/v1/meta` endpoint:\n\n```python\nimport cube_http\nfrom cube_http.exc.v1 import V1MetaError\n\ncube = cube_http.Client(...)\n\ntry:\n    meta = cube.v1.meta()\nexcept V1MetaError as e:\n    print(e)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pythonic HTTP client for Cube.js REST API (sync + async)",
    "version": "0.3.7",
    "project_urls": {
        "Documentation": "https://github.com/mharrisb1/cube-http-client",
        "Homepage": "https://github.com/mharrisb1/cube-http-client",
        "Repository": "https://github.com/mharrisb1/cube-http-client"
    },
    "split_keywords": [
        "cube.js",
        " cube js",
        " cube.dev",
        " cube"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e92850d6cdff5e370e972809650c98fcb02c5fbba41972e23c7a834e882206c4",
                "md5": "41b3ba2b5793fd554d40044a37a7c964",
                "sha256": "1bcc28c7d064eb39965906c994be20a90ba7b8464f5356552951f6695b60e4c6"
            },
            "downloads": -1,
            "filename": "cube_http_client-0.3.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "41b3ba2b5793fd554d40044a37a7c964",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 15740,
            "upload_time": "2024-10-09T18:47:35",
            "upload_time_iso_8601": "2024-10-09T18:47:35.278823Z",
            "url": "https://files.pythonhosted.org/packages/e9/28/50d6cdff5e370e972809650c98fcb02c5fbba41972e23c7a834e882206c4/cube_http_client-0.3.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1c718195b65b9e63e84c6163f1c261c16f4b28f438b4a873d4ccc6e17492d88",
                "md5": "925a1e7afe1ec3678db0bbcfce833739",
                "sha256": "b11c5e301d8c8284417d99086eaf5b22c1e82c57a39111665e25216b2ab7c5eb"
            },
            "downloads": -1,
            "filename": "cube_http_client-0.3.7.tar.gz",
            "has_sig": false,
            "md5_digest": "925a1e7afe1ec3678db0bbcfce833739",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 12799,
            "upload_time": "2024-10-09T18:47:40",
            "upload_time_iso_8601": "2024-10-09T18:47:40.151360Z",
            "url": "https://files.pythonhosted.org/packages/b1/c7/18195b65b9e63e84c6163f1c261c16f4b28f438b4a873d4ccc6e17492d88/cube_http_client-0.3.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-09 18:47:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mharrisb1",
    "github_project": "cube-http-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "cube-http-client"
}
        
Elapsed time: 0.35310s