Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

estuary-cdk: common.ConnectorState is generic #1309

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading