Skip to content

Commit

Permalink
🚀 Amazon SP: expand endpoint support (#4863)
Browse files Browse the repository at this point in the history
* Add GET_FBA_INVENTORY_AGED_DATA data

* Add GET_MERCHANT_LISTINGS_ALL_DATA stream support

* Update schemas

* Update configured_catalog.json

* Update connector to airbyte-cdk

* Add amazon seller partner test creds

* Update state sample files

* Apply code format

* Update acceptance-test-config.yml

* Add dummy integration test

* Refactor auth signature.
Update streams.py

* Remove print_function import from auth.py

* Refactor source class.
Add pydantic spec.
PR fixes.

* Add dummy integration test

* Typing added.
Add _create_prepared_request docstring.

* Update docs and spec

* Post merge code fixes
  • Loading branch information
htrueman authored Aug 6, 2021
1 parent 106c3cd commit ba322ac
Show file tree
Hide file tree
Showing 32 changed files with 1,009 additions and 1,131 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- name: Write Integration Test Credentials # TODO DRY this with test-command.yml
run: ./tools/bin/ci_credentials.sh
env:
AMAZON_SELLER_PARTNER_TEST_CREDS: ${{ secrets.AMAZON_SELLER_PARTNER_TEST_CREDS }}
AMPLITUDE_INTEGRATION_TEST_CREDS: ${{ secrets.AMPLITUDE_INTEGRATION_TEST_CREDS }}
ADWORDS_INTEGRATION_TEST_CREDS: ${{ secrets.ADWORDS_INTEGRATION_TEST_CREDS }}
AWS_S3_INTEGRATION_TEST_CREDS: ${{ secrets.AWS_S3_INTEGRATION_TEST_CREDS }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
- name: Write Integration Test Credentials
run: ./tools/bin/ci_credentials.sh
env:
AMAZON_SELLER_PARTNER_TEST_CREDS: ${{ secrets.AMAZON_SELLER_PARTNER_TEST_CREDS }}
AMPLITUDE_INTEGRATION_TEST_CREDS: ${{ secrets.AMPLITUDE_INTEGRATION_TEST_CREDS }}
ADWORDS_INTEGRATION_TEST_CREDS: ${{ secrets.ADWORDS_INTEGRATION_TEST_CREDS }}
AWS_S3_INTEGRATION_TEST_CREDS: ${{ secrets.AWS_S3_INTEGRATION_TEST_CREDS }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"sourceDefinitionId": "e55879a8-0ef8-4557-abcf-ab34c53ec460",
"name": "Amazon Seller Partner",
"dockerRepository": "airbyte/source-amazon-seller-partner",
"dockerImageTag": "0.1.3",
"dockerImageTag": "0.2.0",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/amazon-seller-partner"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- sourceDefinitionId: e55879a8-0ef8-4557-abcf-ab34c53ec460
name: Amazon Seller Partner
dockerRepository: airbyte/source-amazon-seller-partner
dockerImageTag: 0.1.3
dockerImageTag: 0.2.0
documentationUrl: https://docs.airbyte.io/integrations/sources/amazon-seller-partner
- sourceDefinitionId: d0243522-dccf-4978-8ba0-37ed47a0bdbf
name: Asana
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.version=0.2.0
LABEL io.airbyte.name=airbyte/source-amazon-seller-partner
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ From the Airbyte repository root, run:

#### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/amazon-seller-partner)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_amazon_seller-partner/spec.json` file.
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_amazon_seller-partner/integration_tests/spec.json` file.
Note that the `secrets` directory is gitignored by default, so there is no danger of accidentally checking in sensitive information.
See `integration_tests/sample_config.json` for a sample config file.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
# See [Source Acceptance Tests](https://docs.airbyte.io/contributing-to-airbyte/building-new-connector/source-acceptance-tests.md)
# for more information about how to configure these tests
connector_image: airbyte/source-amazon-seller-partner:dev
tests:
spec:
- spec_path: "source_amazon_seller_partner/spec.json"
# TODO Uncomment once we get credentials.
# connection:
# - config_path: "secrets/config.json"
# status: "succeed"
# - config_path: "integration_tests/invalid_config.json"
# status: "exception"
# discovery:
# - config_path: "secrets/config.json"
# basic_read:
# - config_path: "secrets/config.json"
# configured_catalog_path: "integration_tests/configured_catalog.json"
# incremental:
# - config_path: "secrets/config.json"
# configured_catalog_path: "integration_tests/configured_catalog.json"
# future_state_path: "integration_tests/abnormal_state.json"
# cursor_paths:
# Orders:
# ["LastUpdateDate"]
# GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL:
# ["purchase-date"]
# full_refresh:
# - config_path: "secrets/config.json"
# configured_catalog_path: "integration_tests/configured_catalog.json"
connection:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "failed"
discovery:
- config_path: "secrets/config.json"
basic_read:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog_no_orders.json"
empty_streams: []
incremental:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog_no_orders.json"
future_state_path: "integration_tests/abnormal_state.json"
cursor_paths:
GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL: ["createdTime"]
full_refresh:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"Orders": {
"LastUpdateDate": "2121-07-01T00:00:00Z"
},
"GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL": {
"purchase-date": "2029-07-24"
"createdTime": "2121-07-01T00:00:00Z"
},
"Orders": {
"LastUpdateDate": "2029-07-24"
"GET_MERCHANT_LISTINGS_ALL_DATA": {
"createdTime": "2121-07-01T00:00:00Z"
},
"GET_FBA_INVENTORY_AGED_DATA": {
"createdTime": "2121-07-01T00:00:00Z"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@
@pytest.fixture(scope="session", autouse=True)
def connector_setup():
""" This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup test dependencies
yield
# TODO: clean up test dependencies
Original file line number Diff line number Diff line change
@@ -1,64 +1,52 @@
{
"streams": [
{
"stream": {
"name": "Orders",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["LastUpdateDate"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["LastUpdateDate"]
},
{
"stream": {
"name": "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",
"json_schema": {
"type": "object",
"title": "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",
"description": "All orders that were placed in the specified period.",
"properties": {
"amazon-order-id": {
"type": "string",
"title": "amazon-order-id",
"description": ""
},
"merchant-order-id": {
"type": "string",
"title": "merchant-order-id",
"description": ""
},
"purchase-date": {
"type": "string",
"title": "purchase-date",
"description": ""
}
}
},
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["purchase-date"]
"default_cursor_field": ["createdTime"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"cursor_field": ["purchase-date"]
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["createdTime"]
},
{
"stream": {
"name": "Orders",
"json_schema": {
"type": "object",
"title": "Orders",
"description": "All orders that were updated after a specified date",
"properties": {
"AmazonOrderId": {
"type": ["null", "string"]
},
"PurchaseDate": {
"type": ["null", "string"]
},
"LastUpdateDate": {
"type": ["null", "string"]
}
}
},
"name": "GET_MERCHANT_LISTINGS_ALL_DATA",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["LastUpdateDate"]
"default_cursor_field": ["createdTime"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"cursor_field": ["LastUpdateDate"]
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["createdTime"]
},
{
"stream": {
"name": "GET_FBA_INVENTORY_AGED_DATA",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["createdTime"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["createdTime"]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"streams": [
{
"stream": {
"name": "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["createdTime"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["createdTime"]
},
{
"stream": {
"name": "GET_MERCHANT_LISTINGS_ALL_DATA",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["createdTime"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["createdTime"]
},
{
"stream": {
"name": "GET_FBA_INVENTORY_AGED_DATA",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["createdTime"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["createdTime"]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"start_date": "2021-05-27",
"replication_start_date": "2021-07-01T00:00:00Z",
"refresh_token": "ABC",
"lwa_app_id": "lwa_app_id",
"lwa_client_secret": "lwa_client_secret",
"aws_access_key": "aws_access_key",
"aws_secret_key": "aws_secret_key",
"role_arn": "role_arn",
"marketplace": "marketplace"
"aws_environment": "PRODUCTION",
"region": "US"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"replication_start_date": "2021-07-01T00:00:00Z",
"refresh_token": "<refresh_token>",
"lwa_app_id": "<lwa_app_id>",
"lwa_client_secret": "<lwa_client_secret>",
"aws_access_key": "<aws_access_key>",
"aws_secret_key": "<aws_secret_key>",
"role_arn": "<role_arn>",
"aws_environment": "<PRODUCTION or SANDBOX>",
"region": "US"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Orders": {
"LastUpdateDate": "2021-07-01T00:00:00Z"
},
"GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL": {
"createdTime": "2021-07-01T00:00:00Z"
},
"GET_MERCHANT_LISTINGS_ALL_DATA": {
"createdTime": "2021-07-01T00:00:00Z"
},
"GET_FBA_INVENTORY_AGED_DATA": {
"createdTime": "2021-07-01T00:00:00Z"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from setuptools import find_packages, setup

MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "python-amazon-sp-api", "pendulum"]
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "boto3~=1.16", "pendulum~=2.1"]

TEST_REQUIREMENTS = [
"pytest~=6.1",
Expand Down
Loading

0 comments on commit ba322ac

Please sign in to comment.