Skip to main content

Python functions for Cube projects using cube.py config file.

Project description

Cube Utils

Cube Utils is a Python library for parsing and extracting information from query payloads.

Installation

You can install Cube Utils using pip:

pip install cube-utils

Usage Here is an example of how to use the extract_cubes function from the cube_utils.query_parser module:

from cube_utils.query_parser import extract_cubes

# Example payload
payload = {
    "dimensions": ["test_a.city", "test_a.country", "test_a.state"],
    "measures": ["test_b.count"],
    "filters": [
        {"values": ["US"], "member": "test_a.country", "operator": "equals"}
    ],
    "timeDimensions": [
        {
            "dimension": "test_c.time",
            "dateRange": ["2021-01-01", "2021-12-31"],
            "granularity": "month",
        }
    ],
}

# Extract cubes
cubes = extract_cubes(payload)
print(cubes)  # Output: ['test_a', 'test_b', 'test_c']

Running Tests

To run the tests, use the following command:

python -m unittest discover tests

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

cube_utils-0.1.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

cube_utils-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file cube_utils-0.1.0.tar.gz.

File metadata

  • Download URL: cube_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure

File hashes

Hashes for cube_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 97a91ee550c70bc791c02e7478adb97eaef13122df57ff78de99bc262deb9822
MD5 50a8aae373ec5c7f9a776ec012c333cf
BLAKE2b-256 5c0564b1602393a9df55a3e462ba887ed00fe43874bf5f80f7fcbf9a5f782955

See more details on using hashes here.

File details

Details for the file cube_utils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cube_utils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure

File hashes

Hashes for cube_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b2f47b5801cf21300c4b608fbd4d1d2f7a2122da7d1a35d028ae937bf4a3c5
MD5 81d85da36371ca0145d6deb84617c77d
BLAKE2b-256 35277cf34449ce31b797e0bb9862d30289c985b3496c426c0745680561190b95

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