You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cdk): Add cursor age validation to StateDelegatingStream
This adds an optional api_retention_period field to StateDelegatingStream
that validates whether a cursor is within an API's data retention window
before switching from full refresh to incremental sync.
When the cursor value is older than the retention period, the connector
automatically falls back to a full refresh to avoid data loss. This is
useful for APIs like Stripe Events API which only retain data for 30 days.
Key changes:
- Add api_retention_period field to StateDelegatingStream schema (ISO8601 duration)
- Implement cursor age validation in model_to_component_factory.py
- Emit warning log when falling back to full refresh due to stale cursor
- Add unit tests for cursor age validation
Fixes: airbytehq/oncall#11103
Co-Authored-By: unknown <>
Copy file name to clipboardExpand all lines: airbyte_cdk/sources/declarative/declarative_component_schema.yaml
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3752,6 +3752,22 @@ definitions:
3752
3752
title: Incremental Stream
3753
3753
description: Component used to coordinate how records are extracted across stream slices and request pages when the state provided.
3754
3754
"$ref": "#/definitions/DeclarativeStream"
3755
+
api_retention_period:
3756
+
title: API Retention Period
3757
+
description: |
3758
+
The data retention period of the incremental API (ISO8601 duration). If the cursor value is older than this retention period, the connector will automatically fall back to a full refresh to avoid data loss.
3759
+
This is useful for APIs like Stripe Events API which only retain data for 30 days.
description="OAuth specific blob. This is a Json Schema used to validate Json configurations used as input to OAuth.\nMust be a valid non-nested JSON that refers to properties from ConnectorSpecification.connectionSpecification\nusing special annotation 'path_in_connector_config'.\nThese are input values the user is entering through the UI to authenticate to the connector, that might also shared\nas inputs for syncing data via the connector.\nExamples:\nif no connector values is shared during oauth flow, oauth_user_input_from_connector_config_specification=[]\nif connector values such as 'app_id' inside the top level are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['app_id']\n }\n }\nif connector values such as 'info.app_id' nested inside another object are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['info', 'app_id']\n }\n }",
description="OAuth specific blob. This is a Json Schema used to validate Json configurations used as input to OAuth.\nMust be a valid non-nested JSON that refers to properties from ConnectorSpecification.connectionSpecification\nusing special annotation 'path_in_connector_config'.\nThese are input values the user is entering through the UI to authenticate to the connector, that might also shared\nas inputs for syncing data via the connector.\nExamples:\nif no connector values is shared during oauth flow, oauth_user_input_from_connector_config_specification=[]\nif connector values such as 'app_id' inside the top level are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['app_id']\n }\n }\nif connector values such as 'info.app_id' nested inside another object are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['info', 'app_id']\n }\n }",
description="OAuth specific blob. This is a Json Schema used to validate Json configurations persisted as Airbyte Server configurations.\nMust be a valid non-nested JSON describing additional fields configured by the Airbyte Instance or Workspace Admins to be used by the\nserver when completing an OAuth flow (typically exchanging an auth code for refresh token).\nExamples:\n complete_oauth_server_input_specification={\n client_id: {\n type: string\n },\n client_secret: {\n type: string\n }\n }",
@@ -1469,7 +1473,9 @@ class CustomConfigTransformation(BaseModel):
1469
1473
class_name: str=Field(
1470
1474
...,
1471
1475
description="Fully-qualified name of the class that will be implementing the custom config transformation. The format is `source_<name>.<package>.<class_name>`.",
@@ -2691,18 +2709,20 @@ class HttpRequester(BaseModelWithDeprecations):
2691
2709
description="For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.",
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2885,6 +2907,12 @@ class StateDelegatingStream(BaseModel):
2885
2907
description="Component used to coordinate how records are extracted across stream slices and request pages when the state provided.",
2886
2908
title="Incremental Stream",
2887
2909
)
2910
+
api_retention_period: Optional[str] =Field(
2911
+
None,
2912
+
description="The data retention period of the incremental API (ISO8601 duration). If the cursor value is older than this retention period, the connector will automatically fall back to a full refresh to avoid data loss.\nThis is useful for APIs like Stripe Events API which only retain data for 30 days.\n * **PT1H**: 1 hour\n * **P1D**: 1 day\n * **P1W**: 1 week\n * **P1M**: 1 month\n * **P1Y**: 1 year\n * **P30D**: 30 days\n",
0 commit comments