Skip to main content

Docs ftmq on pypi PyPI Downloads PyPI - Python Version Python test and package pre-commit Coverage Status AGPLv3+ License Pydantic v2

ftmq

ftmq queries and filters Follow The Money entities from json files / streams or from a statement-based nomenklatura store.

Its ftmq.Query is the backend-agnostic query object of the OpenAleph ecosystem: it filters FtM streams and stores, compiles to SQL, and converts to and from OpenAleph API params.

New to Follow The Money? See this introduction.

Installation

Minimum Python version: 3.11

pip install ftmq

Usage

Command line

cat entities.ftm.json | ftmq -q 'filter:schema=Company&filter:properties.country=de&filter:gte:properties.incorporationDate=2023' -o s3://data/entities-filtered.ftm.json

Python Library

from ftmq import Query, M, P, G, smart_read_proxies

# legal entities in `companies` based in Germany, or in Austria and incorporated
# since 2020, not dissolved: the 5 most recently incorporated
q = Query().where(
    M(dataset="companies"),
    M(schemata="LegalEntity"),
    G(countries="de") | (G(countries="at") & P(incorporationDate__gte=2020)),
    ~P(status__ilike="%dissolved%"),
).order_by(P("incorporationDate"), ascending=False)[:5]

for proxy in smart_read_proxies("s3://data/entities.ftm.json", query=q):
    print(proxy.caption)

ftmq.search indexes entities into full-text search stores backed by SQLite FTS5 or Tantivy (pip install ftmq[search]):

cat entities.ftm.json | ftmq search transform | ftmq search --uri sqlite:///ftmqs.db index
ftmq search --uri sqlite:///ftmqs.db "jane doe"

HTTP API

ftmq.api serves a store and its search index as a read-only FastAPI application speaking the Aleph filter grammar (pip install ftmq[api]):

granian --interface asgi ftmq.api.app:app
curl "localhost:8000/entities?filter:schema=Payment&filter:gte:properties.date=2023"

Documentation

https://docs.investigraph.dev/lib/ftmq

Support

This project is part of investigraph

In 2023, development of ftmq was supported by Media Tech Lab Bayern batch #3

ftmq, (C) 2023 Simon Wörpel ftmq, (C) 2024-2025 investigativedata.io ftmq, (C) 2025 Data and Research Center – DARC

ftmq is licensed under the AGPLv3 or later license.

Prior to version 0.8.0, ftmq was released under the MIT license.

see NOTICE and LICENSE

Metadata

Release files for ftmq 5.3.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 ftmq 5.3.1
File Size Uploaded Provenance Actions
ftmq-5.3.1.tar.gz 96.9 kB Without provenance Details for ftmq-5.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 217.7 kB

Release files / ftmq-5.3.1.tar.gz

Download URL ftmq-5.3.1.tar.gz
Size 96.9 kB
Tags Source
SHA-256 checksum
How to use checksums
15cbdb531b82ef7a1f82e792badd3e67cf67df046274d7b59ea88eb8a12c287e
BLAKE2b-256 checksum
How to use checksums
14eb2e56f77efe0944307d13348d15cb5735b1ad234741104fe0dc7863e84e93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-38-generic

Release files / ftmq-5.3.1-py3-none-any.whl

Download URL ftmq-5.3.1-py3-none-any.whl
Size 120.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11da4080e1d0e9984d4d188fe6077dd6d76c26a561f8f9461382eeafca732e48
BLAKE2b-256 checksum
How to use checksums
74096569c46ea1588a3bc1823304b8068d955c75e4117d16ffb89819ed13a296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-38-generic

Security for ftmq 5.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

5.3.1 This release

2 release files No provenance

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