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 Titok marketing: update schema. add unittest, update SAT, fix initialization for Audience streams #11378

Merged
merged 19 commits into from
Apr 25, 2022

Conversation

midavadim
Copy link
Contributor

@midavadim midavadim commented Mar 23, 2022

Engineering Acceptance Criteria:

Source Tiktok Marketing: have at least 90% unit test coverage #11372
Source Tiktok Marketing: add missing streams in SAT #11376
Source Tiktok marketing: add SAT tests for DAY, HOUR granularity #11377

Outstanding bugs:

Source Tiktok: data type error for mobile_app_id field in ads_reports_metrics and ad_groups_reports_metrics #9709
Source Tiktok: wrong type in campaign schema #9491
Round value of source attribute with type "integer" #6875
Source Tiktok: fix metrix for LIFETIME granularity #11375
Source Titok marketing: discovery method is too long (~ 40 seconds) #12107

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
  • 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 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
  • 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 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

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@CLAassistant
Copy link

CLAassistant commented Mar 23, 2022

CLA assistant check
All committers have signed the CLA.

…, basic_resports, audience_reports) with DAY and LIFETIME granularities.

Advertizer ids are extracted only during read method, previously ids were extracted during stream initialization.
Added caching for AdvertizerIds stream
@midavadim midavadim requested a review from bazarnov April 5, 2022 22:06
- config_path: "secrets/prod_config_day.json"
configured_catalog_path: "integration_tests/streams_all.json"
timeout_seconds: 1200
validate_schema: false # validation fails for audience report streams
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we aware of what exactly is wrong with the validation of Audience Report streams?

