Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google ads added fields and reports #9310

Merged
merged 10 commits into from
Apr 19, 2022
Merged

Google ads added fields and reports #9310

merged 10 commits into from
Apr 19, 2022

Conversation

schlattk
Copy link
Contributor

@schlattk schlattk commented Jan 5, 2022

What

Add fields to several streams and update existing streams

How

Describe the solution

Recommended reading order

  1. x.java
  2. y.python

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.


This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented Jan 5, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the area/connectors Connector related issues label Jan 5, 2022
working locally

missing fields in click view and keyqord_view

add date to campaigns

add fields to click_view

test
@marcosmarxm
Copy link
Member

Thanks for the contribution @schlattk I request for the team to review it during the week.

@marcosmarxm marcosmarxm self-assigned this Jan 6, 2022
@VasylLazebnyk VasylLazebnyk requested review from augan-rymkhan and removed request for htrueman, Zirochkaa and yevhenii-ldv January 12, 2022 13:09
@@ -0,0 +1,16 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configured streams provided in json files should not be placed in the root of the connector.
I see they are not used in the code. So, you can put them under secrets/ directory which is in gitignore.

source-google-ads/test_catalog_ad_group_ad_report.json
source-google-ads/ test_catalog_campaigns.json
source-google-ads/test_catalog_click_view.json
source-google-ads/test_catalog_click_view.json
source-google-ads/test_catalog_display_keyword_performance_report.json
source-google-ads/test_catalog_keyword_view.json

@@ -23,6 +23,7 @@
"shopping_performance_report": "shopping_performance_view",
"user_location_report": "user_location_view",
"click_view": "click_view",
"keyword_view": "keyword_view"
Copy link
Contributor

@@ -129,7 +129,7 @@ class Accounts(GoogleAdsStream):
primary_key = "customer.id"


class Campaigns(GoogleAdsStream):
class Campaigns(IncrementalGoogleAdsStream):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configured stream "campaigns" should be updated in configured_catalog.json, need to add incremental mode and set sync_mode to it, as below:

 {
      "stream": {
        "name": "campaigns",
        "json_schema": {},
        "supported_sync_modes": ["full_refresh", "incremental"],
        "source_defined_primary_key": [["campaign.id"]],
        "source_defined_cursor": true,
        "default_cursor_field": ["segments.date"]
      },
      "sync_mode": "incremental",
      "destination_sync_mode": "overwrite",
      "cursor_field": ["segments.date"]
    }

@marcosmarxm
Copy link
Member

@schlattk did you have time to look the comments made by @augan-rymkhan ?

@schlattk
Copy link
Contributor Author

schlattk commented Feb 4, 2022

@schlattk did you have time to look the comments made by @augan-rymkhan ?

yes sorry for the delay @marcosmarxm @augan-rymkhan

@schlattk
Copy link
Contributor Author

@augan-rymkhan could you have another look?

@@ -248,6 +247,9 @@
},
"segments.year": {
"type": ["null", "integer"]
},
"segments.date": {
"type": ["null", "integer"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schlattk Why segments.date type is changed from "string" to "integer" and removed "format": "date" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@augan-rymkhan ok thanks if you could have another look

@@ -24,8 +24,12 @@
ClickView,
DisplayKeywordPerformanceReport,
DisplayTopicsPerformanceReport,
<<<<<<< HEAD
KeywordView,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schlattk stream KeywordView is not defined anywhere. You should remove all the references to KeywordView (resolving merge conflicts also), because this stream is implemented as KeywordReport.

"type": ["null", "number"]
},
"segments.date": {
"type": ["null", "string"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add "format": "date" here

Campaigns(**incremental_stream_config),
ClickView(**incremental_stream_config),
<<<<<<< HEAD
KeywordView(**incremental_stream_config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need in KeywordView.

@augan-rymkhan
Copy link
Contributor

augan-rymkhan commented Feb 25, 2022

/test connector=connectors/source-google-ads

Error: No ref found for: google-ads-add-fields

@schlattk
Copy link
Contributor Author

@augan-rymkhan I removed this new conflict

@augan-rymkhan
Copy link
Contributor

augan-rymkhan commented Feb 25, 2022

@schlattk
I have run SAT tests locally in your branch. There are 2 tests failed. Could you test it yourself on your local machine by the following steps:

pip install .[tests]
docker build . -t airbyte/source-google-ads:dev
python -m pytest integration_tests -p integration_tests.acceptance

It seems some added fields are not supported metrics.

E docker.errors.ContainerError: Command 'read --config tap_config.json --catalog catalog.json' in image '<Image:

<_InactiveRpcError of RPC that terminated with:\n\tstatus = StatusCode.INVALID_ARGUMENT\n\tdetails = "Request contains an invalid argument."\n\tdebug_error_string = "{"created":"@1645780794.933768829","description":"Error received from peer ipv4:216.58.207.202:443","file":"src/core/lib/surface/call.cc","file_line":903,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"\n>, errors {\n error_code {\n query_error: PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE\n }\n message: "Cannot select the following segments because at least one unsupported metric is found in SELECT or WHERE clause: \'segments.ad_network_type\'(unsupported metrics: \'historical_quality_score\')."\n}\nrequest_id: "REm0DyAHjwK4YuSl6iScIA"\n, 'REm0DyAHjwK4YuSl6iScIA')"}}

@schlattk
Copy link
Contributor Author

@augan-rymkhan these tests run forever on my connection but could be an incorrect type on segments.ad_network_type
I corrected it to string from integer

@augan-rymkhan
Copy link
Contributor

@schlattk Ok, but this does not fix that errors: message: "Cannot select the following segments because at least one unsupported metric is found in SELECT or WHERE clause:

@schlattk
Copy link
Contributor Author

@augan-rymkhan it appears to be this ? (unsupported metrics: \'historical_quality_score\')
However this metric is not part of this PR
Although it is supported according to docs
https://developers.google.com/google-ads/api/fields/v8/keyword_view

"ad_group_criterion.criterion_id": {
"type": ["null", "integer"]
},
"segments.ad_network_type": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schlattk Error happens because this field was added.

message: "Cannot select the following segments because at least one unsupported metric is found in SELECT or WHERE clause: \'segments.ad_network_type\'(unsupported metrics: \'historical_quality_score\')."\n}\nrequest_id: "hBx3G90_bSZ-rVpnBMQlxQ"\n, 'hBx3G90_bSZ-rVpnBMQlxQ')"}}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works when read command is run without this field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@augan-rymkhan ok but it is a supported field according to documentation and also it has been running live for a long time without any errors. What do you suggest is the solution?

Copy link
Contributor

@augan-rymkhan augan-rymkhan Feb 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schlattk It seems we can not query metrics.historical_quality_score and segments.ad_network_type together in keyword_report stream.

In docs:
A segment in the SELECT clause is incompatible with a metric in the SELECT or WHERE clause.
For more you can read PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes @augan-rymkhan that appears to be the problem. Ok, I removed the field I think we can most probably do without it in this report.

@@ -5,6 +5,9 @@
"ad_group_ad.ad.legacy_responsive_display_ad.accent_color": {
"type": ["null", "string"]
},
"ad_group.id": {
"type": ["null", "string"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schlattk type must be "integer", not "string".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@augan-rymkhan let me know if any further changes are needed

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @schlattk

@marcosmarxm marcosmarxm merged commit f8011f7 into airbytehq:master Apr 19, 2022
suhomud pushed a commit that referenced this pull request May 23, 2022
* combine all

working locally

missing fields in click view and keyqord_view

add date to campaigns

add fields to click_view

test

* configured_catalog campaigns

* rem keywordview

* conflicts

* string type

* remove network type

* change ad group id to integer

Co-authored-by: Konrad <konrad@PB-Mac8.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants