Skip to main content

iyree

Python SDK for the IYREE BI analytics platform.

pip install iyree

# With pandas support
pip install iyree[pandas]

Quick Start

Synchronous

from iyree import IyreeClient

with IyreeClient(api_key="my-key", gateway_host="https://api.iyree.io") as client:
    # DWH — run SQL
    result = client.dwh.sql("SELECT * FROM orders LIMIT 10")
    for row in result.to_dicts():
        print(row)

    # DWH — insert data
    client.dwh.insert("staging_table", "col1,col2\n1,hello\n2,world")

    # Cube — analytics query
    result = client.cube.load({"measures": ["orders.count"]})
    print(result.data)

    # S3 — upload / download
    client.s3.upload_object("data/report.csv", b"a,b\n1,2")
    data = client.s3.download_object("data/report.csv")

    # KV — key-value store
    client.kv.put("config", {"theme": "dark"}, key="user_prefs")
    doc = client.kv.get("config", "user_prefs")

Asynchronous

from iyree import AsyncIyreeClient

async with AsyncIyreeClient(api_key="my-key") as client:
    result = await client.dwh.sql("SELECT 1 AS n")
    print(result.to_dicts())

Configuration

Parameter Env Var Default Description
api_key — required API key for gateway auth
gateway_host IYREE_GATEWAY_HOST — Gateway base URL
timeout — 30.0 Default request timeout (seconds)
stream_load_timeout — 300.0 DWH Stream Load timeout
cube_continue_wait_timeout — 120.0 Cube polling timeout
max_retries — 3 Max retry attempts

Cube Query Builder

Build type-safe Cube.js queries:

from iyree import Cube, Query, TimeDimension, DateRange, TimeGranularity

orders = Cube("orders")

query = Query(
    measures=[orders.measure("count"), orders.measure("total_amount")],
    dimensions=[orders.dimension("status")],
    time_dimensions=[
        TimeDimension(
            orders.dimension("created_at"),
            date_range=DateRange(relative="last 30 days"),
            granularity=TimeGranularity.day,
        )
    ],
)

with IyreeClient(api_key="my-key") as client:
    result = client.cube.load(query)
    df = result.to_dataframe()  # requires iyree[pandas]

Or use raw dicts:

result = client.cube.load({
    "measures": ["orders.count"],
    "timeDimensions": [{
        "dimension": "orders.created_at",
        "granularity": "day",
        "dateRange": "last 7 days",
    }],
})

DWH — Stream Load (Insert)

import pandas as pd

df = pd.DataFrame({"id": [1, 2], "name": ["Alice", "Bob"]})
result = client.dwh.insert("users", df, label="load_20240101")
print(f"Loaded {result.number_loaded_rows} rows")

S3 — Object Storage

# Auto-paginating iterator
for obj in client.s3.list_objects_iter(prefix="data/"):
    print(obj.key, obj.size)

# Stream download to file
client.s3.download_object_to_file("data/large.csv", "/tmp/large.csv")

# Upload a DataFrame as Parquet
client.s3.upload_dataframe("reports/q1.parquet", df, format="parquet")

Error Handling

from iyree import IyreeClient, IyreeAuthError, IyreeNotFoundError

try:
    with IyreeClient(api_key="my-key") as client:
        doc = client.kv.get("store", "missing-key")
except IyreeAuthError:
    print("Invalid API key")
except IyreeNotFoundError:
    print("Document not found")

Development

pip install -e ".[dev]"
pytest

License

MIT

Metadata

Release files for iyree 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iyree 0.5.0
File Size Uploaded Provenance Actions
iyree-0.5.0.tar.gz 121.8 kB Without provenance Details for iyree-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iyree 0.5.0
File Interpreter ABI Platform Actions
iyree-0.5.0-py3-none-any.whl Python 3 none any Details for iyree-0.5.0-py3-none-any.whl

Total release size: 173.8 kB

Release files / iyree-0.5.0.tar.gz

Download URL iyree-0.5.0.tar.gz
Size 121.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4e8e655c9d6583336ff24a5bd8e451f789073ebcc57980fba380ba852668188c
BLAKE2b-256 checksum
How to use checksums
15943b2c3f18a3b392dc1c28e0851d3ed7078278aacdb765a29e8417b6dbbf80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / iyree-0.5.0-py3-none-any.whl

Download URL iyree-0.5.0-py3-none-any.whl
Size 52.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e8d3ed60a508afe93766510c1647be53e216fc43402db797c0d8c6e3d0b77d0
BLAKE2b-256 checksum
How to use checksums
e5794cfaedc6b89269b7eae83dc335f60e1b0234cbdc0f67c1ae735a343db386
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for iyree 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page