Skip to content

Source Facebook Marketing: Add lookback window to insights streams - #12402

Merged
Augustin (alafanechere) merged 26 commits into
airbytehq:masterfrom
vladimir-remar:source-facebook-marketing-add-insights-lookback-window
May 31, 2022
Merged

Source Facebook Marketing: Add lookback window to insights streams#12402
Augustin (alafanechere) merged 26 commits into
airbytehq:masterfrom
vladimir-remar:source-facebook-marketing-add-insights-lookback-window

Conversation

@vladimir-remar

Copy link
Copy Markdown
Contributor

What

Bring back the possibility to set up an attribution window.
Let say the users will not use all the data retrieve from the insight stream and just use part of it (e.g., spend) in some cases
set a looback_window short than 28 days would help the users by reducing the sync time.

How

Set value for insights_lookback_window throught config.

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.

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
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@vladimir-remar

Copy link
Copy Markdown
Contributor Author

Sherif A. Nada (@sherifnada) I made this Draft related to #9805

@vladimir-remar Vladimir remar (vladimir-remar) changed the title Add lookback window to insgiths streams Source Facebook Marketing: Add lookback window to insgiths streams Apr 28, 2022
@marcosmarxm

Copy link
Copy Markdown
Contributor

Vladimir remar (@vladimir-remar) this is ready to review?

@marcosmarxm

Copy link
Copy Markdown
Contributor

Serhii Lazebnyi (@lazebnyi) can you check the implementation Vladimir remar (@vladimir-remar) is doing for Facebook Marketing?

),
)

insights_lookback_window: Optional[PositiveInt] = Field(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should make this default_insights_lookback_window and apply it only to the default insights synced by this connector, and separately we should allow configuring this on a per-insight level in the custom insights

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for your patience I will work on this ASAP.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey Vladimir remar (@vladimir-remar) I'm not sure you ended up implementing Sherif A. Nada (@sherifnada) suggestion. Is anything blocking you from going in the suggested direction?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hello Augustin (@alafanechere), maybe I'm wrong, I just replicate the same approach in the custom insight part.

insights_lookback_window: Optional[PositiveInt] = Field(

@CLAassistant

CLAassistant commented May 5, 2022

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@vladimir-remar
Vladimir remar (vladimir-remar) marked this pull request as ready for review May 10, 2022 11:56
),
)

