1
0
mirror of synced 2026-01-11 21:03:37 -05:00
Files
airbyte/airbyte-integrations/bases/base-python/base_python/catalog_helpers.py
2021-09-27 10:45:50 -07:00

23 lines
712 B
Python

#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from airbyte_protocol import AirbyteCatalog, SyncMode
class CatalogHelper:
@staticmethod
def coerce_catalog_as_full_refresh(catalog: AirbyteCatalog) -> AirbyteCatalog:
"""
Updates the sync mode on all streams in this catalog to be full refresh
"""
coerced_catalog = catalog.copy()
for stream in catalog.streams:
stream.source_defined_cursor = False
stream.supported_sync_modes = [SyncMode.full_refresh]
stream.default_cursor_field = None
# remove nulls
return AirbyteCatalog.parse_raw(coerced_catalog.json(exclude_unset=True, exclude_none=True))