diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/abnormal_state.json b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/abnormal_state.json new file mode 100644 index 000000000000..52b0f2c2118f --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/abnormal_state.json @@ -0,0 +1,5 @@ +{ + "todo-stream-name": { + "todo-field-name": "todo-abnormal-value" + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-support/integration_tests/abnormal_state.json b/airbyte-integrations/connectors/source-zendesk-support/integration_tests/abnormal_state.json deleted file mode 100644 index 5917f69152f7..000000000000 --- a/airbyte-integrations/connectors/source-zendesk-support/integration_tests/abnormal_state.json +++ /dev/null @@ -1,198 +0,0 @@ -[ - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:37Z" }, - "stream_descriptor": { "name": "users" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-15T22:19:01Z" }, - "stream_descriptor": { "name": "groups" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-15T19:29:14Z" }, - "stream_descriptor": { "name": "organizations" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-20T10:05:18Z" }, - "stream_descriptor": { "name": "satisfaction_ratings" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "generated_timestamp": 7969616486 }, - "stream_descriptor": { "name": "tickets" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-04-23T15:34:20Z" }, - "stream_descriptor": { "name": "group_memberships" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-12-11T19:34:05Z" }, - "stream_descriptor": { "name": "ticket_fields" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-12-11T20:34:37Z" }, - "stream_descriptor": { "name": "ticket_forms" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "_ab_updated_at": 7969616486 }, - "stream_descriptor": { "name": "ticket_metrics" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "time": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "ticket_metric_events" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-12-11T19:34:06Z" }, - "stream_descriptor": { "name": "macros" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "created_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "ticket_comments" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "created_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "ticket_audits" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "created_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "audit_logs" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-12-11T19:34:06Z" }, - "stream_descriptor": { "name": "posts" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-12-11T19:34:06Z" }, - "stream_descriptor": { "name": "topics" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "organization_memberships" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "ticket_skips" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "custom_roles" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "schedules" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "sla_policies" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "post_votes" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "post_comments" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "post_comment_votes" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "articles" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "article_votes" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "article_comments" } - } - }, - { - "type": "STREAM", - "stream": { - "stream_state": { "updated_at": "2222-07-19T22:21:26Z" }, - "stream_descriptor": { "name": "article_comment_votes" } - } - } -] diff --git a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/manifest.yaml b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/manifest.yaml index c60444637bcb..3ccd21ca7799 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/manifest.yaml +++ b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/manifest.yaml @@ -87,7 +87,7 @@ definitions: datetime_format: "%Y-%m-%dT%H:%M:%SZ" cursor_field: "{{ parameters.get('cursor_field', 'updated_at') }}" start_datetime: - datetime: "{{ config.get('start_date') }}" + datetime: "{{ config.get('start_date') or day_delta(-730, '%Y-%m-%dT%H:%M:%SZ') }}" cursor_incremental_sync: type: DatetimeBasedCursor @@ -98,7 +98,7 @@ definitions: datetime_format: "%s" cursor_field: "{{ parameters.get('cursor_field', 'updated_at') }}" start_datetime: - datetime: "{{ timestamp(config.get('start_date')) | int or day_delta(-730, '%Y-%m-%dT%H:%M:%SZ') }}" + datetime: "{{ timestamp(config.get('start_date')) | int if config.get('start_date') else day_delta(-730, '%s') }}" start_time_option: inject_into: request_parameter field_name: "{{ parameters['cursor_filter'] }}" diff --git a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/source.py b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/source.py index 3c551a039c4e..5ca18a285112 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/source.py +++ b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/source.py @@ -44,11 +44,7 @@ def __init__(self, email: str, password: str): class SourceZendeskSupport(YamlDeclarativeSource): def __init__(self, catalog: Optional[ConfiguredAirbyteCatalog], config: Optional[Mapping[str, Any]], state: TState, **kwargs): - # Before 2024-11-11, the config was being modified in `streams`. We can't do that anymore because `ConcurrentDeclarativeSource` use - # the config to make concurrent components. Hence, the "main" config needs to be the declarative one and if Python sources need - # something a bit different, it needs to deduce it from the declarative config - declarative_config = SourceZendeskSupport.convert_config_to_declarative_stream_args(config) if config else None - super().__init__(catalog=catalog, config=declarative_config, state=state, **{"path_to_yaml": "manifest.yaml"}) + super().__init__(catalog=catalog, config=config, state=state, **{"path_to_yaml": "manifest.yaml"}) @classmethod def get_default_start_date(cls) -> str: @@ -112,18 +108,6 @@ def convert_config2stream_args(cls, config: Mapping[str, Any]) -> Mapping[str, A "ignore_pagination": config.get("ignore_pagination", False), } - @classmethod - def convert_config_to_declarative_stream_args(cls, config: Mapping[str, Any]) -> Mapping[str, Any]: - """ - Sets defaults to `start_date` and `ignore_pagination`. - """ - return { - "subdomain": config["subdomain"], - "start_date": config.get("start_date", cls.get_default_start_date()), - "credentials": config.get("credentials"), - "ignore_pagination": config.get("ignore_pagination", False), - } - def get_nested_streams(self, config: Mapping[str, Any]) -> List[Stream]: """Returns relevant a list of available streams :param config: A Mapping of the user input configuration as defined in the connector spec.