Skip to content

Commit 2d033a5

Browse files
committed
estuary-cdk: default tombstone to BaseDocument in open_binding for snapshot bindings
When `fetch_snapshot` is provided but no tombstone is given, `open_binding` now defaults to `BaseDocument(op="d")` instead of requiring callers to supply one. This makes it easier to create snapshot bindings without needing to provide a tombstone explicitly.
1 parent ef9a1e6 commit 2d033a5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

estuary-cdk/estuary_cdk/capture/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,14 @@ async def backfill_closure(
832832
)
833833

834834
if fetch_snapshot:
835+
if tombstone is None:
836+
# Default tombstone for snapshot bindings so callers don't need to
837+
# provide one. The cast satisfies the _BaseDocument TypeVar since
838+
# BaseDocument is its bound.
839+
tombstone = cast(_BaseDocument, BaseDocument(_meta=BaseDocument.Meta(op="d")))
835840

836841
async def closure(task: Task):
837-
assert tombstone
842+
assert tombstone is not None
838843
await _binding_snapshot_task(
839844
binding,
840845
binding_index,

0 commit comments

Comments
 (0)