A simple OLAP library.
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 thetesseract_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.
This project is licensed under MIT.
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
Built Distribution
File details
Details for the file tesseract_olap-0.12.0.tar.gz
.
File metadata
- Download URL: tesseract_olap-0.12.0.tar.gz
- Upload date:
- Size: 60.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.6 Linux/6.6.51
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 465fb67c2ba3eebaa86a79d1cef0719c1e4d3a804465ce5943488c1dbeef50d7 |
|
MD5 | dfc9a8659fa9d1ba431df026d74cc2bc |
|
BLAKE2b-256 | c19cba069b9f187c63bbd85e155ed6f7edd56e9f3ef82b71495a0ab0d05672ce |
File details
Details for the file tesseract_olap-0.12.0-py3-none-any.whl
.
File metadata
- Download URL: tesseract_olap-0.12.0-py3-none-any.whl
- Upload date:
- Size: 74.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.6 Linux/6.6.51
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e5a98cd89e8577ca1003787113f3acc4abb851a1479c8a5cb20c8116d0573f9 |
|
MD5 | 4ba7f0b1d1aa61547fd87ca09bc6bf70 |
|
BLAKE2b-256 | 9b7122a93d18601f2b8399a0409b22d6f6771a0ed5e9d982942b67abb20a8f50 |