Skip to main content

No project description provided

Project description

DotCube

Cuby

⚠️ work in progress ⚠️

Cuby is a lightweight metric store with minimal abstractions. It enables fetching metrics, filtered by dimensions, by parsing metric queries based on a data model. The data model defines dimensions and metrics similar to Looker and supports joins on primary keys. The data model is defined in YAML files. The package generates a SQL query that you can use to fetch your results.

Installation

pip install cuby

Usage

Cuby can be used both as a Python library and through its command line interface (CLI).

As a Python Library

You can import the load_cubes, and generate_sql_query functions from their respective modules to use in your Python code.

CLI Commands

To list all cubes:

cuby list_cubes

To list all metrics for a cube:

cuby list_metrics <cube_name>

To execute a query on a model:

cuby query "<query_json>"

The query command expects a JSON string as its argument. Here's an example:

cuby query "{'fields': ['orders.booking_date', 'annual_recurring_revenue', 'churned_revenue'], 'filter': {'country_id': '45', 'product_brand': 'BIG'}, 'sorts': ['booking_date'], 'limit': 300}"

Defining Models

Models are defined in YAML files with the following structure:

name: <cube_name>
table: <table_path>
dimensions:
  - name: <dimension_name>
    sql: <sql_expression>
  ...
metrics:
  - name: <measure_name>
    sql: <sql_expression>
  ...

Basically all SQL databases are supported: PostgreSQL, Snowflake, Redshift, BigQuery, Databricks SQL, Druid, ...

Contributing

If you have suggestions for how Cuby could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cuby-0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

cuby-0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file cuby-0.1.tar.gz.

File metadata

  • Download URL: cuby-0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cuby-0.1.tar.gz
Algorithm Hash digest
SHA256 c5fec98b69399fd70bd5e7a7940686ac76157ea76ce3009e2707b0cb79e3c0d1
MD5 241580ea3d7968dc25c305b6b131c7f5
BLAKE2b-256 e4830d4035e8bface8a89d682ebfa57beea2a8d2a241054cf4e8e3385bdea85d

See more details on using hashes here.

File details

Details for the file cuby-0.1-py3-none-any.whl.

File metadata

  • Download URL: cuby-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cuby-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 703e3479eadb096a138cc39ea2c87ca255fb86d2557945786078fa5ac4980100
MD5 d213befb7805fc48d556a09b7dab6134
BLAKE2b-256 46cfcd5332ec1043e6c75a23cd605a643a5861a56ce778af4aac18d320c72a27

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