Python SDK

Time grains

Aggregate Python dataset queries by minute, hour, day, week, month, quarter, and year.

When a dataset has a time_key, pass a grain as by to bucket results by time period:

analytics.execute(
    orders,
    DatasetQuery(by="month", dimensions=("country",), measures=("revenue",)),
)

Results include a period column, ordered ascending. Buckets are computed in the query's time zone: DatasetQuery(timezone="America/New_York"), or the client's default from create_dataset_client(timezone=...), which is UTC unless set.

Supported grains:

  • minute
  • hour
  • day
  • week (weeks start on Sunday)
  • month
  • quarter
  • year

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.