Skip to content

Commit 97ce310

Browse files
Source Google Ads: rollback patch 500 Internal Server Error
1 parent 6dbbcb0 commit 97ce310

File tree

10 files changed

+20
-42
lines changed

10 files changed

+20
-42
lines changed

airbyte-integrations/connectors/source-google-ads/integration_tests/expected_records.jsonl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
{"stream": "custom_audience", "data": {"custom_audience.description": "", "custom_audience.name": "Airbyte", "custom_audience.id": 523469909, "custom_audience.members": ["member_type: KEYWORD\nkeyword: \"etl elt\"\n", "member_type: KEYWORD\nkeyword: \"cloud data management and analytics\"\n", "member_type: KEYWORD\nkeyword: \"data integration\"\n", "member_type: KEYWORD\nkeyword: \"big data analytics database\"\n", "member_type: KEYWORD\nkeyword: \"data\"\n", "member_type: KEYWORD\nkeyword: \"data sherid nada\"\n", "member_type: KEYWORD\nkeyword: \"airbyteforeveryone\"\n", "member_type: KEYWORD\nkeyword: \"Airbyte\"\n"], "custom_audience.resource_name": "customers/4651612872/customAudiences/523469909", "custom_audience.status": "ENABLED", "custom_audience.type": "AUTO"}, "emitted_at": 1704407775427}
4747
{"stream": "audience", "data": {"customer.id": 4651612872, "audience.description": "", "audience.dimensions": ["audience_segments {\n segments {\n custom_audience {\n custom_audience: \"customers/4651612872/customAudiences/523469909\"\n }\n }\n}\n"], "audience.exclusion_dimension": "", "audience.id": 47792633, "audience.name": "Audience name 1", "audience.resource_name": "customers/4651612872/audiences/47792633", "audience.status": "ENABLED"}, "emitted_at": 1704407775721}
4848
{"stream": "audience", "data": {"customer.id": 4651612872, "audience.description": "", "audience.dimensions": ["audience_segments {\n segments {\n user_interest {\n user_interest_category: \"customers/4651612872/userInterests/80276\"\n }\n }\n segments {\n user_interest {\n user_interest_category: \"customers/4651612872/userInterests/80279\"\n }\n }\n segments {\n user_interest {\n user_interest_category: \"customers/4651612872/userInterests/80520\"\n }\n }\n segments {\n user_interest {\n user_interest_category: \"customers/4651612872/userInterests/80530\"\n }\n }\n segments {\n user_interest {\n user_interest_category: \"customers/4651612872/userInterests/92931\"\n }\n }\n}\n"], "audience.exclusion_dimension": "", "audience.id": 97300129, "audience.name": "Upgraded Audience 1", "audience.resource_name": "customers/4651612872/audiences/97300129", "audience.status": "ENABLED"}, "emitted_at": 1704407775723}
49-
{"stream": "user_interest", "data": {"user_interest.availabilities": null, "user_interest.launched_to_all": null, "user_interest.name": "Arts & Entertainment", "user_interest.resource_name": "customers/4651612872/userInterests/3", "user_interest.taxonomy_type": "VERTICAL_GEO", "user_interest.user_interest_id": 3, "user_interest.user_interest_parent": ""}, "emitted_at": 1704407777549}
50-
{"stream": "user_interest", "data": {"user_interest.availabilities": null, "user_interest.launched_to_all": null, "user_interest.name": "Computers & Electronics", "user_interest.resource_name": "customers/4651612872/userInterests/5", "user_interest.taxonomy_type": "VERTICAL_GEO", "user_interest.user_interest_id": 5, "user_interest.user_interest_parent": ""}, "emitted_at": 1704407777550}
51-
{"stream": "user_interest", "data": {"user_interest.availabilities": null, "user_interest.launched_to_all": null, "user_interest.name": "Finance", "user_interest.resource_name": "customers/4651612872/userInterests/7", "user_interest.taxonomy_type": "VERTICAL_GEO", "user_interest.user_interest_id": 7, "user_interest.user_interest_parent": ""}, "emitted_at": 1704407777551}
49+
{"stream": "user_interest", "data": {"user_interest.availabilities": [], "user_interest.launched_to_all": true, "user_interest.name": "Arts & Entertainment", "user_interest.resource_name": "customers/4651612872/userInterests/3", "user_interest.taxonomy_type": "VERTICAL_GEO", "user_interest.user_interest_id": 3, "user_interest.user_interest_parent": ""}, "emitted_at": 1704407777549}
50+
{"stream": "user_interest", "data": {"user_interest.availabilities": [], "user_interest.launched_to_all": true, "user_interest.name": "Computers & Electronics", "user_interest.resource_name": "customers/4651612872/userInterests/5", "user_interest.taxonomy_type": "VERTICAL_GEO", "user_interest.user_interest_id": 5, "user_interest.user_interest_parent": ""}, "emitted_at": 1704407777550}
51+
{"stream": "user_interest", "data": {"user_interest.availabilities": [], "user_interest.launched_to_all": true, "user_interest.name": "Finance", "user_interest.resource_name": "customers/4651612872/userInterests/7", "user_interest.taxonomy_type": "VERTICAL_GEO", "user_interest.user_interest_id": 7, "user_interest.user_interest_parent": ""}, "emitted_at": 1704407777551}
5252
{"stream": "label", "data": {"customer.id": 4651612872, "label.id": 21585034471, "label.name": "edgao-example-label", "label.resource_name": "customers/4651612872/labels/21585034471", "label.status": "ENABLED", "label.text_label.background_color": "#E993EB", "label.text_label.description": "example label for edgao"}, "emitted_at": 1704407779851}
5353
{"stream": "label", "data": {"customer.id": 4651612872, "label.id": 21902092838, "label.name": "Test Label", "label.resource_name": "customers/4651612872/labels/21902092838", "label.status": "ENABLED", "label.text_label.background_color": "#8BCBD2", "label.text_label.description": "Description to test label"}, "emitted_at": 1704407779852}
5454
{"stream": "label", "data": {"customer.id": 4651612872, "label.id": 21906377810, "label.name": "Test Delete label customer", "label.resource_name": "customers/4651612872/labels/21906377810", "label.status": "ENABLED", "label.text_label.background_color": "#8266C9", "label.text_label.description": ""}, "emitted_at": 1704407779852}

