diff --git a/airbyte-integrations/connectors/source-zendesk-support/metadata.yaml b/airbyte-integrations/connectors/source-zendesk-support/metadata.yaml index 2b6760b7591b9..7b5b927455793 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/metadata.yaml +++ b/airbyte-integrations/connectors/source-zendesk-support/metadata.yaml @@ -11,7 +11,7 @@ data: connectorSubtype: api connectorType: source definitionId: 79c1aa37-dae3-42ae-b333-d1c105477715 - dockerImageTag: 4.6.0 + dockerImageTag: 4.7.0-rc.1 dockerRepository: airbyte/source-zendesk-support documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-support githubIssueLabel: source-zendesk-support @@ -30,6 +30,8 @@ data: enabled: true releaseStage: generally_available releases: + rolloutConfiguration: + enableProgressiveRollout: true breakingChanges: 1.0.0: message: "`cursor_field` for `Tickets` stream is changed to `generated_timestamp`" diff --git a/airbyte-integrations/connectors/source-zendesk-support/pyproject.toml b/airbyte-integrations/connectors/source-zendesk-support/pyproject.toml index 021d210de4627..e618f08db9163 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/pyproject.toml +++ b/airbyte-integrations/connectors/source-zendesk-support/pyproject.toml @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",] build-backend = "poetry.core.masonry.api" [tool.poetry] -version = "4.6.0" +version = "4.7.0-rc.1" name = "source-zendesk-support" description = "Source implementation for Zendesk Support." authors = [ "Airbyte ",] diff --git a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/components.py b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/components.py index 4d205ed5e83b0..ba77de3bbcd27 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/components.py +++ b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/components.py @@ -1,43 +1,10 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. -from dataclasses import dataclass -from typing import Any, List, Mapping, MutableMapping, Optional +from typing import Any, List, Mapping import requests from airbyte_cdk.sources.declarative.extractors.record_extractor import RecordExtractor -from airbyte_cdk.sources.declarative.incremental import DatetimeBasedCursor -from airbyte_cdk.sources.declarative.requesters.request_option import RequestOptionType -from airbyte_cdk.sources.declarative.types import StreamSlice, StreamState - - -@dataclass -class ZendeskSupportAuditLogsIncrementalSync(DatetimeBasedCursor): - """ - This class is created for the Audit Logs stream. List with time range is used for record filtering. - """ - - def get_request_params( - self, - *, - stream_state: Optional[StreamState] = None, - stream_slice: Optional[StreamSlice] = None, - next_page_token: Optional[Mapping[str, Any]] = None, - ) -> Mapping[str, Any]: - option_type = RequestOptionType.request_parameter - options: MutableMapping[str, Any] = {} - if not stream_slice: - return options - - # set list with time range - if self.start_time_option and self.start_time_option.inject_into == option_type: - start_time = stream_slice.get(self._partition_field_start.eval(self.config)) - options[self.start_time_option.field_name.eval(config=self.config)] = [start_time] # type: ignore # field_name is always casted to an interpolated string - if self.end_time_option and self.end_time_option.inject_into == option_type: - options[self.end_time_option.field_name.eval(config=self.config)].append( - stream_slice.get(self._partition_field_end.eval(self.config)) - ) # type: ignore # field_name is always casted to an interpolated string - return options class ZendeskSupportExtractorEvents(RecordExtractor): 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 c75cb316cded7..16d2c1755f6a0 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 @@ -241,12 +241,12 @@ definitions: requester: $ref: "#/definitions/retriever/requester" request_parameters: + filter[created_at][]: "{{ [ stream_interval['start_time'], stream_interval['end_time'] ] if next_page_token is none else '' }}" sort: "created_at" paginator: $ref: "#/definitions/links_next_paginator" incremental_sync: - class_name: source_zendesk_support.components.ZendeskSupportAuditLogsIncrementalSync - type: CustomIncrementalSync + type: DatetimeBasedCursor cursor_datetime_formats: - "%Y-%m-%dT%H:%M:%SZ" - "%Y-%m-%dT%H:%M:%S%z" @@ -254,14 +254,6 @@ definitions: cursor_field: "{{ parameters.get('cursor_field', 'updated_at') }}" start_datetime: datetime: "{{ config.get('start_date') or day_delta(-3650, '%Y-%m-%dT%H:%M:%SZ') }}" - start_time_option: - inject_into: request_parameter - field_name: "filter[created_at][]" - type: RequestOption - end_time_option: - inject_into: request_parameter - field_name: "filter[created_at][]" - type: RequestOption $parameters: name: "audit_logs" path: "audit_logs" diff --git a/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_backoff_on_rate_limit.py b/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_backoff_on_rate_limit.py index adef1134aadb9..79b31637157cd 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_backoff_on_rate_limit.py +++ b/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_backoff_on_rate_limit.py @@ -3,7 +3,7 @@ # -from typing import Dict, Optional +from typing import Dict import pytest import requests diff --git a/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_components.py b/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_components.py index c0b61a2d29f4d..b929f0a694d00 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_components.py +++ b/airbyte-integrations/connectors/source-zendesk-support/unit_tests/test_components.py @@ -6,53 +6,9 @@ import requests from source_zendesk_support.components import ( ZendeskSupportAttributeDefinitionsExtractor, - ZendeskSupportAuditLogsIncrementalSync, ZendeskSupportExtractorEvents, ) -from airbyte_cdk.sources.declarative.requesters.request_option import RequestOptionType - - -@pytest.mark.parametrize( - "stream_state, stream_slice, next_page_token, expected_params", - [ - ( - {}, - {"start_time": "2022-01-01T00:00:00Z", "end_time": "2022-01-02T00:00:00Z"}, - {}, - {"start_time_field": ["2022-01-01T00:00:00Z", "2022-01-02T00:00:00Z"]}, - ), - ({}, {}, {}, {}), - ], -) -def test_audit_logs_incremental_sync(mocker, stream_state, stream_slice, next_page_token, expected_params): - # Instantiate the incremental sync class - sync = ZendeskSupportAuditLogsIncrementalSync("2021-06-01T00:00:00Z", "updated_at", "%Y-%m-%dT%H:%M:%SZ", {}, {}) - - # Setup mock for start_time_option.field_name.eval - mock_field_name = mocker.MagicMock() - mock_field_name.eval.return_value = "start_time_field" - - mock_start_time_option = mocker.MagicMock() - mock_start_time_option.field_name = mock_field_name - mock_start_time_option.inject_into = RequestOptionType.request_parameter - - # Setting up the injected options - sync.start_time_option = mock_start_time_option - sync.end_time_option = mock_start_time_option # Assuming same field_name for simplicity - - # Patch eval methods to return appropriate field keys - sync._partition_field_start = mocker.MagicMock() - sync._partition_field_start.eval.return_value = "start_time" - sync._partition_field_end = mocker.MagicMock() - sync._partition_field_end.eval.return_value = "end_time" - - # Get the request parameters - params = sync.get_request_params(stream_state=stream_state, stream_slice=stream_slice, next_page_token=next_page_token) - - # Assert that params match the expected output - assert params == expected_params, f"Expected params {expected_params}, but got {params}" - @pytest.mark.parametrize( "response_data, expected_events", diff --git a/docs/integrations/sources/zendesk-support.md b/docs/integrations/sources/zendesk-support.md index 5e59bb5fb4318..18950a0750985 100644 --- a/docs/integrations/sources/zendesk-support.md +++ b/docs/integrations/sources/zendesk-support.md @@ -189,8 +189,9 @@ The Zendesk connector ideally should not run into Zendesk API limitations under | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 4.6.0 | 2024-12-09 | [47939](https://github.com/airbytehq/airbyte/pull/47939) | Add `User Identities` stream | -| 4.5.0 | 2024-12-02 | [48761](https://github.com/airbytehq/airbyte/pull/48761) | Add `Categories` and `Sections` stream | +| 4.7.0-rc.1 | 2025-02-13 | [53620](https://github.com/airbytehq/airbyte/pull/53620) | Replace ZendeskSupportAuditLogsIncrementalSync with low-code DatetimeBasedCursor | +| 4.6.0 | 2024-12-09 | [47939](https://github.com/airbytehq/airbyte/pull/47939) | Add `User Identities` stream | +| 4.5.0 | 2024-12-02 | [48761](https://github.com/airbytehq/airbyte/pull/48761) | Add `Categories` and `Sections` stream | | 4.4.4 | 2025-02-08 | [51943](https://github.com/airbytehq/airbyte/pull/51943) | Update dependencies | | 4.4.3 | 2025-02-03 | [52625](https://github.com/airbytehq/airbyte/pull/52625) | Update error message during check for `organization_access_enabled` | | 4.4.2 | 2025-01-11 | [48309](https://github.com/airbytehq/airbyte/pull/48309) | Starting with this version, the Docker image is now rootless. Please note that this and future versions will not be compatible with Airbyte versions earlier than 0.64 |