Embedded Python API Use typed arguments with a DuckDB connection configured by your application.
View the Python source
Search classes and methods
DailyPartitionPlanner Map application model IDs to registered daily assets on one connection.
__init__(self, connection: DuckDBPyConnection, models: Mapping[str, str])pending(self, model_id: str, start: date, end: date) → list[date]Registered days in [start, end) whose latest attempt has not succeeded.
pending_ranges(self, model_id: str, start: date, end: date) → list[tuple[date, date]]Coalesce adjacent pending registered days into half-open ranges.
DateWindow Half-open calendar date range.
PartitionGrain DAY = 'day'MONTH = 'month'ALL = 'all'RollingDependency Days before and after an output date that its calculation reads.
lookback: int = 0lookahead: int = 0PlanStep tenant_id: strmodel_id: strwindow: DateWindowreason: strparent_id: str | Noneestimated_bytes: int | NoneCoverageClaim claim_id: UUIDmodel_id: strgeneration: strwindow: DateWindowCoverageBatch claims: tuple[CoverageClaim, ...]generation(self)window(self)GenerationCoverage Durable half-open work intervals on a host-owned, tenant-specific database.
__init__(self, connection: DuckDBPyConnection, models: Mapping[str, str])enqueue(self, model_id: str, generation: str, requested: DateWindow) → list[CoverageClaim]Atomically reserve just the pieces not already queued or completed.
finish(self, claim: CoverageClaim, *, success: bool) → boolKeep successful coverage or release a failed reservation for retry.
batches(claims: list[CoverageClaim]) → list[CoverageBatch]Combine adjacent intervals from separate requests into one job.
settle(self, batch: CoverageBatch, succeeded: set[UUID]) → tuple[bool, ...]Commit successful portions and release failed portions in one transaction.
ChangeWindowPlanner Read-side change plan for a host-registered calendar DAG.
The caller supplies a tenant-specific graph and retained date horizon at
construction. Use ALL when an edge has no established partition mapping.
__init__(self, dependencies: Mapping[str, Mapping[str, PartitionGrain | RollingDependency]], horizon: DateWindow)affected(self, source_id: str, changed: DateWindow) → dict[str, tuple[DateWindow, ...]]Propagate one changed window to downstream models in topological order.
affected_many(self, changes: Mapping[str, Iterable[DateWindow]]) → dict[str, tuple[DateWindow, ...]]Propagate disjoint source changes and merge touching output intervals.
explain(self, changes: Mapping[str, Iterable[DateWindow]], *, tenant_id: str, bytes_per_day: Mapping[str, int] | None=None) → Iterator[PlanStep]Stream source and parent-edge evidence in dependency order.
ChangeLedger Persist source corrections by revision in a tenant-scoped DuckDB file.
FileRevision FileIngestionLedger Track immutable file revisions for one registered input on a tenant database.
__init__(self, connection: DuckDBPyConnection, input_id: str)pending(self, files: list[FileRevision]) → list[FileRevision]Return distinct, unprocessed revisions in inventory order.
complete(self, files: list[FileRevision]) → intConfirm file revisions after their ingest output has committed.
QualityCheckSelector Choose registered checks from changes to their model and column inputs.
ForeignKeyCheck Count non-null child keys missing from a registered parent relation.
child: strchild_key: strparent: strparent_key: strviolation_count(self, connection: DuckDBPyConnection) → intRowCountRule minimum: int = 0maximum: int | None = NoneNullRule column_id: strmaximum: int = 0NumericRangeRule column_id: strminimum: floatmaximum: floatallowed: int = 0QualityObservation check_id: strobserved: intpassed: boolSharedQualityScan Validate an interval against host-registered columns with one scan.
__init__(self, connection: DuckDBPyConnection, relation: str, *, date_column: str, columns: Mapping[str, str])evaluate(self, window: DateWindow, checks: Mapping[str, RowCountRule | NullRule | NumericRangeRule]) → list[QualityObservation]RevisionExample key: intkind: strprevious: dict | Nonecurrent: dict | NoneRevisionComparison added: intremoved: intchanged: intunchanged: intprevious_duplicate_keys: intcurrent_duplicate_keys: intprevious_null_keys: intcurrent_null_keys: intcolumn_changes: dict[str, int]examples: tuple[RevisionExample, ...]RevisionDifference Compare two compatible relations with a registered BIGINT key.
__init__(self, connection: DuckDBPyConnection, previous: str, current: str, *, key: str, columns: Mapping[str, str])compare(self, *, example_limit: int=20) → RevisionComparisonModelFingerprint Hashes of executable inputs and the versions of referenced models.
definition: strupstream_versions: tuple[tuple[str, str | None], ...]macros: strsettings: strengine: strcapture(cls, sql: str, *, engine_version: str, macros: Mapping[str, str] | None=None, settings: Mapping[str, str] | None=None, upstream_versions: Mapping[str, str | None] | None=None)differences(self, other: 'ModelFingerprint') → tuple[str, ...]FingerprintPlanner Return invalidation reasons from consecutive executable model snapshots.
__init__(self, dependencies: Mapping[str, Iterable[str]])plan(self, previous: Mapping[str, ModelFingerprint], current: Mapping[str, ModelFingerprint]) → dict[str, tuple[str, ...]]FingerprintStore Keep immutable named fingerprints in the tenant's DuckDB file.
__init__(self, connection: DuckDBPyConnection)save(self, revision: str, models: Mapping[str, ModelFingerprint]) → Noneload(self, revision: str) → dict[str, ModelFingerprint]ReleaseModel physical_version: strcontract: strReleasePlan environment_id: UUIDrevision: strbase_epoch: intinput_epoch: intPublishedGeneration revision: strepoch: intmodels: tuple[tuple[str, ReleaseModel], ...]inputs: tuple[tuple[str, str], ...]ReleaseNotification event_id: UUIDenvironment: strepoch: intrevision: strkind: strStaleReleasePlan The active generation or source inputs changed since preparation.
ReleaseRequestConflict A publication key was already used with a different request.
GenerationCatalog Publish immutable checked manifests through one DuckDB transaction per environment.
__init__(self, connection: DuckDBPyConnection, environment: str, model_ids: set[str])set_inputs(self, inputs: Mapping[str, str]) → NoneRecord the currently visible source versions without changing the active release.
stage(self, revision: str, models: Mapping[str, ReleaseModel], *, inputs: Mapping[str, str], checks: Mapping[str, bool]) → NoneRecord all already-prepared physical versions and their passed checks.
prepare(self, revision: str) → ReleasePlanvalidate(self, plan: ReleasePlan) → NoneVerify the plan before applying work. Publication checks the same versions again.
publish(self, plan: ReleasePlan, *, request_key: str | None=None) → PublishedGenerationrollback(self, revision: str, *, expected_epoch: int) → PublishedGenerationRepoint the active release to an already published manifest.
pending_notifications(self, *, limit: int) → list[ReleaseNotification]Read a bounded batch. The caller may deliver the same event again until ACK.
acknowledge_notifications(self, events: list[UUID]) → intMark previously delivered IDs from this environment as acknowledged.
active(self) → PublishedGeneration | Nonefork(self, target_environment: str) → 'GenerationCatalog'Create a trial environment pinned to the current immutable references.
JsonType INTEGER = ('BIGINT', ('BIGINT', 'UBIGINT'))NUMBER = ('DOUBLE', ('BIGINT', 'UBIGINT', 'DOUBLE'))TEXT = ('VARCHAR', ('VARCHAR',))BOOLEAN = ('BOOLEAN', ('BOOLEAN',))JsonField path: tuple[str, ...]kind: JsonTypeProjectedJson values: dict[str, int | float | str | bool | None]issues: dict[str, str]source: str | NoneJsonProjector Project a host-registered set of JSON paths to typed DuckDB STRUCT fields.
VariantEvent event_id: strkind: stroccurred_at: datetimejson_attributes: strReadVariantEvent event_id: strkind: stroccurred_at: datetimeattributes: dictVariantEventLog Keep event keys in typed columns and tenant-specific attributes in VARIANT.
__init__(self, connection: DuckDBPyConnection, stream: str, *, promoted_text: str | None=None)append(self, events: list[VariantEvent]) → Noneread(self, kind: str, *, key: str | None=None, value: str | None=None) → list[ReadVariantEvent]ColumnType BOOLEAN = 'BOOLEAN'SMALLINT = 'SMALLINT'INTEGER = 'INTEGER'BIGINT = 'BIGINT'HUGEINT = 'HUGEINT'FLOAT = 'FLOAT'DOUBLE = 'DOUBLE'TEXT = 'VARCHAR'DATE = 'DATE'TIMESTAMP = 'TIMESTAMP'INSTANT = 'TIMESTAMP WITH TIME ZONE'JSON = 'JSON'ColumnContract kind: ColumnTypenullable: bool = TrueSchemaViolation column: strkind: strexpected: str | bool | Noneactual: str | bool | NoneRelationContract Check declared column names, types and nullability against DuckDB metadata.
__init__(self, columns: Mapping[str, ColumnContract], *, allow_extra: bool=True)inspect(self, connection: DuckDBPyConnection, relation: str) → tuple[SchemaViolation, ...]ScheduledTask tenant: strdepends_on: tuple[str, ...]duration: int | NoneCriticalPathScheduler Prioritize ready tasks by estimated remaining path under tenant quotas.
MembershipChange key: intprevious_group: str | Nonecurrent_group: str | NoneGroupDelta Refresh region sums and row counts from the committed current relation.