openaleph_procrastinate.repository
Storage backends for the files and FollowTheMoney entities of a dataset.
During the transition to
ftm-lakehouse both the
legacy stores (the Aleph servicelayer archive and the followthemoney
fragments store) and the lakehouse are available behind the same protocols.
Which one is used is decided by the
lakehouse
setting (OPENALEPH_LAKEHOUSE=1).
EntityIds = str | Iterable[str] | None
module-attribute
An id filter: None means "everything", anything else "exactly these".
SERVICELAYER_CHECKSUM = 'sha1'
module-attribute
Content hash algorithm of the legacy archive (the lakehouse uses sha256)
Archive
Bases: Protocol
Blob storage for the files being ingested.
Source code in openaleph_procrastinate/repository.py
EntityStore
Bases: Protocol
Read and write access to the entities of one dataset.
Source code in openaleph_procrastinate/repository.py
FragmentStore
Source code in openaleph_procrastinate/repository.py
close()
Flush. There is nothing else to release – the engine underneath
belongs to the (cached) ftmq store and is shared with every other
user of this dataset.
LakehouseArchive
Source code in openaleph_procrastinate/repository.py
LakehouseStore
Source code in openaleph_procrastinate/repository.py
close()
Flush and hand the writer's connection back to the journal. Only
here, not on every flush, for better performance.
Source code in openaleph_procrastinate/repository.py
flush()
Insert the buffered statements into the journal, keeping the writer open. Flushes the journal to parquet if it's full, but the final flush to parquet needs to be invoked manually by callers.
Source code in openaleph_procrastinate/repository.py
ServicelayerArchive
The legacy Aleph servicelayer archive. It is global, it has no notion of
a dataset, and it is configured via the ARCHIVE_* environment.
Source code in openaleph_procrastinate/repository.py
local_path(content_hash)
For a local archive this yields the archived file itself and leaves it alone; any other backend fetches it into a temporary directory that is cleaned up on exit.
Source code in openaleph_procrastinate/repository.py
ensure_ids(entity_ids)
Normalize an id filter. An empty collection stays empty – it must never widen into "the whole dataset".
Source code in openaleph_procrastinate/repository.py
get_archive(dataset)
cached
Get the archive for a dataset. Archives are stateless, so this is
cached – clear the cache to pick up changed ARCHIVE_* settings.
Source code in openaleph_procrastinate/repository.py
get_entity_store(dataset, origin=None)
Get the entity store for a dataset.
Deliberately not cached: the stores buffer writes, and procrastinate runs
sync tasks in a thread pool, so a shared instance would race on its buffer.
The expensive handles underneath are cached by ftmq and ftm_lakehouse
themselves, which makes building this wrapper cheap.
Source code in openaleph_procrastinate/repository.py
get_sqlalchemy_pool()
Connection pool config for the (legacy) fragments store. It is part of
the ftmq store cache key, so all call sites need to share it to not end
up with a separate engine each.