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 Amplitude: Fixed JSON Validator date-time validation #13373

Merged

Conversation

bazarnov
Copy link
Collaborator

@bazarnov bazarnov commented Jun 1, 2022

What

Resolving: #13075

How

  • added _get_date_time_items_from_schema method to get all date-time formated items from schema
  • added _date_time_to_rfc3339 method to transform record date-time entities to RFC3339 format
  • added unit_tests to cover the case

🚨 User Impact 🚨

No impact expected.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • 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

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

@bazarnov bazarnov self-assigned this Jun 1, 2022
@github-actions github-actions bot added the area/connectors Connector related issues label Jun 1, 2022
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Jun 1, 2022
@bazarnov bazarnov requested a review from pedroslopez June 1, 2022 11:40
@bazarnov
Copy link
Collaborator Author

bazarnov commented Jun 1, 2022

@pedroslopez please check this PR according to this discussion: #13075

@airbytehq airbytehq deleted a comment from codecov bot Jun 1, 2022
@bazarnov
Copy link
Collaborator Author

bazarnov commented Jun 1, 2022

/test connector=connectors/source-amplitude

🕑 connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/2421665113
✅ connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/2421665113
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_amplitude/source.py        24      0   100%
source_amplitude/__init__.py       2      0   100%
source_amplitude/errors.py        12      1    92%
source_amplitude/api.py          149     18    88%
--------------------------------------------------
TOTAL                            187     19    90%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_incremental.py:23: `future_state_path` not specified, skipping
================== 23 passed, 1 skipped in 152.11s (0:02:32) ===================

Copy link
Contributor

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

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

I think the right approach here is to follow what Hubspot did in #13159 and instead fix the connector to output date-times in RFC3339 format.

From my comment in #13075:

We are using JSONSchema to specify types, and JSONSchema specifically states that date-times should be represented RFC3339. As such, I think the right solution is to have connectors output date-times in RFC3339, rather than simply remove "format": "date-time" from the stream schemas.

@bazarnov
Copy link
Collaborator Author

bazarnov commented Jun 2, 2022

/test connector=connectors/source-amplitude

🕑 connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/2427963867
✅ connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/2427963867
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_amplitude/source.py        24      0   100%
source_amplitude/__init__.py       2      0   100%
source_amplitude/errors.py        12      1    92%
source_amplitude/api.py          165     18    89%
--------------------------------------------------
TOTAL                            203     19    91%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_incremental.py:23: `future_state_path` not specified, skipping
================== 23 passed, 1 skipped in 123.27s (0:02:03) ===================

@airbytehq airbytehq deleted a comment from codecov bot Jun 2, 2022
@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@d79b319). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 5a0ce03 differs from pull request most recent head 98f3d2d. Consider uploading reports for the commit 98f3d2d to get more accurate results

@@            Coverage Diff            @@
##             master   airbytehq/airbyte#13373   +/-   ##
=========================================
  Coverage          ?   92.03%           
=========================================
  Files             ?        4           
  Lines             ?      201           
  Branches          ?        0           
=========================================
  Hits              ?      185           
  Misses            ?       16           
  Partials          ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d79b319...98f3d2d. Read the comment docs.

@bazarnov
Copy link
Collaborator Author

bazarnov commented Jun 3, 2022

/test connector=connectors/source-amplitude

🕑 connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/2434214434
✅ connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/2434214434
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_amplitude/source.py        24      0   100%
source_amplitude/__init__.py       2      0   100%
source_amplitude/errors.py        12      1    92%
source_amplitude/api.py          163     15    91%
--------------------------------------------------
TOTAL                            201     16    92%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_incremental.py:23: `future_state_path` not specified, skipping
================== 23 passed, 1 skipped in 144.58s (0:02:24) ===================

@bazarnov bazarnov requested a review from sherifnada June 3, 2022 11:42
Copy link
Contributor

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

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

Nice - verified that timestamps from the amplitude export api are actually UTC according to docs, so this should be good:

The Export API returns events timestamped in UTC

https://developers.amplitude.com/docs/export-api

@bazarnov
Copy link
Collaborator Author

bazarnov commented Jun 3, 2022

/publish connector=connectors/source-amplitude

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

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets June 3, 2022 14:41 Inactive
@bazarnov bazarnov merged commit 94dc191 into master Jun 3, 2022
@bazarnov bazarnov deleted the bazarnov/13075-source-amplitude-fix-date-time-validation branch June 3, 2022 14:41
chebalski added a commit to BluestarGenomics/airbyte that referenced this pull request Jul 25, 2022
* master: (142 commits)
  Highlight removed and added streams in Connection form (airbytehq#13392)
  🐛  Source Amplitude: Fixed JSON Validator `date-time` validation (airbytehq#13373)
  🐛 Source Mixpanel: publish v0.1.17 (airbytehq#13450)
  Fixed reverted PR: Fix cancel button when it doesn't provide feedback to the user + UX improvements (airbytehq#13388)
  🎉 Source Freshdesk: Added new streams (airbytehq#13332)
  Prepare YamlSeedConfigPersistence for dependency injection (airbytehq#13384)
  helm chart: Support nodeSelector, tolerations and affinity on the booloader pod (airbytehq#11467)
  airbyte-api: add jackson model annotations to remove null values from responses (airbytehq#13370)
  Change stage to `beta` (airbytehq#13422)
  🐛 Source Google Sheets: Retry on server errors (airbytehq#13446)
  Improve kube deploy process. (airbytehq#13397)
  Helm chart dependencies fix (airbytehq#13432)
  🐛 Source HubSpot: Transform `contact_lists` data to comply with schema (airbytehq#13218)
  airbytehq#11758: Source Google Ads to GA (airbytehq#13441)
  Add more pr actions to tag pull requests (airbytehq#13437)
  Source Google Ads: drop schema field that filters out the data from stream (airbytehq#13423)
  Updates error view with new design (airbytehq#13197)
  Source MSSQL: correct enum Standard method (airbytehq#13419)
  Update postgres doc about cdc publication (airbytehq#13433)
  run source acceptance tests against image built from branch (airbytehq#13401)
  ...
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/amplitude
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Source Amplitude: Failed to apply RFC3339 pattern on date-time string
5 participants