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 Amazon Seller Partner: GET_SELLER_FEEDBACK_DATA normalize header field names #9212

Conversation

lizdeika
Copy link
Contributor

What

  1. We got real acces s to some marketplaces and found out that report header field names are localized(or semi localized) to marketplace language.
    Examples:
    A1PA6795UKMFR9 DE:
Datum Bewertung Kommentar  Ihre Antwort Transaktionsnummer E-Mail des Bewertenden

A1RKKUPIHCS9HS ES:

Date Rating Comentarios Response Número de pedido E-mail del cliente

A1AM78C64UM0Y8 MX:

Fecha Rating Comentarios Tu respuesta Número de pedido Correo electrónico del evaluador

etc.

  1. Some date formats are not correct when pulling real world data.

How

  1. Luckily columns come in the same order in all marketplaces.
    We pass fieldnames to DictReader so we always have the same header field names.

  2. Fix date formats

Recommended reading order

🚨 User Impact 🚨

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

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Dec 30, 2021
@lizdeika
Copy link
Contributor Author

lizdeika commented Dec 30, 2021

test results
» python -m pytest integration_tests -p integration_tests.acceptance
Test session starts (platform: darwin, Python 3.9.8, pytest 6.2.5, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Users/lizdeika/Projects/airbyte, configfile: pytest.ini
plugins: sugar-0.9.4, 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] ✓              9% ▉
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_required[inputs0] ✓                   18% █▊
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_optional[inputs0] ✓                   27% ██▊
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_has_secret[inputs0] ✓                 36% ███▋
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_secret_never_in_the_output[inputs0] ✓ 45% ████▋
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_defined_refs_exist_in_json_spec_file[inputs0] ✓55% █████▌
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestSpec.test_oauth_flow_parameters[inputs0] ✓      64% ██████▍
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestConnection.test_check[inputs0] ✓                73% ███████▍
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestDiscovery.test_discover[inputs0] ✓              82% ████████▎
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestDiscovery.test_defined_cursors_exist_in_schema[inputs0] ✓91% █████████▏
 airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py::TestDiscovery.test_defined_refs_exist_in_schema[inputs0] ✓100% ██████████
=================================================================== short test summary info ====================================================================
SKIPPED [1] ../../bases/source-acceptance-test/source_acceptance_test/plugin.py:56: Skipping TestBasicRead.test_read because not found in the config
SKIPPED [1] ../../bases/source-acceptance-test/source_acceptance_test/plugin.py:56: Skipping TestFullRefresh.test_sequential_reads because not found in the config
SKIPPED [1] ../../bases/source-acceptance-test/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config

Results (13.39s):
      11 passed

» python -m pytest unit_tests
Test session starts (platform: darwin, Python 3.9.8, pytest 6.2.5, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Users/lizdeika/Projects/airbyte, configfile: pytest.ini
plugins: sugar-0.9.4, mock-3.6.1, timeout-1.4.2
collecting ...
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py::test_reports_stream_should_retry ✓    1% ▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py::test_reports_stream_send_request ✓    2% ▎         {"type": "LOG", "log": {"level": "INFO", "message": "Backing off _send_request(...) for 5.0s (airbyte_cdk.sources.streams.http.exceptions.DefaultBackoffException)"}}
{"type": "LOG", "log": {"level": "INFO", "message": "Caught retryable error '' after 1 tries. Waiting 5 seconds then retrying..."}}
{"type": "LOG", "log": {"level": "INFO", "message": "Backing off _send_request(...) for 10.0s (airbyte_cdk.sources.streams.http.exceptions.DefaultBackoffException)"}}
{"type": "LOG", "log": {"level": "INFO", "message": "Caught retryable error '' after 2 tries. Waiting 10 seconds then retrying..."}}
{"type": "LOG", "log": {"level": "INFO", "message": "Backing off _send_request(...) for 20.0s (airbyte_cdk.sources.streams.http.exceptions.DefaultBackoffException)"}}
{"type": "LOG", "log": {"level": "INFO", "message": "Caught retryable error '' after 3 tries. Waiting 20 seconds then retrying..."}}
{"type": "LOG", "log": {"level": "INFO", "message": "Backing off _send_request(...) for 40.0s (airbyte_cdk.sources.streams.http.exceptions.DefaultBackoffException)"}}
{"type": "LOG", "log": {"level": "INFO", "message": "Caught retryable error '' after 4 tries. Waiting 40 seconds then retrying..."}}
{"type": "LOG", "log": {"level": "ERROR", "message": "Giving up _send_request(...) after 5 tries (airbyte_cdk.sources.streams.http.exceptions.DefaultBackoffException)"}}

 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py::test_reports_stream_send_request_backoff_exception ✓4% ▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2VIGQ35RCS4UG-input_data0-expected_data0] ✓5% ▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2VIGQ35RCS4UG-input_data1-expected_data1] ✓6% ▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2VIGQ35RCS4UG-input_data2-expected_data2] ✓7% ▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2VIGQ35RCS4UG-input_data3-expected_data3] ✓8% ▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1PA6795UKMFR9-input_data4-expected_data4] ✓10% ▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1PA6795UKMFR9-input_data5-expected_data5] ✓11% █▏
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1PA6795UKMFR9-input_data6-expected_data6] ✓12% █▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1PA6795UKMFR9-input_data7-expected_data7] ✓13% █▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1C3SOZRARQ6R3-input_data8-expected_data8] ✓14% █▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1C3SOZRARQ6R3-input_data9-expected_data9] ✓16% █▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1C3SOZRARQ6R3-input_data10-expected_data10] ✓17% █▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1C3SOZRARQ6R3-input_data11-expected_data11] ✓18% █▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ARBP9OOSHTCHU-input_data12-expected_data12] ✓19% █▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ARBP9OOSHTCHU-input_data13-expected_data13] ✓20% ██▏
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ARBP9OOSHTCHU-input_data14-expected_data14] ✓22% ██▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ARBP9OOSHTCHU-input_data15-expected_data15] ✓23% ██▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1RKKUPIHCS9HS-input_data16-expected_data16] ✓24% ██▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1RKKUPIHCS9HS-input_data17-expected_data17] ✓25% ██▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1RKKUPIHCS9HS-input_data18-expected_data18] ✓27% ██▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1RKKUPIHCS9HS-input_data19-expected_data19] ✓28% ██▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A13V1IB3VIYZZH-input_data20-expected_data20] ✓29% ██▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A13V1IB3VIYZZH-input_data21-expected_data21] ✓30% ███
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A13V1IB3VIYZZH-input_data22-expected_data22] ✓31% ███▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A13V1IB3VIYZZH-input_data23-expected_data23] ✓33% ███▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A21TJRUUN4KGV-input_data24-expected_data24] ✓34% ███▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A21TJRUUN4KGV-input_data25-expected_data25] ✓35% ███▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A21TJRUUN4KGV-input_data26-expected_data26] ✓36% ███▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A21TJRUUN4KGV-input_data27-expected_data27] ✓37% ███▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[APJ6JRA9NG5V4-input_data28-expected_data28] ✓39% ███▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[APJ6JRA9NG5V4-input_data29-expected_data29] ✓40% ████
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[APJ6JRA9NG5V4-input_data30-expected_data30] ✓41% ████▏
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[APJ6JRA9NG5V4-input_data31-expected_data31] ✓42% ████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1805IZSGTT6HS-input_data32-expected_data32] ✓43% ████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1805IZSGTT6HS-input_data33-expected_data33] ✓45% ████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1805IZSGTT6HS-input_data34-expected_data34] ✓46% ████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1805IZSGTT6HS-input_data35-expected_data35] ✓47% ████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A17E79C6D8DWNP-input_data36-expected_data36] ✓48% ████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A17E79C6D8DWNP-input_data37-expected_data37] ✓49% ████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A17E79C6D8DWNP-input_data38-expected_data38] ✓51% █████▏
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A17E79C6D8DWNP-input_data39-expected_data39] ✓52% █████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2NODRKZP88ZB9-input_data40-expected_data40] ✓53% █████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2NODRKZP88ZB9-input_data41-expected_data41] ✓54% █████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2NODRKZP88ZB9-input_data42-expected_data42] ✓55% █████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2NODRKZP88ZB9-input_data43-expected_data43] ✓57% █████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A33AVAJ2PDY3EV-input_data44-expected_data44] ✓58% █████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A33AVAJ2PDY3EV-input_data45-expected_data45] ✓59% █████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A33AVAJ2PDY3EV-input_data46-expected_data46] ✓60% ██████
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A33AVAJ2PDY3EV-input_data47-expected_data47] ✓61% ██████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1F83G8C2ARO7P-input_data48-expected_data48] ✓63% ██████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1F83G8C2ARO7P-input_data49-expected_data49] ✓64% ██████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1F83G8C2ARO7P-input_data50-expected_data50] ✓65% ██████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1F83G8C2ARO7P-input_data51-expected_data51] ✓66% ██████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A39IBJ37TRP1C6-input_data52-expected_data52] ✓67% ██████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A39IBJ37TRP1C6-input_data53-expected_data53] ✓69% ██████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A39IBJ37TRP1C6-input_data54-expected_data54] ✓70% ███████
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A39IBJ37TRP1C6-input_data55-expected_data55] ✓71% ███████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1VC38T7YXB528-input_data56-expected_data56] ✓72% ███████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1VC38T7YXB528-input_data57-expected_data57] ✓73% ███████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1VC38T7YXB528-input_data58-expected_data58] ✓75% ███████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1VC38T7YXB528-input_data59-expected_data59] ✓76% ███████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A19VAU5U5O7RUS-input_data60-expected_data60] ✓77% ███████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A19VAU5U5O7RUS-input_data61-expected_data61] ✓78% ███████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A19VAU5U5O7RUS-input_data62-expected_data62] ✓80% ███████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A19VAU5U5O7RUS-input_data63-expected_data63] ✓81% ████████▏
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ATVPDKIKX0DER-input_data64-expected_data64] ✓82% ████████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ATVPDKIKX0DER-input_data65-expected_data65] ✓83% ████████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ATVPDKIKX0DER-input_data66-expected_data66] ✓84% ████████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[ATVPDKIKX0DER-input_data67-expected_data67] ✓86% ████████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2Q3Y263D00KWC-input_data68-expected_data68] ✓87% ████████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2Q3Y263D00KWC-input_data69-expected_data69] ✓88% ████████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2Q3Y263D00KWC-input_data70-expected_data70] ✓89% ████████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2Q3Y263D00KWC-input_data71-expected_data71] ✓90% █████████▏
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2EUQ1WTGCTBG2-input_data72-expected_data72] ✓92% █████████▎
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2EUQ1WTGCTBG2-input_data73-expected_data73] ✓93% █████████▍
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2EUQ1WTGCTBG2-input_data74-expected_data74] ✓94% █████████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A2EUQ1WTGCTBG2-input_data75-expected_data75] ✓95% █████████▌
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1AM78C64UM0Y8-input_data76-expected_data76] ✓96% █████████▋
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1AM78C64UM0Y8-input_data77-expected_data77] ✓98% █████████▊
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1AM78C64UM0Y8-input_data78-expected_data78] ✓99% █████████▉
 airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py::test_transform_seller_feedback[A1AM78C64UM0Y8-input_data79-expected_data79] ✓100% ██████████
======================================================================= warnings summary =======================================================================
source_amazon_seller_partner/streams.py:155
  /Users/lizdeika/Projects/airbyte/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py:155: DeprecationWarning: Call to deprecated class NoAuth. (Set `authenticator=None` instead) -- Deprecated since version 0.1.20.
    authenticator: HttpAuthenticator = NoAuth(),

.venv/lib/python3.9/site-packages/deprecated/classic.py:173: 1 warning
airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py: 3 warnings
airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py: 80 warnings
  /Users/lizdeika/Projects/airbyte/airbyte-integrations/connectors/source-amazon-seller-partner/.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)

airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py::test_reports_stream_should_retry
airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py::test_reports_stream_send_request
airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py::test_reports_stream_send_request_backoff_exception
  /Users/lizdeika/Projects/airbyte/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_repots_streams_rate_limits.py:29: DeprecationWarning: Call to deprecated class NoAuth. (Set `authenticator=None` instead) -- Deprecated since version 0.1.20.
    authenticator=NoAuth(),

airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py: 80 warnings
  /Users/lizdeika/Projects/airbyte/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py:24: DeprecationWarning: Call to deprecated class NoAuth. (Set `authenticator=None` instead) -- Deprecated since version 0.1.20.
    authenticator=NoAuth(),

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

Results (0.77s):
      83 passed

» python -m pytest integration_tests
Test session starts (platform: darwin, Python 3.9.8, pytest 6.2.5, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Users/lizdeika/Projects/airbyte, configfile: pytest.ini
plugins: sugar-0.9.4, mock-3.6.1, timeout-1.4.2
collecting ...

Results (0.03s):                                                                                                                                                            

@alafanechere alafanechere self-assigned this Dec 30, 2021
@alafanechere alafanechere mentioned this pull request Dec 30, 2021
@alafanechere alafanechere temporarily deployed to more-secrets December 30, 2021 18:15 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets December 30, 2021 18:17 Inactive
Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

Thank @lizdeika for the fixes!
I have a stability concern with the workaround you found. Let me know what you think about my suggestions.

I confirm that acceptance tests are passing in our CI, and I regret that our sandbox account does not have enough data to be able to detect the bug you found with "real-life" data. Maybe we can share on Slack some suggestions on how we could set this up to be more robust.

# and skip the original header with next()
@staticmethod
def parse_document(document):
reader = csv.DictReader(StringIO(document), delimiter="\t", fieldnames=SellerFeedbackReports.NORMALIZED_FIELD_NAMES)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a working workaround but not 100% safe if Amazon changes the structure of the CSV file. And I'm not sure that this API has versioning that could allow us to avoid these breaking changes.

Do you think you could raise an error if the length of NORMALIZED_FIELD_NAMES is different from the number of columns in the CSV file?
Do you have access to all the localized values? It could make the normalization safer by applying a mapping between localized and normalized values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes with amazon seller partner apis there is no certainty at all :D

Agreed with error raising on column count mismatch.

But mapping values is almost impossible, values are random, are not guaranteed to be the same tomorrow and I do not have access to all possible marketplaces to get them anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alafanechere added header field count error raising on count mismatch

@alafanechere alafanechere temporarily deployed to more-secrets January 3, 2022 11:01 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets January 3, 2022 11:02 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets January 3, 2022 13:39 Inactive
@alafanechere alafanechere merged commit 82d6b16 into airbytehq:master Jan 3, 2022
@alafanechere
Copy link
Contributor

Thank you @lizdeika for the error handling and this nice fix. Just merged!

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.

5 participants