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: fix start date validation #17320

Merged
merged 10 commits into from
Oct 3, 2022

Conversation

lazebnyi
Copy link
Collaborator

What

https://github.com/airbytehq/oncall/issues/438 - Source: Amplitude - requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://amplitude.com/api/2/users?m=active&i=1&g=country&s... (via Sentry)

Field start date set in future.

How

Add validation to stream method and if start date in future start date set to current date and inform customer in logs about that.

Pre-merge Checklist

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

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Sep 28, 2022
@lazebnyi
Copy link
Collaborator Author

lazebnyi commented Sep 28, 2022

/test connector=connectors/source-amplitude

🕑 connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/3143854949
❌ connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/3143854949
🐛 https://gradle.com/s/ndhc33kbev37u

Build Failed

Test summary info:

=========================== short test summary info ============================
FAILED test_core.py::TestDiscovery::test_discover[inputs0] - docker.errors.Co...
ERROR test_core.py::TestDiscovery::test_defined_cursors_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_refs_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-allOf]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-not]
ERROR test_core.py::TestDiscovery::test_primary_keys_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_streams_has_sync_modes[inputs0] - doc...
ERROR test_core.py::TestDiscovery::test_additional_properties_is_true[inputs0]
ERROR test_core.py::TestDiscovery::test_backward_compatibility[inputs0] - doc...
ERROR test_core.py::TestBasicRead::test_read[inputs0] - docker.errors.Contain...
ERROR test_full_refresh.py::TestFullRefresh::test_sequential_reads[inputs0]
ERROR test_incremental.py::TestIncremental::test_two_sequential_reads[inputs0]
ERROR test_incremental.py::TestIncremental::test_read_sequential_slices[inputs0]
ERROR test_incremental.py::TestIncremental::test_state_with_abnormally_large_values[inputs0]
=================== 1 failed, 15 passed, 13 errors in 27.72s ===================

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.

small nits but looks good to me

@lazebnyi lazebnyi removed the request for review from grubberr October 3, 2022 21:23
@lazebnyi
Copy link
Collaborator Author

lazebnyi commented Oct 3, 2022

/test connector=connectors/source-amplitude

🕑 connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/3177686207
❌ connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/3177686207
🐛 https://gradle.com/s/tozvxc5dtp2yo

Build Failed

Test summary info:

	 =========================== short test summary info ============================
	 FAILED unit_tests/test_api.py::TestIncrementalStreams::test_request_params[ActiveUsers]
	 FAILED unit_tests/test_api.py::TestIncrementalStreams::test_request_params[AverageSessionLength]
	 FAILED unit_tests/test_api.py::TestEventsStream::test_stream_slices - TypeErr...
	 FAILED unit_tests/test_errors.py::test_incremental_http_error_handler - TypeE...
	 FAILED unit_tests/test_source.py::test_validate_start_date - AssertionError: ...
	 �[31m================== �[31m�[1m5 failed�[0m, �[32m30 passed�[0m, �[33m120 warnings�[0m�[31m in 1.57s�[0m�[31m ==================�[0m

@lazebnyi
Copy link
Collaborator Author

lazebnyi commented Oct 3, 2022

/test connector=connectors/source-amplitude

🕑 connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/3177848585
✅ connectors/source-amplitude https://github.com/airbytehq/airbyte/actions/runs/3177848585
Python tests coverage:

Name                           Stmts   Miss  Cover
--------------------------------------------------
source_amplitude/__init__.py       2      0   100%
source_amplitude/source.py        37      1    97%
source_amplitude/errors.py        12      1    92%
source_amplitude/api.py          171     22    87%
--------------------------------------------------
TOTAL                            222     24    89%
	 Name                                                 Stmts   Miss  Cover   Missing
	 ----------------------------------------------------------------------------------
	 source_acceptance_test/base.py                          10      4    60%   15-18
	 source_acceptance_test/config.py                        83      6    93%   78-80, 84-86
	 source_acceptance_test/conftest.py                     164    164     0%   6-282
	 source_acceptance_test/plugin.py                        48     48     0%   6-104
	 source_acceptance_test/tests/test_core.py              329    111    66%   39, 50-58, 63-70, 74-75, 79-80, 164, 202-219, 228-236, 240-245, 251, 284-289, 327-334, 374-376, 379, 439-448, 477-478, 484, 487, 520-530, 543-568, 573-577
	 source_acceptance_test/tests/test_full_refresh.py       52      2    96%   34, 65
	 source_acceptance_test/tests/test_incremental.py       152     26    83%   21-23, 29-31, 36-43, 48-61, 239, 250-258
	 source_acceptance_test/utils/asserts.py                 37      2    95%   57-58
	 source_acceptance_test/utils/common.py                  77     17    78%   15-16, 24-30, 47-54, 64, 67
	 source_acceptance_test/utils/compare.py                 62     23    63%   21-51, 68, 97-99
	 source_acceptance_test/utils/connector_runner.py       112     50    55%   23-26, 32, 36, 39-67, 70-72, 75-77, 80-82, 85-87, 90-92, 95-113, 147-149
	 source_acceptance_test/utils/json_schema_helper.py     105     13    88%   30-31, 38, 41, 65-68, 96, 120, 190-192
	 ----------------------------------------------------------------------------------
	 TOTAL                                                 1358    466    66%

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
================== 28 passed, 1 skipped in 102.16s (0:01:42) ===================

@lazebnyi
Copy link
Collaborator Author

lazebnyi commented Oct 3, 2022

/publish connector=connectors/source-amplitude

🕑 Publishing the following connectors:
connectors/source-amplitude
https://github.com/airbytehq/airbyte/actions/runs/3177955420


Connector Did it publish? Were definitions generated?
connectors/source-amplitude

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@lazebnyi lazebnyi merged commit f94185e into master Oct 3, 2022
@lazebnyi lazebnyi deleted the lazebnyi/438-fix-amlitude-start-date-validation branch October 3, 2022 23:00
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* Fix start date validation

* Add unittests

* Updated to review

* Delteed print

* Updated version

* Updated version

* Updated to SAT

* Updated to unittest

* auto-bump connector version [ci skip]

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 connectors/source/amplitude
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants