Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ COPY source_linkedin_ads ./source_linkedin_ads
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.6.2
LABEL io.airbyte.version=0.6.3
LABEL io.airbyte.name=airbyte/source-linkedin-ads
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data:
connectorType: source
definitionId: 137ece28-5434-455c-8f34-69dc3782f451
maxSecondsBetweenMessages: 86400
dockerImageTag: 0.6.2
dockerImageTag: 0.6.3
dockerRepository: airbyte/source-linkedin-ads
githubIssueLabel: source-linkedin-ads
icon: linkedin.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ class LinkedInAdsAnalyticsStream(IncrementalLinkedinAdsStream, ABC):
# For Analytics streams the primary_key is the entity of the pivot [Campaign URN, Creative URN, etc] + `end_date`
primary_key = ["pivotValue", "end_date"]
cursor_field = "end_date"
records_limit = 15000

def get_json_schema(self) -> Mapping[str, Any]:
return ResourceSchemaLoader(package_name_from_class(self.__class__)).get_schema("ad_analytics")
Expand Down Expand Up @@ -440,6 +441,20 @@ def request_params(
params[self.search_param] = f"List(urn%3Ali%3A{self.search_param_value}%3A{self.get_primary_key_from_slice(stream_slice)})"
return urlencode(params, safe="():,%")

def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
"""
Pagination is not supported
(See Restrictions: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting?view=li-lms-2023-09&tabs=http#restrictions)
"""
parsed_response = response.json()
if len(parsed_response.get("elements")) < self.records_limit:
return None
raise Exception(
f"Limit {self.records_limit} elements exceeded. "
f"Try to request your data in more granular pieces. "
f"(For example switch `Time Granularity` from MONTHLY to DAILY)"
)

def get_primary_key_from_slice(self, stream_slice) -> str:
return stream_slice.get(self.primary_slice_key)

Expand Down
3 changes: 2 additions & 1 deletion docs/integrations/sources/linkedin-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ After 5 unsuccessful attempts - the connector will stop the sync operation. In s

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|
| 0.6.2 | 2023-08-23 | [29600](https://github.com/airbytehq/airbyte/pull/31221) | Increase max time between messages to 24 hours |
| 0.6.3 | 2023-10-13 | [31396](https://github.com/airbytehq/airbyte/pull/31396) | Fix pagination for reporting |
| 0.6.2 | 2023-08-23 | [31221](https://github.com/airbytehq/airbyte/pull/31221) | Increase max time between messages to 24 hours |
| 0.6.1 | 2023-08-23 | [29600](https://github.com/airbytehq/airbyte/pull/29600) | Update field descriptions |
| 0.6.0 | 2023-08-22 | [29721](https://github.com/airbytehq/airbyte/pull/29721) | Add `Conversions` stream |
| 0.5.0 | 2023-08-14 | [29175](https://github.com/airbytehq/airbyte/pull/29175) | Add Custom report Constructor |
Expand Down