Skip to main content

A semantic layer for your data.

Project description

Installation

Besides the main contents of the package, you can install the optional dependencies for the backend driver of your choice:

  • tesseract-olap[clickhouse]
    Installs the dependency needed to enable the use of the tesseract_olap.backend.clickhouse module.

Getting started

In its most basic form, the tesseract-olap package provides you with a way to translate OLAP-type queries into request statements that a data backend can understand and execute safely. The results obtained through the execution of server methods are python objects, and as such, can be used in any way the language allows.

# example.py

from tesseract_olap.backend.clickhouse import ClickhouseBackend
from tesseract_olap import OlapServer

backend = ClickhouseBackend("clickhouse://user:pass@localhost:9000/database")
server = OlapServer(backend=backend, schema="./path/to/schema.xml")

def get_data():
    # First you create an ordered representation of the intent for data
    request = DataRequest.new("cube_name", {
      "drilldowns": ["Time", "Country"],
      "measures": ["Units", "Price"],
    })

    # This step performs the validation of the request against the schema
    query = DataQuery.from_request(server.schema, request)

    # The context manager establishes the connection with the backend
    with server.session() as session:
        # .fetch() methods perform the request against the server.
        # There are three methods depending on the shape you want the data:
        # result = session.fetch(query)
        # result = session.fetch_dataframe(query)
        result = session.fetch_records(query)
    
    return result.data

if __name__ == "__main__":
    get_data()

The server instance can then be used in other programs as the data provider, for simple (like data exploration) and complex (like data processing) operations.


© 2022 Datawheel, LLC.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

tesseract_olap-0.22.6.tar.gz (89.1 kB view details)

Uploaded Source

Built Distribution

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

tesseract_olap-0.22.6-py3-none-any.whl (114.2 kB view details)

Uploaded Python 3

File details

Details for the file tesseract_olap-0.22.6.tar.gz.

File metadata

  • Download URL: tesseract_olap-0.22.6.tar.gz
  • Upload date:
  • Size: 89.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for tesseract_olap-0.22.6.tar.gz
Algorithm Hash digest
SHA256 c72fe8af64de5eebe95d1a051b78b2a14d3a0d76e30388e5ccc5a509859a31d8
MD5 1032eba14686329f3d6cd7aca5c3b977
BLAKE2b-256 047b96f6fd52372d6ea08da64204fb63d682f94dde07eb47c6f5172478f1be80

See more details on using hashes here.

File details

Details for the file tesseract_olap-0.22.6-py3-none-any.whl.

File metadata

  • Download URL: tesseract_olap-0.22.6-py3-none-any.whl
  • Upload date:
  • Size: 114.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for tesseract_olap-0.22.6-py3-none-any.whl
Algorithm Hash digest
SHA256 79baa28a9a7826cded591078b5c9323a0a979b7933a7ea6b8eb9dafcdcaec0bd
MD5 45d7014b084a93e9e92c4d16798b5a3e
BLAKE2b-256 242b1b2853c7ba4cc0457ef6c12b675174a6d08e6e5765c67f0815caaecdcced

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