Skip to content

Commit

Permalink
estuary-cdk: common.ConnectorState is generic
Browse files Browse the repository at this point in the history
Use GenericModel to support v1 pydantic polyfill.
  • Loading branch information
jgraettinger committed Mar 4, 2024
1 parent 84a4a70 commit dcdddd5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions estuary-cdk/estuary_cdk/capture/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Literal,
TypeVar,
)

from pydantic import AwareDatetime, BaseModel, Field, NonNegativeInt

from ..flow import (
Expand All @@ -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:
Expand Down Expand Up @@ -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] = {}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

0 comments on commit dcdddd5

Please sign in to comment.