Skip to content

Commit

Permalink
feat(source-linkedin-ads): move custom streams to manifest only (#48863)
Browse files Browse the repository at this point in the history
Co-authored-by: Octavia Squidington III <[email protected]>
Co-authored-by: Alfredo Garcia <[email protected]>
Co-authored-by: Christo Grabowski <[email protected]>
Co-authored-by: Alfredo Garcia <[email protected]>
  • Loading branch information
5 people authored Jan 9, 2025
1 parent c1f28cb commit 5dfb632
Show file tree
Hide file tree
Showing 12 changed files with 1,092 additions and 818 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 137ece28-5434-455c-8f34-69dc3782f451
dockerImageTag: 5.0.0
dockerImageTag: 5.1.0-rc.1
dockerRepository: airbyte/source-linkedin-ads
documentationUrl: https://docs.airbyte.com/integrations/sources/linkedin-ads
githubIssueLabel: source-linkedin-ads
Expand All @@ -30,6 +30,8 @@ data:
enabled: true
releaseStage: generally_available
releases:
rolloutConfiguration:
enableProgressiveRollout: true
breakingChanges:
1.0.0:
message: This upgrade brings changes in primary key to *-analytics streams.
Expand Down
1,359 changes: 707 additions & 652 deletions airbyte-integrations/connectors/source-linkedin-ads/poetry.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "5.0.0"
version = "5.1.0-rc.1"
name = "source-linkedin-ads"
description = "Source implementation for Linkedin Ads."
authors = [ "Airbyte <[email protected]>",]
Expand All @@ -17,7 +17,7 @@ include = "source_linkedin_ads"

[tool.poetry.dependencies]
python = "^3.10,<3.12"
airbyte-cdk = "^5"
airbyte-cdk = { version = "6.12.1.dev0", allow-prereleases = true }
coverage = "^7.5.3"

[tool.poetry.scripts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
import pendulum
import requests
from isodate import Duration, parse_duration
from requests.exceptions import InvalidURL

from airbyte_cdk.models import FailureType
from airbyte_cdk.sources.declarative.extractors.record_extractor import RecordExtractor
from airbyte_cdk.sources.declarative.incremental import CursorFactory, DatetimeBasedCursor, PerPartitionCursor
from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
from airbyte_cdk.sources.declarative.partition_routers import CartesianProductStreamSlicer
from airbyte_cdk.sources.declarative.partition_routers.single_partition_router import SinglePartitionRouter
from airbyte_cdk.sources.declarative.requesters import HttpRequester
from airbyte_cdk.sources.declarative.requesters.error_handlers import DefaultErrorHandler
from airbyte_cdk.sources.declarative.requesters.request_options.interpolated_request_options_provider import (
InterpolatedRequestOptionsProvider,
RequestInput,
Expand All @@ -31,6 +34,7 @@
from airbyte_cdk.sources.declarative.types import Config, Record, StreamSlice, StreamState
from airbyte_cdk.sources.streams.core import StreamData
from airbyte_cdk.sources.streams.http import HttpClient
from airbyte_cdk.sources.streams.http.error_handlers import ErrorResolution, ResponseAction
from airbyte_cdk.sources.streams.http.exceptions import DefaultBackoffException, RequestBodyException, UserDefinedBackoffException
from airbyte_cdk.sources.streams.http.http import BODY_REQUEST_METHODS

Expand Down Expand Up @@ -291,3 +295,24 @@ def _apply_transformations(self):

if transformations:
self.record_selector.transformations = transformations


@dataclass
class LinkedInAdsErrorHandler(DefaultErrorHandler):
"""
An error handler for LinkedIn Ads that interprets responses, providing custom error resolutions
for specific exceptions like `InvalidURL`.
This is a temporary workaround untill we update this in the CDK. https://github.com/airbytehq/airbyte-internal-issues/issues/11320
"""

def interpret_response(self, response_or_exception: Optional[Union[requests.Response, Exception]]) -> ErrorResolution:
"""
Interprets responses and exceptions, providing custom error resolutions for specific exceptions.
"""
if isinstance(response_or_exception, InvalidURL):
return ErrorResolution(
response_action=ResponseAction.RETRY,
failure_type=FailureType.transient_error,
error_message="source-linkedin-ads has faced a temporary DNS resolution issue. Retrying...",
)
return super().interpret_response(response_or_exception)
Loading

0 comments on commit 5dfb632

Please sign in to comment.