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.7.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.7.0
File Size Uploaded Provenance Actions
factcat-0.7.0.tar.gz 1.0 MB With provenance Details for factcat-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.0 MB

Release files / factcat-0.7.0.tar.gz

Download URL factcat-0.7.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
7b3fb3c78bd3f839da532f211585d063b629256d2939e4ea8f2348593ce9dd3c
BLAKE2b-256 checksum
How to use checksums
979d331cfe27ccf39b85b086ba69680f4a70bd05df79b89705a6b16fdecc53de
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 19, 2026.

Transparency log

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

Download URL factcat-0.7.0-py3-none-any.whl
Size 947.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
564623ba117df629ff0c341442b960ceca9518f2fb5aed60df1b5ed2f0428f14
BLAKE2b-256 checksum
How to use checksums
bed6cc42bea949d592446da8c2c6bc1544bd0a7648386df54b71f04f29f2d0a6
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 19, 2026.

Transparency log

Security for factcat 0.7.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.7.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 19, 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