Python SDK

Dimensions

Define typed fields for selecting, grouping, and filtering dataset queries in Python.

Dimensions are the non-aggregated fields in a dataset. They are the fields callers can select, group by, filter on, and order by.

The key is the semantic API name. The first argument is the field type, and keyword options map the field to ClickHouse.

from hypequery.datasets import dimension

dimensions = {
    "id": dimension("string"),
    "status": dimension("string", label="Status"),
    "is_trial": dimension("boolean", column="is_trial"),
    "created_at": dimension("timestamp", column="created_at"),
}

With that definition, callers use the semantic names:

analytics.execute(
    orders,
    DatasetQuery(dimensions=("status", "created_at"), measures=("revenue",)),
)

Types

ClickHouse typesDimension type
String, LowCardinality(String), Enum, UUID"string"
UInt64, Int32, Float64, Decimal"number"
Bool or boolean-style UInt8 flags"boolean"
Date, DateTime, DateTime64"timestamp"

Options

OptionPurpose
columnThe ClickHouse column, when it differs from the semantic name
label, descriptionHuman-readable metadata for catalogs and tools
sql, dependenciesA SQL expression instead of a column
filterable, groupableSet to False to stop callers filtering or grouping by the field. Both are allowed by default

On this page

Get early access to hypequery cloud.

Cloud hosts the same model you run in your backend, with a managed API and MCP server, versions, and rollback. We're letting teams in a few at a time. Join the waitlist and we'll reach out when your project can go live.

How do you want to build your analytics layer? (Optional)
What features do you most need? (Optional)

Pick as many as you like.

Only your email is required. All other questions are optional.