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 app (Events and Funnel screens) 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.8.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 factcat 0.8.0
File Size Uploaded Provenance Actions
factcat-0.8.0.tar.gz 1.1 MB With provenance Details for factcat-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.1 MB

Release files / factcat-0.8.0.tar.gz

Download URL factcat-0.8.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
d13c0ba3d152a236f8879487a12110a863b1c600ee7e3203fa661a23b320d3e5
BLAKE2b-256 checksum
How to use checksums
cab18375e5c6972be5e7a0ed63d882fe977cfc15c34e46d1beab92095e3ced83
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 30, 2026.

Transparency log

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

Download URL factcat-0.8.0-py3-none-any.whl
Size 970.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90b06859966af5c307147c33b9ac1ff0947cee13f7ac172610c28007c50982e4
BLAKE2b-256 checksum
How to use checksums
708bc14e36128a2733de7a7cdd7b6d6a351b807ee8a33af12aed1d650b22b530
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 30, 2026.

Transparency log

Security for factcat 0.8.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.

Full provenance

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

Select from 2 files

Attestation for factcat-0.8.0.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 30, 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