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

🎉Source Bing Ads: Add Report streams #5750

Merged
merged 20 commits into from
Sep 9, 2021

Conversation

yaroslav-dudar
Copy link
Contributor

@yaroslav-dudar yaroslav-dudar commented Aug 31, 2021

What

added report streams to the connector #5075

How

Describe the solution

Recommended reading order

  1. reports.py
  2. source.py
  3. client.py

Pre-merge Checklist

Expand the relevant checklist and delete the others.

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
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

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

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Aug 31, 2021
@yaroslav-dudar yaroslav-dudar changed the title tadaSource Bing Ads: Add Report streams 🎉Source Bing Ads: Add Report streams Aug 31, 2021
@yaroslav-dudar yaroslav-dudar linked an issue Aug 31, 2021 that may be closed by this pull request
@antixar antixar requested review from lazebnyi and midavadim and removed request for antixar August 31, 2021 08:43
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Aug 31, 2021

/test connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1185486308
✅ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1185486308

@jrhizor jrhizor temporarily deployed to more-secrets August 31, 2021 09:07 Inactive
Copy link
Collaborator

@lazebnyi lazebnyi left a comment

Choose a reason for hiding this comment

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

LGTM

Leave few minor comments.

"default": "2020-01-01",
"description": "From which date perform initial sync for report related streams. In YYYY-MM-DD format"
},
"report_aggregation": {
Copy link
Contributor

Choose a reason for hiding this comment

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

need clarification:

So now user should choose one of the aggregation types,

Did we consider choosing a few types at the same time - hourly and monthly for example.

Do you have any ideas on how it works in other EL tools?

Copy link
Contributor Author

@yaroslav-dudar yaroslav-dudar Sep 2, 2021

Choose a reason for hiding this comment

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

Did we consider choosing a few types at the same time - hourly and monthly for example.
no, I don't consider this. What's the purpose of that ?
Do you have any ideas on how it works in other EL tools?
one tool has hardcoded Daily value, another tool has 2 separate streams for Daily and Hourly aggregation. I think my solution is more flexible

Copy link
Contributor

Choose a reason for hiding this comment

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

Please raise this question on Airbyte review: "Did we consider choosing a few types at the same time - hourly and monthly for example"

Copy link
Contributor

Choose a reason for hiding this comment

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

In my understanding, we should support sync of hourly, daily or another 'agreggations' streams simultaneously.

We may also discuss this question with Maxim before Airbyte review.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can offer flexibility here pretty easily on top of the current code and therefore imo we should.

Options in spec could be boolean toggles for each of hourly, daily, weekly, monthly, where all off could mean no report streams (and possibly help for backwards compat.?)

In SourceBingAds class, we'd then need to run some logic checking which of those toggles are on/off and setting up relevant report streams for each. e.g.
hourly and monthly are toggled on, so we add streams:

  • AccountPerformanceReportHourly
  • AccountPerformanceReportMonthly
  • AdGroupPerformanceReportHourly
  • AdGroupPerformanceReportMonthly
  • and so on and so on for all reports...

This would give the user ultimate flexibility and shouldn't require any major changes to the code, wdyt?

@yaroslav-dudar yaroslav-dudar marked this pull request as ready for review September 3, 2021 16:53
@Phlair
Copy link
Contributor

Phlair commented Sep 6, 2021

Hey @yaroslav-dudar, would you mind adding a bootstrap.md in with this PR please (as described here). Also reading order would be great to help me jump in 👍

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 6, 2021

Hey @yaroslav-dudar, would you mind adding a bootstrap.md in with this PR please (as described here). Also reading order would be great to help me jump in

@Phlair added reading order and bootstrap 66d69d5

Copy link
Contributor

@Phlair Phlair left a comment

Choose a reason for hiding this comment

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

Really like the approach using a Mixin, clean!

Main change request on allowing for multiple report frequencies, seems like low-hanging fruit worth taking to be on par / better than other like-for-like tools.

Other point worth mentioning is on the state-per-account-id comment. I know this stream already implements this so I won't let it block merge but after discussing with Eugene I think we need a solution to avoid the state becoming too large (we can discuss on the comment itself in the code)

Comment on lines +249 to +250
for account in source_bing_ads.source.Accounts(self.client, self.config).read_records(SyncMode.full_refresh):
yield {"account_id": account["Id"]}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming this isn't in any sort of time-order using account_id as the slicing of stream slices but you're saving state for each account ID.

I've discussed this with @keu recently and my main concern with this approach is that we have a potentially boundless state size. Is there a hard limit on the amount of account IDs there can be or could it potentially be millions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there should be strict limit of amount of accounts per user

https://help.ads.microsoft.com/#apex/ads/en/52001/0
2021-09-07_11-57

"default": "2020-01-01",
"description": "From which date perform initial sync for report related streams. In YYYY-MM-DD format"
},
"report_aggregation": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can offer flexibility here pretty easily on top of the current code and therefore imo we should.

Options in spec could be boolean toggles for each of hourly, daily, weekly, monthly, where all off could mean no report streams (and possibly help for backwards compat.?)

In SourceBingAds class, we'd then need to run some logic checking which of those toggles are on/off and setting up relevant report streams for each. e.g.
hourly and monthly are toggled on, so we add streams:

  • AccountPerformanceReportHourly
  • AccountPerformanceReportMonthly
  • AdGroupPerformanceReportHourly
  • AdGroupPerformanceReportMonthly
  • and so on and so on for all reports...

This would give the user ultimate flexibility and shouldn't require any major changes to the code, wdyt?

@Phlair
Copy link
Contributor

Phlair commented Sep 6, 2021

Also, thanks @yaroslav-dudar for the bootstrap and reading order 👍 !!

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 8, 2021

/test connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1212633513
❌ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1212633513

@jrhizor jrhizor temporarily deployed to more-secrets September 8, 2021 08:51 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 8, 2021

/test connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1212719027
❌ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1212719027

@jrhizor jrhizor temporarily deployed to more-secrets September 8, 2021 09:17 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 9, 2021

/test connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1216423865
✅ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1216423865

@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 07:57 Inactive
@yaroslav-dudar
Copy link
Contributor Author

@Phlair also please take a look on these changes e1c17c0 . I suspect that you have more knowledge on gradle configuration

Copy link
Contributor

@Phlair Phlair left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for adding those toggles, offering max flexibility for the user now 👍

It's not ideal bumping down setuptools but I think it should be temporary since there is an open issue and PR to fix that problem in BingAds lib (see my comment)

@@ -7,3 +9,14 @@ plugins {
airbytePython {
moduleDirectory 'source_bing_ads'
}

// setuptools 58.* removed support for use_2to3 which leads to the following issue:
// error in suds-jurko setup command: use_2to3 is invalid.
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like there is an open issue for this on BingAds-Python-SDK repo.

Might be worth adding a link to that with a note to update the bingads lib version and remove this step in gradle once it is resolved

Choose a reason for hiding this comment

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

hey, Phlair. Will this problem be solved by upgrade bing ads version?

Comment on lines +10 to +13
"hourly_reports": true,
"daily_reports": false,
"weekly_reports": false,
"monthly_reports": true
Copy link
Contributor

Choose a reason for hiding this comment

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

best coverage here would be testing all of these, any reason not to? (it doesn't need to block this PR, a separate issue maybe?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's an invalid config, actual config stored in github secrets. I think we can update secret even without an issue

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 9, 2021

/test connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1217872870
✅ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1217872870

@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 15:16 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 9, 2021

/publish connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1217909756
✅ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/1217909756

@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 15:26 Inactive
@yaroslav-dudar yaroslav-dudar merged commit 70513bc into master Sep 9, 2021
@yaroslav-dudar yaroslav-dudar deleted the yaroslav-dudar/5075-bing-ads-reports branch September 9, 2021 16:35
@SPTKL
Copy link
Contributor

SPTKL commented Jul 12, 2022

Hi all! Why are we only supporting a subset of the columns provided by the bing ads api?
e.g. based on the CampaignPerformanceReportColumn, a lot of the columns are omitted. (e.g. Conversions is missing)

https://discuss.airbyte.io/t/bing-ads-missing-a-lot-of-fields-is-this-intentional/1824

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/bing-ads connectors/sources-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Bing Ads Source: Implement Report streams
8 participants