airbyte-integrations/connectors/source-google-ads/integration_tests/expected_records_click.jsonl

Lines changed: 6 additions & 9 deletions
Large diffs are not rendered by default.

airbyte-integrations/connectors/source-google-ads/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data:
1111
connectorSubtype: api
1212
connectorType: source
1313
definitionId: 253487c0-2246-43ba-a21f-5116b20a2c50
14-
dockerImageTag: 3.3.3
14+
dockerImageTag: 3.3.4
1515
dockerRepository: airbyte/source-google-ads
1616
documentationUrl: https://docs.airbyte.com/integrations/sources/google-ads
1717
githubIssueLabel: source-google-ads

airbyte-integrations/connectors/source-google-ads/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "3.3.2"
6+
version = "3.3.4"
77
name = "source-google-ads"
88
description = "Source implementation for Google Ads."
99
authors = [ "Airbyte <[email protected]>",]

airbyte-integrations/connectors/source-google-ads/source_google_ads/google_ads.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,8 @@ def get_field_value(field_value: GoogleAdsRow, field: str, schema_type: Mapping[
214214
return field_value
215215

216216
@staticmethod
217-
def parse_single_result(schema: Mapping[str, Any], result: GoogleAdsRow, nullable: Optional[List[str]] = None):
218-
if nullable is None:
219-
nullable = []
217+
def parse_single_result(schema: Mapping[str, Any], result: GoogleAdsRow):
220218
props = schema.get("properties")
221219
fields = GoogleAds.get_fields_from_schema(schema)
222-
# Making fields nullable is a temporary try to avoid `500 Internal server error` happen when
223-
# `user_interest.availabilities` and `user_interest.launched_to_all` fields are queried while syncing `user_interest` stream.
224-
# It seems like the values for the fields have changed following the 500 errors and it is unexpected,
225-
# so until we understand the issue with the 500 errors, we will nullify those two fields.
226-
# This should affect only the `user_interest` stream.
227-
# TODO: we need to get rid of the nullable condition once the issue https://github.com/airbytehq/oncall/issues/4306 to be resolved.
228-
single_record = {
229-
field: GoogleAds.get_field_value(result, field, props.get(field)) if field not in nullable else None for field in fields
230-
}
220+
single_record = {field: GoogleAds.get_field_value(result, field, props.get(field)) for field in fields}
231221
return single_record

airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,14 @@ def __init__(self, api: GoogleAds, customers: List[CustomerModel]):
3131
self.customers = customers
3232

3333
def get_query(self, stream_slice: Mapping[str, Any]) -> str:
34-
# The following construction excludes "user_interest.availabilities" and "user_interest.launched_to_all" fields
35-
# from the query because they are a cause of "500 Internal server error" on the google side.
36-
# The oncall issue: https://github.com/airbytehq/oncall/issues/4306
37-
# TODO: replace with fields = GoogleAds.get_fields_from_schema(self.get_json_schema())
38-
fields = [
39-
field
40-
for field in GoogleAds.get_fields_from_schema(self.get_json_schema())
41-
if not (field == "user_interest.availabilities" or field == "user_interest.launched_to_all")
42-
]
34+
fields = GoogleAds.get_fields_from_schema(self.get_json_schema())
4335
table_name = get_resource_name(self.name)
4436
query = GoogleAds.convert_schema_into_query(fields=fields, table_name=table_name)
4537
return query
4638

4739
def parse_response(self, response: SearchPager, stream_slice: Optional[Mapping[str, Any]] = None) -> Iterable[Mapping]:
4840
for result in response:
49-
yield self.google_ads_client.parse_single_result(
50-
self.get_json_schema(), result, nullable=["user_interest.availabilities", "user_interest.launched_to_all"]
51-
)
41+
yield self.google_ads_client.parse_single_result(self.get_json_schema(), result)
5242

5343
def stream_slices(self, stream_state: Mapping[str, Any] = None, **kwargs) -> Iterable[Optional[Mapping[str, any]]]:
5444
for customer in self.customers:

airbyte-integrations/connectors/source-google-ads/unit_tests/test_incremental_events_streams.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def mock_response_child():
5151

5252

5353
class MockGoogleAds(GoogleAds):
54-
def parse_single_result(self, schema, result, nullable = None):
54+
def parse_single_result(self, schema, result):
5555
return result
5656

5757
def send_request(self, query: str, customer_id: str, login_customer_id: str = "default"):
@@ -219,7 +219,7 @@ def mock_response_4():
219219
class MockGoogleAdsLimit(GoogleAds):
220220
count = 0
221221

222-
def parse_single_result(self, schema, result, nullable = None):
222+
def parse_single_result(self, schema, result):
223223
return result
224224

225225
def send_request(self, query: str, customer_id: str, login_customer_id: str = "default"):

airbyte-integrations/connectors/source-google-ads/unit_tests/test_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def test_get_customers(mocker, customer_status_filter, expected_ids, send_reques
507507

508508
mock_google_api.get_accessible_accounts.return_value = ["123", "789"]
509509
mock_google_api.send_request.side_effect = mock_send_request
510-
mock_google_api.parse_single_result.side_effect = lambda schema, result, nullable: result
510+
mock_google_api.parse_single_result.side_effect = lambda schema, result: result
511511

512512
mock_config = {"customer_status_filter": customer_status_filter, "customer_ids": ["123", "456", "789"]}
513513

airbyte-integrations/connectors/source-google-ads/unit_tests/test_streams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def mock_response_2():
4848
class MockGoogleAds(GoogleAds):
4949
count = 0
5050

51-
def parse_single_result(self, schema, result, nullable = None):
51+
def parse_single_result(self, schema, result):
5252
return result
5353

5454
def send_request(self, query: str, customer_id: str, login_customer_id: str = "none"):

docs/integrations/sources/google-ads.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ Due to a limitation in the Google Ads API which does not allow getting performan
280280

281281
| Version | Date | Pull Request | Subject |
282282
|:---------|:-----------|:---------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------|
283+
| `3.3.4` | 2024-02-21 | [35493](https://github.com/airbytehq/airbyte/pull/35493) | Rolling back the patch 3.3.3 made for `user_interest` steam |
283284
| `3.3.3` | 2024-02-14 | [35280](https://github.com/airbytehq/airbyte/pull/35280) | Temporary patch that disables some fields to avoid 500 error when syncing `user_interest` steam |
284285
| `3.3.2` | 2024-02-12 | [35158](https://github.com/airbytehq/airbyte/pull/35158) | Manage dependencies with Poetry. |
285286
| `3.3.1` | 2024-01-16 | [34007](https://github.com/airbytehq/airbyte/pull/34007) | prepare for airbyte-lib |

0 commit comments

Comments
 (0)