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 Google Ads: refactor date slicing #27711

Merged

Conversation

davydov-d
Copy link
Collaborator

@davydov-d davydov-d commented Jun 26, 2023

What

https://github.com/airbytehq/oncall/issues/2344

How

  • Refactor code: make it more readable by removing duplicate or unnecessary checks, simplify logic
  • Make start date inclusive

🚨 User Impact 🚨

  • Some data (max. 1 day) may duplicate

@octavia-squidington-iii octavia-squidington-iii added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Jun 26, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2023

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan and you've followed all steps in the Breaking Changes Checklist
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • The connector tests are passing in CI
  • You've updated the connector's metadata.yaml file (new!)
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@davydov-d davydov-d marked this pull request as ready for review June 26, 2023 16:49
@octavia-squidington-iii
Copy link
Collaborator

source-google-ads test report (commit a9b4d5ef91) - ✅

⏲️ Total pipeline duration: 860 seconds

Step Result
Validate airbyte-integrations/connectors/source-google-ads/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-google-ads docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-google-ads test

@octavia-squidington-iii
Copy link
Collaborator

source-google-ads test report (commit a9b4d5ef91) - ✅

⏲️ Total pipeline duration: 932 seconds

Step Result
Validate airbyte-integrations/connectors/source-google-ads/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-google-ads docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-google-ads test

Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

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

a few small suggestions and wanted to clarify something about how we calculate yesterday. onboarding with the clean up of the code!

while slice_start.date() <= end_date.date():
slice_end = min(end_date, slice_start.add(days=range_days - 1))
yield {
"start_date": slice_start.to_date_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

So just to confirm the API behavior, Google's API fetches all records inclusive of the start date passed in and inclusive of the end date passed in? And in the prior code, we took the start date and added 1 day. Thus how we ended up with the > operation on the start date?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, both start date and end date are inclusive. We did not actually end up with >, the problem was with the start date of the initial slice. If the user used to enter 2020-01-01 as a start date, we would generate slices starting from 2020-01-02, that's the whole point. Now having refactored the code, slicing starts with 2020-01-01 as expected

Copy link
Contributor

Choose a reason for hiding this comment

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

perfect, thanks for confirming!

@davydov-d davydov-d requested a review from brianjlai June 27, 2023 06:12
@octavia-squidington-iii
Copy link
Collaborator

source-google-ads test report (commit c08ffad412) - ✅

⏲️ Total pipeline duration: 833 seconds

Step Result
Validate airbyte-integrations/connectors/source-google-ads/metadata.yaml
Connector version semver check
Connector version increment check
QA checks
Code format checks
Connector package install
Build source-google-ads docker image for platform linux/x86_64
Unit tests
Acceptance tests

🔗 View the logs here

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-google-ads test

Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

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

changes lgtm!

while slice_start.date() <= end_date.date():
slice_end = min(end_date, slice_start.add(days=range_days - 1))
yield {
"start_date": slice_start.to_date_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

perfect, thanks for confirming!

@davydov-d davydov-d merged commit a9a98bc into master Jun 29, 2023
23 of 24 checks passed
@davydov-d davydov-d deleted the ddavydov/#2344-source-google-ads-refactor-date-slicing branch June 29, 2023 07:49
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 checklist-action-run connectors/source/google-ads
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants