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

🎉 New Source: 3PL Central #7322

Merged
merged 96 commits into from
Dec 28, 2021

Conversation

monai
Copy link
Contributor

@monai monai commented Oct 25, 2021

What

Upstream API documentation:

How

The source queries 3PL Central HTTP API using Python CDK and applies the following transformations:

  • Converts all JSON object keys from TitleCase to snake_case.
  • Recursively removes HAL _link keys from all objects.
  • Adds primary key and cursor fields.

Unlike the Singer tap mentioned above, the source implementation does not apply any opinionated fetched data cleanup or flattening.

Recommended reading order

  1. source.py
  2. streams.py
  3. util.py

Pre-merge Checklist

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
  • Connector added to connector index like described here

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
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

@alafanechere alafanechere removed the waiting-for-cred Waiting for CI credentials label Dec 21, 2021
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

hey we can keep properties as empty. Since these are just integration tests it's ok to leave these as empty objects

@monai
Copy link
Contributor Author

monai commented Dec 22, 2021

Recent changes:

Copy link
Contributor

@harshithmullapudi harshithmullapudi left a comment

Choose a reason for hiding this comment

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

LGTM

  1. Can you run ./gradlew format
  2. Also share the screenshots for integration_tests and unit_tests

@monai
Copy link
Contributor Author

monai commented Dec 27, 2021

  1. It is already done. Just run again, and no changes were generated.
Unit tests
~/projects/lt/airbyte/airbyte-integrations/connectors/source-tplcentral (source-tplcentral-alt) [um] python -m pytest -v unit_tests/                 [.venv]
Test session starts (platform: darwin, Python 3.9.7, pytest 6.1.2, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Users/juozas/projects/lt/airbyte, configfile: pytest.ini
plugins: cov-2.12.1, sugar-0.9.4, requests-mock-1.9.3, mock-3.6.1, timeout-1.4.2
collecting ...
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py::test_cursor_field ✓                                  5% ▌
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py::test_get_updated_state ✓                            10% ▉
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py::test_stream_slices ✓                                14% █▌
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py::test_supports_incremental ✓                         19% █▉
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py::test_source_defined_cursor ✓                        24% ██▍
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py::test_stream_checkpoint_interval ✓                   29% ██▉
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_source.py::test_check_connection ✓                                          33% ███▍
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_source.py::test_streams ✓                                                   38% ███▊
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_request_params ✓                                           43% ████▍
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_next_page_token ✓                                          48% ████▊
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_next_page_token_with_page_size ✓                           52% █████▎
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_parse_response ✓                                           57% █████▊
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_parse_response_with_primary_key ✓                          62% ██████▎
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_parse_response_with_cursor_field ✓                         67% ██████▋
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_request_headers ✓                                          71% ███████▎
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_http_method ✓                                              76% ███████▋
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_should_retry[HTTPStatus.OK-False] ✓                        81% ████████▏
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_should_retry[HTTPStatus.BAD_REQUEST-False] ✓               86% ████████▋
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_should_retry[HTTPStatus.TOO_MANY_REQUESTS-True] ✓          90% █████████▏
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_should_retry[HTTPStatus.INTERNAL_SERVER_ERROR-True] ✓      95% █████████▌
 airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py::test_backoff_time ✓                                            100% ██████████
===================================================================== warnings summary ======================================================================
airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py: 6 warnings
airbyte-integrations/connectors/source-tplcentral/unit_tests/test_source.py: 6 warnings
airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py: 13 warnings
  /Users/juozas/projects/lt/airbyte/airbyte-integrations/connectors/source-tplcentral/.venv/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/http.py:38: DeprecationWarning: Call to deprecated class NoAuth. (Set `authenticator=None` instead) -- Deprecated since version 0.1.20.
    self._authenticator = NoAuth()

airbyte-integrations/connectors/source-tplcentral/unit_tests/test_incremental_streams.py: 6 warnings
airbyte-integrations/connectors/source-tplcentral/unit_tests/test_source.py: 6 warnings
airbyte-integrations/connectors/source-tplcentral/unit_tests/test_streams.py: 13 warnings
  /Users/juozas/projects/lt/airbyte/airbyte-integrations/connectors/source-tplcentral/.venv/lib/python3.9/site-packages/deprecated/classic.py:173: DeprecationWarning: Call to deprecated class HttpAuthenticator. (Use requests.auth.AuthBase instead) -- Deprecated since version 0.1.20.
    return old_new1(cls, *args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

Results (0.62s):
      21 passed
Acceptance tests
~/projects/lt/airbyte/airbyte-integrations/connectors/source-tplcentral python -m pytest -p integration_tests.acceptance                                                                         [.venv]
Test session starts (platform: darwin, Python 3.9.7, pytest 6.1.2, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Users/juozas/projects/lt/airbyte, configfile: pytest.ini
plugins: cov-2.12.1, sugar-0.9.4, requests-mock-1.9.3, mock-3.6.1, timeout-1.4.2
collecting ...
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_match_expected[inputs0] ✓                                                       4% ▍
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_required[inputs0] ✓                                                             7% ▊
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_optional[inputs0] ✓                                                            11% █▏
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_has_secret[inputs0] ✓                                                          14% █▌
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_secret_never_in_the_output[inputs0] ✓                                          18% █▊
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_defined_refs_exist_in_json_spec_file[inputs0] ✓                                21% ██▎
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_oauth_flow_parameters[inputs0] ✓                                               25% ██▌
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestConnection.test_check[inputs0] ✓                                                         29% ██▉
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestConnection.test_check[inputs1] ✓                                                         32% ███▎
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestDiscovery.test_discover[inputs0] ✓                                                       36% ███▋
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestDiscovery.test_defined_cursors_exist_in_schema[inputs0] ✓                                39% ███▉
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestDiscovery.test_defined_refs_exist_in_schema[inputs0] ✓                                   43% ████▍
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestBasicRead.test_read[inputs0] ✓                                                           46% ████▋
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestBasicRead.test_read[inputs1] ✓                                                           50% █████
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestBasicRead.test_read[inputs2] ✓                                                           54% █████▍
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestBasicRead.test_read[inputs3] ✓                                                           57% █████▊
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestBasicRead.test_read[inputs4] ✓                                                           61% ██████▏
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestBasicRead.test_read[inputs5] ✓                                                           64% ██████▌
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_full_refresh.py::TestFullRefresh.test_sequential_reads[inputs0] ✓                                     68% ██████▊
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_full_refresh.py::TestFullRefresh.test_sequential_reads[inputs1] ✓                                     71% ███████▎
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_two_sequential_reads[inputs0] ✓                                  75% ███████▌
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_two_sequential_reads[inputs1] ✓                                  79% ███████▉
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_two_sequential_reads[inputs2] ✓                                  82% ████████▎
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_two_sequential_reads[inputs3] ✓                                  86% ████████▋
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_state_with_abnormally_large_values[inputs0] ✓                    89% ████████▉
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_state_with_abnormally_large_values[inputs1] ✓                    93% █████████▍
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_state_with_abnormally_large_values[inputs2] ✓                    96% █████████▋
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_incremental.py::TestIncremental.test_state_with_abnormally_large_values[inputs3] ✓                   100% ██████████

Results (79.58s):
      28 passed

@harshithmullapudi harshithmullapudi temporarily deployed to more-secrets December 28, 2021 07:45 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets December 28, 2021 07:47 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets December 28, 2021 07:56 Inactive
@harshithmullapudi harshithmullapudi merged commit 22dcb0f into airbytehq:master Dec 28, 2021
@monai monai deleted the source-tplcentral-alt branch January 31, 2022 08:12
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 bounty community connectors/source/tplcentral
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

8 participants