insights_lookback_window: Optional[PositiveInt] = Field(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey Vladimir remar (@vladimir-remar) I'm not sure you ended up implementing Sherif A. Nada (@sherifnada) suggestion. Is anything blocking you from going in the suggested direction?

@alafanechere Augustin (alafanechere) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Vladimir remar (@vladimir-remar) I think you're right, Sherif A. Nada (@sherifnada)'s concern is addressed, 👍 I'm requesting change as I think you need to update unit tests to cover your changes. This connector is in General Availability, meaning we are quite strict in terms of coverage. Could you please bump the connector version in the Dockerfile and update the changelog in facebook-marketing.md?

@alafanechere

Copy link
Copy Markdown
Contributor

I would also need an additional review from Sherif A. Nada (@sherifnada) or Serhii Lazebnyi (@lazebnyi) 🙏

@alafanechere

Augustin (alafanechere) commented May 18, 2022

Copy link
Copy Markdown
Contributor

/test connector=connectors/source-facebook-marketing

🕑 connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2346152756
❌ connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2346152756
🐛 https://gradle.com/s/gghga2qcl74iw

@github-actions github-actions Bot added the area/documentation Improvements or additions to documentation label May 19, 2022
@lazebnyi

Copy link
Copy Markdown
Contributor

Augustin (@alafanechere) I think Serhii Chvaliuk (@grubberr) can help with review. Already discussed with him about that. He working now on FB marketing.

Comment thread docs/integrations/sources/facebook-marketing.md Outdated
@grubberr

Copy link
Copy Markdown
Contributor

Vladimir remar (@vladimir-remar) please also fix unit_tests

pytest unit_tests


Results (1.28s):
      82 passed
      16 failed

@grubberr

Serhii Chvaliuk (grubberr) commented May 24, 2022

Copy link
Copy Markdown
Contributor

/test connector=connectors/source-facebook-marketing

🕑 connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2376340659
❌ connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2376340659
🐛 https://gradle.com/s/ke2czo2he57ws

Build Failed

Test summary info:

	 =========================== short test summary info ============================
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_stream_slices_no_state
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_stream_slices_no_state_close_to_now
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_stream_slices_with_state
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_stream_slices_with_state_close_to_now
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_stream_slices_with_state_and_slices
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_completed_slices_in_lookback_period
	 FAILED unit_tests/test_base_insight_streams.py::TestBaseInsightsStream::test_incremental_lookback_period_updated
	 �[31m========================= �[31m�[1m7 failed�[0m, �[32m93 passed�[0m�[31m in 1.47s�[0m�[31m =========================�[0m

@alafanechere

Copy link
Copy Markdown
Contributor

Hey Serhii Chvaliuk (@grubberr) do you have an idea why tests are failing now after passing yesterday? Did you merge master in the branch?
Vladimir remar (@vladimir-remar) I will be off until next Monday, bare with me for the review delay. Serhii Chvaliuk (@grubberr) feel free to proceed to publish and merge once we get a review from Andy (@misteryeo) .

@vladimir-remar

Vladimir remar (vladimir-remar) commented May 24, 2022

Copy link
Copy Markdown
Contributor Author

Hey Serhii Chvaliuk (@grubberr) do you have an idea why tests are failing now after passing yesterday? Did you merge master in the branch? Vladimir remar (@vladimir-remar) I will be off until next Monday, bare with me for the review delay. Serhii Chvaliuk (@grubberr) feel free to proceed to publish and merge once we get a review from Andy (@misteryeo) .

Augustin (@alafanechere) Yes I did today after see the conflict.

@grubberr

Copy link
Copy Markdown
Contributor

Vladimir remar (@vladimir-remar) I think unit_tests failed because the master branch changed and you need to synchronise your code base with the latest updates in the master

@grubberr

Serhii Chvaliuk (grubberr) commented May 24, 2022

Copy link
Copy Markdown
Contributor

/test connector=connectors/source-facebook-marketing

🕑 connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2378940847
✅ connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2378940847
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        77      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/tests/test_incremental.py       121     25    79%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/tests/test_core.py              294    106    64%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
------------------------------------------------------------------------
TOTAL                                                  960    246    74%
Name                                                        Stmts   Miss  Cover
-------------------------------------------------------------------------------
source_facebook_marketing/streams/__init__.py                   2      0   100%
source_facebook_marketing/spec.py                              36      0   100%
source_facebook_marketing/__init__.py                           2      0   100%
source_facebook_marketing/api.py                               96     12    88%
source_facebook_marketing/streams/base_streams.py             127     27    79%
source_facebook_marketing/streams/common.py                    41     13    68%
source_facebook_marketing/streams/streams.py                   97     32    67%
source_facebook_marketing/source.py                            39     16    59%
source_facebook_marketing/streams/base_insight_streams.py     147     69    53%
source_facebook_marketing/streams/async_job.py                210    134    36%
source_facebook_marketing/streams/async_job_manager.py         78     60    23%
-------------------------------------------------------------------------------
TOTAL                                                         875    363    59%
Name                                                        Stmts   Miss  Cover
-------------------------------------------------------------------------------
source_facebook_marketing/streams/async_job.py                210      0   100%
source_facebook_marketing/streams/__init__.py                   2      0   100%
source_facebook_marketing/spec.py                              36      0   100%
source_facebook_marketing/__init__.py                           2      0   100%
source_facebook_marketing/streams/common.py                    41      1    98%
source_facebook_marketing/source.py                            39      1    97%
source_facebook_marketing/streams/async_job_manager.py         78      3    96%
source_facebook_marketing/streams/base_insight_streams.py     147      6    96%
source_facebook_marketing/api.py                               96      9    91%
source_facebook_marketing/streams/streams.py                   97     22    77%
source_facebook_marketing/streams/base_streams.py             127     30    76%
-------------------------------------------------------------------------------
TOTAL                                                         875     72    92%

Build Passed

Test summary info:

All Passed

@grubberr

Serhii Chvaliuk (grubberr) commented May 25, 2022

Copy link
Copy Markdown
Contributor

/test connector=connectors/source-facebook-marketing

🕑 connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2383206314
✅ connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2383206314
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        77      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/tests/test_incremental.py       121     25    79%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/tests/test_core.py              294    106    64%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
------------------------------------------------------------------------
TOTAL                                                  960    246    74%
Name                                                        Stmts   Miss  Cover
-------------------------------------------------------------------------------
source_facebook_marketing/streams/__init__.py                   2      0   100%
source_facebook_marketing/spec.py                              36      0   100%
source_facebook_marketing/__init__.py                           2      0   100%
source_facebook_marketing/api.py                               96     12    88%
source_facebook_marketing/streams/base_streams.py             127     27    79%
source_facebook_marketing/streams/common.py                    41     13    68%
source_facebook_marketing/streams/streams.py                   97     32    67%
source_facebook_marketing/source.py                            39     16    59%
source_facebook_marketing/streams/base_insight_streams.py     147     69    53%
source_facebook_marketing/streams/async_job.py                210    134    36%
source_facebook_marketing/streams/async_job_manager.py         78     60    23%
-------------------------------------------------------------------------------
TOTAL                                                         875    363    59%
Name                                                        Stmts   Miss  Cover
-------------------------------------------------------------------------------
source_facebook_marketing/streams/async_job.py                210      0   100%
source_facebook_marketing/streams/__init__.py                   2      0   100%
source_facebook_marketing/spec.py                              36      0   100%
source_facebook_marketing/__init__.py                           2      0   100%
source_facebook_marketing/streams/common.py                    41      1    98%
source_facebook_marketing/source.py                            39      1    97%
source_facebook_marketing/streams/async_job_manager.py         78      3    96%
source_facebook_marketing/streams/base_insight_streams.py     147      6    96%
source_facebook_marketing/api.py                               96      9    91%
source_facebook_marketing/streams/streams.py                   97     22    77%
source_facebook_marketing/streams/base_streams.py             127     30    76%
-------------------------------------------------------------------------------
TOTAL                                                         875     72    92%

Build Passed

Test summary info:

All Passed

@alafanechere Augustin (alafanechere) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you Serhii Chvaliuk (@grubberr) for the review and Vladimir remar (@vladimir-remar) for the changes! I'm now waiting for Andy (@misteryeo) approval to publish and merge.

@alafanechere

Augustin (alafanechere) commented May 31, 2022

Copy link
Copy Markdown
Contributor

/publish connector=connectors/source-facebook-marketing

🕑 connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2413164173
❌ Failed to publish connectors/source-facebook-marketing
❌ Couldn't auto-bump version for connectors/source-facebook-marketing
🕑 connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2413164173
🚀 Successfully published connectors/source-facebook-marketing
🚀 Auto-bumped version for connectors/source-facebook-marketing
✅ connectors/source-facebook-marketing https://github.com/airbytehq/airbyte/actions/runs/2413164173

@alafanechere

Copy link
Copy Markdown
Contributor

Thank you Vladimir remar (@vladimir-remar) for the contribution! The new connector version is now published and I'm going to merge this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants