kde_cpi.data.loader module¶
Async PostgreSQL integration for CPI datasets.
- class kde_cpi.data.loader.CpiDatabaseLoader(dsn=None, schema='public', connection_kwargs=NOTHING)[source]¶
Bases:
objectPersist CPI datasets into PostgreSQL using asyncpg primitives.
- async bulk_load(dataset, *, truncate=True)[source]¶
Copy the full dataset into PostgreSQL, optionally truncating first.
- async connect(**overrides)[source]¶
Establish (or reuse) the async connection.
- Return type:
Connection- Parameters:
overrides (Any)
- async fetch_dataset()[source]¶
Reconstruct a Dataset from the current database contents.
- Return type:
- async sync_metadata(dataset)[source]¶
Upsert mapping tables and series definitions without touching observations.
- async upsert_observations(observations)[source]¶
Upsert one or more observation rows.
- Return type:
- Parameters:
observations (Iterable[Observation])