Skip to content

Commit

Permalink
source-google-ads: fixing config transformations
Browse files Browse the repository at this point in the history
google ads transformations were breaking due to something re-using the same
variables from a earlier step. This made the config transformation step to break.

Also, custom queries were not working due to the lack of primary keys in the validation step. I've added
a dud primary key, which will be replaced by the actual primary key input in newer version, in order to allow for
already created streams to work
  • Loading branch information
Luishfs committed Oct 3, 2024
1 parent f3fea97 commit a230680
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions source-google-ads/source_google_ads/custom_query_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def primary_key(self) -> str:
It will be ignored if provided.
If you need to enable it, uncomment the next line instead of `return None` and modify your config
"""
# return self.config.get("primary_key") or None
return None
# TODO luis: Thats a quick hack to pass validation step with already created custom queries, will be removed along
# with the new custom query creation
return ["segments.date"]

@property
def name(self):
Expand Down
3 changes: 2 additions & 1 deletion source-google-ads/source_google_ads/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def _validate_and_transform(config: Mapping[str, Any]):
config.pop("end_date")
for query in config.get("custom_queries", []):
try:
query["query"] = GAQL.parse(query["query"])
if type(query["query"]) == str:
query["query"] = GAQL.parse(query["query"])
except ValueError:
message = f"The custom GAQL query {query['table_name']} failed. Validate your GAQL query with the Google Ads query validator. https://developers.google.com/google-ads/api/fields/v17/query_validator"
raise AirbyteTracedException(message=message, failure_type=FailureType.config_error)
Expand Down

0 comments on commit a230680

Please sign in to comment.