From bbdd127a57a51e4643048f580cb446106f294fd3 Mon Sep 17 00:00:00 2001 From: Johnny Graettinger Date: Mon, 4 Mar 2024 20:05:59 +0000 Subject: [PATCH] estuary-cdk: common.ConnectorState is generic Use GenericModel to support v1 pydantic polyfill. --- estuary-cdk/estuary_cdk/capture/common.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/estuary-cdk/estuary_cdk/capture/common.py b/estuary-cdk/estuary_cdk/capture/common.py index 9407087530..d4b410b70f 100644 --- a/estuary-cdk/estuary_cdk/capture/common.py +++ b/estuary-cdk/estuary_cdk/capture/common.py @@ -14,7 +14,6 @@ Literal, TypeVar, ) - from pydantic import AwareDatetime, BaseModel, Field, NonNegativeInt from ..flow import ( @@ -24,8 +23,10 @@ OAuth2Spec, ValidationError, ) +from ..pydantic_polyfill import GenericModel from . import Task, request, response + LogCursor = AwareDatetime | NonNegativeInt """LogCursor is a cursor into a logical log of changes. The two predominant strategies for accessing logs are: @@ -161,7 +162,7 @@ class Snapshot(BaseModel, extra="forbid"): _ResourceState = TypeVar("_ResourceState", bound=ResourceState) -class ConnectorState(BaseModel, Generic[_BaseResourceState], extra="forbid"): +class ConnectorState(GenericModel, Generic[_BaseResourceState], extra="forbid"): """ConnectorState represents a number of ResourceStates, keyed by binding state key.""" bindingStateV1: dict[str, _BaseResourceState] = {} @@ -268,7 +269,7 @@ def discovered( if isinstance(resource.model, Resource.FixedSchema): schema = resource.model.value else: - schema = resource.model.model_json_schema(mode='serialization') + schema = resource.model.model_json_schema(mode="serialization") if resource.schema_inference: schema["x-infer-schema"] = True @@ -599,9 +600,7 @@ async def _binding_incremental_task( timeout=binding.resourceConfig.interval.total_seconds(), ) - task.log.debug( - f"incremental replication is idle and is yielding to stop" - ) + task.log.debug(f"incremental replication is idle and is yielding to stop") return except asyncio.TimeoutError: pass # `interval` elapsed.