Skip to main content

factcat

CI PyPI Licence: MIT

An open-source alternative to Amplitude and Mixpanel that runs in your own data warehouse. Factcat generates SQL and runs it in your BigQuery (or Snowflake, experimental) — no SDK, no ingestion, nothing hosted.

Point it at an events table you already have — one row per event, properties as real columns. Python 3.10+ and credentials for your warehouse.

pip install "factcat[bigquery]"
cd /path/to/your/warehouse   # your mapping is saved here
factcat

That gives you a factcat command. Open http://127.0.0.1:8000. Setup asks which table, which column identifies the thing you are counting, and which column is the event timestamp. Then you have a chart.

Product analytics tools make your modelling decisions for you: entity = a user, period = a calendar bucket, retained = did an event. Real definitions violate all three, so Factcat makes all three yours:

from factcat import RetentionSpec, retention_sql

spec = RetentionSpec(
    table="analytics.fct_subscription_payments",
    entity="subscription_id",   # not the user
    entity_time="sub_start",
    event_time="paid_at",
    period_days=35,             # a billing cycle plus dunning, not a calendar bucket
    n_periods=12,
    retained="status = 'collected' AND within_period_offset <= 5",
)

print(retention_sql(spec, dialect="snowflake"))

retained is arbitrary SQL over any column in your table, plus the derived columns offset_days, period_index and within_period_offset.

Status. Factcat is 0.x. The SQL-generation API — RetentionSpec, FunnelSpec, EventsSpec and the *_sql functions — is the surface that stays stable. A minor release may change those dataclasses or the shape of .factcat.json, and says so at the top of its release notes; a patch release never does. Pin with factcat~=0.5.0.

Warehouses. pip install factcat is SQL generation plus the local chart and includes no warehouse SDK; factcat[bigquery] and factcat[snowflake] add the official driver, factcat[all] adds every shipped one. BigQuery ships today; Snowflake is experimental — its SQL is generated and compiled in CI against Snowflake's grammar, but no live Snowflake account has ever executed it, so treat a first run as a test. SQL generation alone also targets DuckDB, Postgres, Databricks, Spark, Trino, Presto, ClickHouse and Redshift.

Managed tables. Factcat may create fc_ tables in a write dataset you choose, to make repeated breakdowns cheap; they hold entity ids and column values copied from your events table, and they live in your warehouse. See the setup guide.

Long documentation: https://factcat.dev · Releases: https://github.com/gordonkjlee/factcat/releases · Bugs and feedback: https://github.com/gordonkjlee/factcat/issues

Metadata

Release files for factcat 0.6.1

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

Source distribution (sdist)

Source distribution for factcat 0.6.1
File Size Uploaded Provenance Actions
factcat-0.6.1.tar.gz 1.0 MB With provenance Details for factcat-0.6.1.tar.gz

Built distribution (wheel)

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

Total release size: 2.0 MB

Release files / factcat-0.6.1.tar.gz

Download URL factcat-0.6.1.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
67af210a51d5fdee7cd90717b5184a3ace5f2f328b4dd8b4ce9b6ce2d12abb72
BLAKE2b-256 checksum
How to use checksums
0e627d56fab89b2a756a223dfe254cf1ff126f57b543f147ff568225d2b565e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / factcat-0.6.1-py3-none-any.whl

Download URL factcat-0.6.1-py3-none-any.whl
Size 941.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6d8b55c632c1b143ea6722eec4ae0e71f23407dc60ef0f1e5c01e0b169bd1be
BLAKE2b-256 checksum
How to use checksums
808eefd0dd957260388596670bc6d2d19cab0552b9bf3a4f44e949c33a10595c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for factcat 0.6.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for factcat-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

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