Comment on lines -46 to -51
"cash_spend": {
"type": ["null", "number"]
},
"voucher_spend": {
"type": ["null", "number"]
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any valid reason we removed this from the schema?

@@ -108,6 +114,14 @@ class TiktokStream(HttpStream, ABC):
# max value of page
page_size = 1000

def __init__(self, **kwargs):
super().__init__(authenticator=kwargs.get("authenticator"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to call authenticator directly here? I believe it should be passed automatically if we have such a property inside the passing args. Please check.

@midavadim
Copy link
Contributor Author

midavadim commented Apr 18, 2022

/test connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2185218954
❌ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2185218954
🐛 https://gradle.com/s/74kxw77igzaae
Python short test summary info:

=========================== short test summary info ============================
FAILED test_core.py::TestSpec::test_oneof_usage[inputs0] - AssertionError: Th...
FAILED test_incremental.py::TestIncremental::test_two_sequential_reads[inputs0]
=================== 2 failed, 53 passed in 300.33s (0:05:00) ===================

@midavadim
Copy link
Contributor Author

midavadim commented Apr 18, 2022

/test connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2185517326
❌ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2185517326
🐛 https://gradle.com/s/uahfl2fkgkffo
Python short test summary info:

=========================== short test summary info ============================
FAILED test_incremental.py::TestIncremental::test_two_sequential_reads[inputs0]
=================== 1 failed, 54 passed in 309.92s (0:05:09) ===================

@midavadim
Copy link
Contributor Author

midavadim commented Apr 18, 2022

/test connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2186481439
✅ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2186481439
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                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              275    106    61%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  876    259    70%
Name                                  Stmts   Miss  Cover
---------------------------------------------------------
source_tiktok_marketing/spec.py          65      0   100%
source_tiktok_marketing/source.py        50      0   100%
source_tiktok_marketing/__init__.py       2      0   100%
source_tiktok_marketing/streams.py      316     24    92%
---------------------------------------------------------
TOTAL                                   433     24    94%

Python short test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.7/site-packages/source_acceptance_test/plugin.py:56: Skipping TestDiscovery.test_discover because not found in the config
================== 27 passed, 1 skipped in 396.06s (0:06:36) ===================

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Apr 19, 2022
@midavadim
Copy link
Contributor Author

midavadim commented Apr 19, 2022

/test connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2189565733
✅ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2189565733
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                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              275    106    61%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  876    259    70%
Name                                  Stmts   Miss  Cover
---------------------------------------------------------
source_tiktok_marketing/spec.py          65      0   100%
source_tiktok_marketing/source.py        50      0   100%
source_tiktok_marketing/__init__.py       2      0   100%
source_tiktok_marketing/streams.py      316     24    92%
---------------------------------------------------------
TOTAL                                   433     24    94%

@midavadim midavadim requested a review from tuliren April 19, 2022 12:40
@midavadim midavadim changed the title 🐛 Source Titok marketing: update schema 🐛 Source Titok marketing: update schema. add unittest, update SAT, fix initialization for Audience streams Apr 19, 2022
@midavadim midavadim closed this Apr 22, 2022
@midavadim midavadim reopened this Apr 22, 2022
@midavadim
Copy link
Contributor Author

midavadim commented Apr 25, 2022

/test connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2220103680
✅ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2220103680
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                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              275    106    61%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  876    259    70%
Name                                  Stmts   Miss  Cover
---------------------------------------------------------
source_tiktok_marketing/spec.py          65      0   100%
source_tiktok_marketing/source.py        50      0   100%
source_tiktok_marketing/__init__.py       2      0   100%
source_tiktok_marketing/streams.py      316     24    92%
---------------------------------------------------------
TOTAL                                   433     24    94%

@midavadim
Copy link
Contributor Author

midavadim commented Apr 25, 2022

/test connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2220633380
✅ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2220633380
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                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              275    106    61%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  876    259    70%
Name                                  Stmts   Miss  Cover
---------------------------------------------------------
source_tiktok_marketing/spec.py          65      0   100%
source_tiktok_marketing/source.py        49      0   100%
source_tiktok_marketing/__init__.py       2      0   100%
source_tiktok_marketing/streams.py      316     24    92%
---------------------------------------------------------
TOTAL                                   432     24    94%

@midavadim
Copy link
Contributor Author

midavadim commented Apr 25, 2022

/publish connector=connectors/source-tiktok-marketing

🕑 connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2220820813
🚀 Successfully published connectors/source-tiktok-marketing
🚀 Auto-bumped version for connectors/source-tiktok-marketing
✅ connectors/source-tiktok-marketing https://github.com/airbytehq/airbyte/actions/runs/2220820813

@midavadim midavadim temporarily deployed to more-secrets April 25, 2022 14:23 Inactive
@midavadim midavadim temporarily deployed to more-secrets April 25, 2022 14:23 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets April 25, 2022 14:45 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets April 25, 2022 14:45 Inactive
@midavadim midavadim temporarily deployed to more-secrets April 25, 2022 14:54 Inactive
@midavadim midavadim temporarily deployed to more-secrets April 25, 2022 14:54 Inactive
…hema-fix

# Conflicts:
#	airbyte-config/init/src/main/resources/seed/source_specs.yaml
@midavadim midavadim merged commit c42b00e into master Apr 25, 2022
@midavadim midavadim deleted the midavadim/tiktok-schema-fix branch April 25, 2022 14:58
@midavadim midavadim temporarily deployed to more-secrets April 25, 2022 14:58 Inactive
@midavadim midavadim temporarily deployed to more-secrets April 25, 2022 14:58 Inactive
@midavadim midavadim removed a link to an issue Apr 27, 2022
9 tasks
@midavadim midavadim linked an issue Apr 27, 2022 that may be closed by this pull request
9 tasks
suhomud pushed a commit that referenced this pull request May 23, 2022
…x initialization for Audience streams (#11378)

* update schemas

* Added tests (basixm full_refresh, incremental) for all streams (basic, basic_resports, audience_reports) with DAY and LIFETIME granularities.
Advertizer ids are extracted only during read method, previously ids were extracted during stream initialization.
Added caching for AdvertizerIds stream

* added description for _advertiser_ids usage and

* applied format

* fixed unit test

* fixed get_advertiser_ids() usage

* added unit test

* removed enum attr for const properties

* split audience report incremental tests

* updated docs

* updated docs and updated tests

* added conditions for sandbox env, updated docs and updated tests

* update connector version to 0.1.6

* auto-bump connector version

* update source_specs.yaml

* update source_specs.yaml

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
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
Projects
None yet
5 participants