diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/spec_oss.json b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/spec_oss.json index 7881ec5c2b2f0..46da9aef832bf 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/spec_oss.json +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/spec_oss.json @@ -122,10 +122,10 @@ "items": { "type": "object", "title": "Report Options", - "required": ["stream_name", "options_list"], + "required": ["report_name", "stream_name", "options_list"], "properties": { - "stream_name": { - "title": "Stream Name", + "report_name": { + "title": "Report Name", "type": "string", "order": 0, "enum": [ @@ -165,6 +165,7 @@ "GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE", "GET_XML_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL", "GET_XML_BROWSE_TREE_DATA", + "GET_VENDOR_REAL_TIME_INVENTORY_REPORT", "GET_BRAND_ANALYTICS_MARKET_BASKET_REPORT", "GET_BRAND_ANALYTICS_SEARCH_TERMS_REPORT", "GET_BRAND_ANALYTICS_REPEAT_PURCHASE_REPORT", @@ -175,10 +176,16 @@ "GET_VENDOR_TRAFFIC_REPORT" ] }, + "stream_name": { + "title": "Stream Name", + "type": "string", + "order": 1 + }, "options_list": { "title": "List of options", "description": "List of options", "type": "array", + "order": 2, "items": { "type": "object", "required": ["option_name", "option_value"], diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml b/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml index e4e23c9073db2..8a010e41781e1 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml @@ -15,7 +15,7 @@ data: connectorSubtype: api connectorType: source definitionId: e55879a8-0ef8-4557-abcf-ab34c53ec460 - dockerImageTag: 4.2.4 + dockerImageTag: 4.3.0 dockerRepository: airbyte/source-amazon-seller-partner documentationUrl: https://docs.airbyte.com/integrations/sources/amazon-seller-partner githubIssueLabel: source-amazon-seller-partner diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/pyproject.toml b/airbyte-integrations/connectors/source-amazon-seller-partner/pyproject.toml index e816c93c0c74c..e3942b12a0695 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/pyproject.toml +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/pyproject.toml @@ -3,7 +3,7 @@ requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry] -version = "4.2.4" +version = "4.3.0" name = "source-amazon-seller-partner" description = "Source implementation for Amazon Seller Partner." authors = ["Airbyte "] diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/config_migrations.py b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/config_migrations.py index 0267e3af07a16..39a7055af1b7a 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/config_migrations.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/config_migrations.py @@ -1,8 +1,7 @@ # # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # - - +import abc import json import logging from typing import Any, List, Mapping @@ -16,38 +15,23 @@ logger = logging.getLogger("airbyte_logger") -class MigrateAccountType: - """ - This class stands for migrating the config at runtime, - while providing the backward compatibility when falling back to the previous source version. - - Specifically, starting from `2.0.1`, the `account_type` property becomes required. - For those connector configs that do not contain this key, the default value of `Seller` will be used. - Reverse operation is not needed as this field is ignored in previous versions of the connector. - """ - +class Migration: message_repository: MessageRepository = InMemoryMessageRepository() - migration_key: str = "account_type" @classmethod - def _should_migrate(cls, config: Mapping[str, Any]) -> bool: - """ - This method determines whether config requires migration. - Returns: - > True, if the transformation is necessary - > False, otherwise. - """ - return cls.migration_key not in config + @abc.abstractmethod + def _transform(cls, config: Mapping[str, Any]): + pass @classmethod - def _populate_with_default_value(cls, config: Mapping[str, Any], source: SourceAmazonSellerPartner = None) -> Mapping[str, Any]: - config[cls.migration_key] = "Seller" - return config + @abc.abstractmethod + def _should_migrate(cls, config: Mapping[str, Any]): + pass @classmethod def _modify_and_save(cls, config_path: str, source: SourceAmazonSellerPartner, config: Mapping[str, Any]) -> Mapping[str, Any]: # modify the config - migrated_config = cls._populate_with_default_value(config, source) + migrated_config = cls._transform(config) # save the config source.write_config(migrated_config, config_path) # return modified config @@ -78,7 +62,35 @@ def migrate(cls, args: List[str], source: SourceAmazonSellerPartner) -> None: cls._emit_control_message(cls._modify_and_save(config_path, source, config)) -class MigrateReportOptions: +class MigrateAccountType(Migration): + """ + This class stands for migrating the config at runtime, + while providing the backward compatibility when falling back to the previous source version. + + Specifically, starting from `2.0.1`, the `account_type` property becomes required. + For those connector configs that do not contain this key, the default value of `Seller` will be used. + Reverse operation is not needed as this field is ignored in previous versions of the connector. + """ + + migration_key: str = "account_type" + + @classmethod + def _should_migrate(cls, config: Mapping[str, Any]) -> bool: + """ + This method determines whether config requires migration. + Returns: + > True, if the transformation is necessary + > False, otherwise. + """ + return cls.migration_key not in config + + @classmethod + def _transform(cls, config: Mapping[str, Any]) -> Mapping[str, Any]: + config[cls.migration_key] = "Seller" + return config + + +class MigrateReportOptions(Migration): """ This class stands for migrating the config at runtime, while providing the backward compatibility when falling back to the previous source version. @@ -88,7 +100,6 @@ class MigrateReportOptions: Reverse operation is not needed as this field is ignored in previous versions of the connector. """ - message_repository: MessageRepository = InMemoryMessageRepository() migration_key: str = "report_options_list" @classmethod @@ -102,7 +113,7 @@ def _should_migrate(cls, config: Mapping[str, Any]) -> bool: return cls.migration_key not in config and (config.get("report_options") or config.get("advanced_stream_options")) @classmethod - def _transform_report_options(cls, config: Mapping[str, Any]) -> Mapping[str, Any]: + def _transform(cls, config: Mapping[str, Any]) -> Mapping[str, Any]: try: report_options = json.loads(config.get("report_options", "{}") or "{}") except json.JSONDecodeError: @@ -116,35 +127,42 @@ def _transform_report_options(cls, config: Mapping[str, Any]) -> Mapping[str, An config[cls.migration_key] = report_options_list return config - @classmethod - def _modify_and_save(cls, config_path: str, source: SourceAmazonSellerPartner, config: Mapping[str, Any]) -> Mapping[str, Any]: - # modify the config - migrated_config = cls._transform_report_options(config) - # save the config - source.write_config(migrated_config, config_path) - # return modified config - return migrated_config - @classmethod - def _emit_control_message(cls, migrated_config: Mapping[str, Any]) -> None: - # add the Airbyte Control Message to message repo - cls.message_repository.emit_message(create_connector_config_control_message(migrated_config)) - # emit the Airbyte Control Message from message queue to stdout - for message in cls.message_repository.consume_queue(): - print(message.json(exclude_unset=True)) +class MigrateStreamNameOption(Migration): + """ + This class stands for migrating the config at runtime, + while providing the backward compatibility when falling back to the previous source version. + + Specifically, starting from `4.3.0`, the `report_options_list` property holds a list of objects, + each of which now is required to have a `stream_name` property. + For those connector configs that do not contain this key, the default value of will be used. + Reverse operation is not needed as this field is ignored in previous versions of the connector. + """ @classmethod - def migrate(cls, args: List[str], source: SourceAmazonSellerPartner) -> None: + def _should_migrate(cls, config: Mapping[str, Any]) -> bool: """ - This method checks the input args, should the config be migrated, - transform if necessary and emit the CONTROL message. + This method determines whether config requires migration. + Returns: + > True, if the transformation is necessary + > False, otherwise. """ - # get config path - config_path = AirbyteEntrypoint(source).extract_config(args) - # proceed only if `--config` arg is provided - if config_path: - # read the existing config - config = source.read_config(config_path) - # migration check - if cls._should_migrate(config): - cls._emit_control_message(cls._modify_and_save(config_path, source, config)) + if "report_options_list" not in config: + return False + + options_list = config["report_options_list"] + for options in options_list: + if "report_name" not in options: + return True + return False + + @classmethod + def _transform(cls, config: Mapping[str, Any]) -> Mapping[str, Any]: + report_options_list = [] + for report_options in config["report_options_list"]: + if "report_name" not in report_options: + report_options["report_name"] = report_options["stream_name"] + report_options_list.append(report_options) + + config["report_options_list"] = report_options_list + return config diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/run.py b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/run.py index 538cf70c8afcd..19ac2cd5d317b 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/run.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/run.py @@ -7,11 +7,12 @@ from airbyte_cdk.entrypoint import launch from source_amazon_seller_partner import SourceAmazonSellerPartner -from source_amazon_seller_partner.config_migrations import MigrateAccountType, MigrateReportOptions +from source_amazon_seller_partner.config_migrations import MigrateAccountType, MigrateReportOptions, MigrateStreamNameOption def run(): source = SourceAmazonSellerPartner() MigrateAccountType.migrate(sys.argv[1:], source) MigrateReportOptions.migrate(sys.argv[1:], source) + MigrateStreamNameOption.migrate(sys.argv[1:], source) launch(source, sys.argv[1:]) diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py index 7e539b83d9fd6..71db74c629f7f 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py @@ -57,6 +57,7 @@ OrderReportDataShipping, Orders, RapidRetailAnalyticsInventoryReport, + ReportsAmazonSPStream, RestockInventoryReports, SellerAnalyticsSalesAndTrafficReports, SellerFeedbackReports, @@ -205,7 +206,15 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: stream_list += brand_analytics_reports for stream in stream_list: - streams.append(stream(**stream_kwargs, report_options=self.get_stream_report_options_list(stream.name, config))) + if not issubclass(stream, ReportsAmazonSPStream): + streams.append(stream(**stream_kwargs)) + continue + report_kwargs = list(self.get_stream_report_kwargs(stream.report_name, config)) + if not report_kwargs: + report_kwargs.append((stream.report_name, {})) + for name, options in report_kwargs: + kwargs = {"stream_name": name, "report_options": options, **stream_kwargs} + streams.append(stream(**kwargs)) return streams def spec(self, logger: Logger) -> ConnectorSpecification: @@ -221,7 +230,7 @@ def spec(self, logger: Logger) -> ConnectorSpecification: "GET_VENDOR_NET_PURE_PRODUCT_MARGIN_REPORT", "GET_VENDOR_TRAFFIC_REPORT", ] - spec.connectionSpecification["properties"]["report_options_list"]["items"]["properties"]["stream_name"]["enum"].extend( + spec.connectionSpecification["properties"]["report_options_list"]["items"]["properties"]["report_name"]["enum"].extend( oss_only_streams ) @@ -238,19 +247,21 @@ def validate_replication_dates(config: Mapping[str, Any]) -> None: @staticmethod def validate_stream_report_options(config: Mapping[str, Any]) -> None: - if len([x.get("stream_name") for x in config.get("report_options_list", [])]) != len( - set(x.get("stream_name") for x in config.get("report_options_list", [])) - ): + options_list = config.get("report_options_list", []) + stream_names = [x.get("stream_name") for x in options_list] + if len(stream_names) != len(set(stream_names)): raise AmazonConfigException(message="Stream name should be unique among all Report options list") - for stream_report_option in config.get("report_options_list", []): - if len([x.get("option_name") for x in stream_report_option.get("options_list")]) != len( - set(x.get("option_name") for x in stream_report_option.get("options_list")) - ): + + for report_option in options_list: + option_names = [x.get("option_name") for x in report_option.get("options_list")] + if len(option_names) != len(set(option_names)): raise AmazonConfigException( - message=f"Option names should be unique for `{stream_report_option.get('stream_name')}` report options" + message=f"Option names should be unique for `{report_option.get('stream_name')}` report options" ) @staticmethod - def get_stream_report_options_list(report_name: str, config: Mapping[str, Any]) -> Optional[List[Mapping[str, Any]]]: - if any(x for x in config.get("report_options_list", []) if x.get("stream_name") == report_name): - return [x.get("options_list") for x in config.get("report_options_list") if x.get("stream_name") == report_name][0] + def get_stream_report_kwargs(report_name: str, config: Mapping[str, Any]) -> List[Tuple[str, Optional[List[Mapping[str, Any]]]]]: + options_list = config.get("report_options_list", []) + for x in options_list: + if x.get("report_name") == report_name: + yield x.get("stream_name"), x.get("options_list") diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/spec.json b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/spec.json index 8fec987e88593..01a8e84956aa9 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/spec.json +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/spec.json @@ -122,10 +122,10 @@ "items": { "type": "object", "title": "Report Options", - "required": ["stream_name", "options_list"], + "required": ["report_name", "stream_name", "options_list"], "properties": { - "stream_name": { - "title": "Stream Name", + "report_name": { + "title": "Report Name", "type": "string", "order": 0, "enum": [ @@ -164,13 +164,20 @@ "GET_STRANDED_INVENTORY_UI_DATA", "GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE", "GET_XML_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL", - "GET_XML_BROWSE_TREE_DATA" + "GET_XML_BROWSE_TREE_DATA", + "GET_VENDOR_REAL_TIME_INVENTORY_REPORT" ] }, + "stream_name": { + "title": "Stream Name", + "type": "string", + "order": 1 + }, "options_list": { "title": "List of options", "description": "List of options", "type": "array", + "order": 2, "items": { "type": "object", "required": ["option_name", "option_value"], diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py index 8d509fe100bd8..30f5cd2fcb491 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py @@ -1,8 +1,6 @@ # # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # - - import csv import gzip import json @@ -11,6 +9,7 @@ import time from abc import ABC, abstractmethod from enum import Enum +from functools import lru_cache from io import StringIO from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional, Union @@ -20,9 +19,11 @@ import xmltodict from airbyte_cdk.entrypoint import logger from airbyte_cdk.models import SyncMode +from airbyte_cdk.sources.streams.core import package_name_from_class from airbyte_cdk.sources.streams.http import HttpStream from airbyte_cdk.sources.streams.http.exceptions import DefaultBackoffException from airbyte_cdk.sources.streams.http.rate_limiting import default_backoff_handler +from airbyte_cdk.sources.utils.schema_helpers import ResourceSchemaLoader from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer from airbyte_cdk.utils.traced_exception import AirbyteTracedException @@ -186,12 +187,14 @@ class ReportsAmazonSPStream(HttpStream, ABC): # https://developer-docs.amazon.com/sp-api/docs/report-type-values#vendor-retail-analytics-reports availability_sla_days = 1 availability_strategy = None + report_name = None def __init__( self, url_base: str, replication_start_date: str, marketplace_id: str, + stream_name: str, period_in_days: Optional[int], replication_end_date: Optional[str], report_options: Optional[List[Mapping[str, Any]]] = None, @@ -206,6 +209,15 @@ def __init__( self.period_in_days = max(period_in_days, self.replication_start_date_limit_in_days) # ensure old configs work self._report_options = report_options self._http_method = "GET" + self._stream_name = stream_name + + @property + def name(self): + return self._stream_name + + @lru_cache(maxsize=None) + def get_json_schema(self) -> Mapping[str, Any]: + return ResourceSchemaLoader(package_name_from_class(self.__class__)).get_schema(self.report_name) def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: return None @@ -468,7 +480,7 @@ def transform_function(original_value: Any, field_schema: Dict[str, Any]) -> Any class MerchantListingsReports(MerchantReports): - name = "GET_MERCHANT_LISTINGS_ALL_DATA" + report_name = "GET_MERCHANT_LISTINGS_ALL_DATA" primary_key = "listing-id" @@ -477,7 +489,7 @@ class FlatFileOrdersReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/gp/help/help.html?itemID=201648780 """ - name = "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL" + report_name = "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL" primary_key = "amazon-order-id" cursor_field = "last-updated-date" @@ -487,7 +499,7 @@ class FbaStorageFeesReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/help/hub/reference/G202086720 """ - name = "GET_FBA_STORAGE_FEE_CHARGES_DATA" + report_name = "GET_FBA_STORAGE_FEE_CHARGES_DATA" class FulfilledShipmentsReports(IncrementalReportsAmazonSPStream): @@ -495,7 +507,7 @@ class FulfilledShipmentsReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/gp/help/help.html?itemID=200453120 """ - name = "GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL" + report_name = "GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL" # You can request up to one month of data in a single report # https://developer-docs.amazon.com/sp-api/docs/report-type-values-fba#fba-sales-reports @@ -503,7 +515,7 @@ class FulfilledShipmentsReports(IncrementalReportsAmazonSPStream): class FlatFileOpenListingsReports(IncrementalReportsAmazonSPStream): - name = "GET_FLAT_FILE_OPEN_LISTINGS_DATA" + report_name = "GET_FLAT_FILE_OPEN_LISTINGS_DATA" class FbaOrdersReports(IncrementalReportsAmazonSPStream): @@ -511,7 +523,7 @@ class FbaOrdersReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/gp/help/help.html?itemID=200989110 """ - name = "GET_FBA_FULFILLMENT_REMOVAL_ORDER_DETAIL_DATA" + report_name = "GET_FBA_FULFILLMENT_REMOVAL_ORDER_DETAIL_DATA" cursor_field = "last-updated-date" @@ -521,7 +533,7 @@ class FlatFileActionableOrderDataShipping(IncrementalReportsAmazonSPStream): https://developer-docs.amazon.com/sp-api/docs/order-reports-attributes#get_flat_file_actionable_order_data_shipping """ - name = "GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING" + report_name = "GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING" class OrderReportDataShipping(IncrementalReportsAmazonSPStream): @@ -530,7 +542,7 @@ class OrderReportDataShipping(IncrementalReportsAmazonSPStream): https://developer-docs.amazon.com/sp-api/docs/order-reports-attributes#get_order_report_data_shipping """ - name = "GET_ORDER_REPORT_DATA_SHIPPING" + report_name = "GET_ORDER_REPORT_DATA_SHIPPING" def parse_document(self, document): try: @@ -552,7 +564,7 @@ class FbaShipmentsReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/gp/help/help.html?itemID=200989100 """ - name = "GET_FBA_FULFILLMENT_REMOVAL_SHIPMENT_DETAIL_DATA" + report_name = "GET_FBA_FULFILLMENT_REMOVAL_SHIPMENT_DETAIL_DATA" class FbaReplacementsReports(IncrementalReportsAmazonSPStream): @@ -560,7 +572,7 @@ class FbaReplacementsReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/help/hub/reference/200453300 """ - name = "GET_FBA_FULFILLMENT_CUSTOMER_SHIPMENT_REPLACEMENT_DATA" + report_name = "GET_FBA_FULFILLMENT_CUSTOMER_SHIPMENT_REPLACEMENT_DATA" class RestockInventoryReports(IncrementalReportsAmazonSPStream): @@ -568,7 +580,7 @@ class RestockInventoryReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/help/hub/reference/202105670 """ - name = "GET_RESTOCK_INVENTORY_RECOMMENDATIONS_REPORT" + report_name = "GET_RESTOCK_INVENTORY_RECOMMENDATIONS_REPORT" class GetXmlBrowseTreeData(IncrementalReportsAmazonSPStream): @@ -587,38 +599,38 @@ def parse_document(self, document): return parsed.get("Result", {}).get("Node", []) - name = "GET_XML_BROWSE_TREE_DATA" + report_name = "GET_XML_BROWSE_TREE_DATA" primary_key = "browseNodeId" class FbaEstimatedFbaFeesTxtReport(IncrementalReportsAmazonSPStream): - name = "GET_FBA_ESTIMATED_FBA_FEES_TXT_DATA" + report_name = "GET_FBA_ESTIMATED_FBA_FEES_TXT_DATA" class FbaFulfillmentCustomerShipmentPromotionReport(IncrementalReportsAmazonSPStream): - name = "GET_FBA_FULFILLMENT_CUSTOMER_SHIPMENT_PROMOTION_DATA" + report_name = "GET_FBA_FULFILLMENT_CUSTOMER_SHIPMENT_PROMOTION_DATA" class FbaMyiUnsuppressedInventoryReport(IncrementalReportsAmazonSPStream): - name = "GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA" + report_name = "GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA" class MerchantListingsReport(MerchantReports): - name = "GET_MERCHANT_LISTINGS_DATA" + report_name = "GET_MERCHANT_LISTINGS_DATA" primary_key = "listing-id" class MerchantListingsInactiveData(MerchantReports): - name = "GET_MERCHANT_LISTINGS_INACTIVE_DATA" + report_name = "GET_MERCHANT_LISTINGS_INACTIVE_DATA" primary_key = "listing-id" class StrandedInventoryUiReport(IncrementalReportsAmazonSPStream): - name = "GET_STRANDED_INVENTORY_UI_DATA" + report_name = "GET_STRANDED_INVENTORY_UI_DATA" class XmlAllOrdersDataByOrderDataGeneral(IncrementalReportsAmazonSPStream): - name = "GET_XML_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL" + report_name = "GET_XML_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL" primary_key = "AmazonOrderID" cursor_field = "LastUpdatedDate" @@ -639,16 +651,16 @@ def parse_document(self, document): class MerchantListingsReportBackCompat(MerchantReports): - name = "GET_MERCHANT_LISTINGS_DATA_BACK_COMPAT" + report_name = "GET_MERCHANT_LISTINGS_DATA_BACK_COMPAT" primary_key = "listing-id" class MerchantCancelledListingsReport(IncrementalReportsAmazonSPStream): - name = "GET_MERCHANT_CANCELLED_LISTINGS_DATA" + report_name = "GET_MERCHANT_CANCELLED_LISTINGS_DATA" class MerchantListingsFypReport(IncrementalReportsAmazonSPStream): - name = "GET_MERCHANTS_LISTINGS_FYP_REPORT" + report_name = "GET_MERCHANTS_LISTINGS_FYP_REPORT" transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization) def __init__(self, *args, **kwargs): @@ -670,20 +682,20 @@ def transform_function(original_value: Any, field_schema: Dict[str, Any]) -> Any class FbaSnsForecastReport(IncrementalReportsAmazonSPStream): - name = "GET_FBA_SNS_FORECAST_DATA" + report_name = "GET_FBA_SNS_FORECAST_DATA" class FbaSnsPerformanceReport(IncrementalReportsAmazonSPStream): - name = "GET_FBA_SNS_PERFORMANCE_DATA" + report_name = "GET_FBA_SNS_PERFORMANCE_DATA" class FlatFileArchivedOrdersDataByOrderDate(IncrementalReportsAmazonSPStream): - name = "GET_FLAT_FILE_ARCHIVED_ORDERS_DATA_BY_ORDER_DATE" + report_name = "GET_FLAT_FILE_ARCHIVED_ORDERS_DATA_BY_ORDER_DATE" cursor_field = "last-updated-date" class FlatFileReturnsDataByReturnDate(IncrementalReportsAmazonSPStream): - name = "GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE" + report_name = "GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE" # You can request up to 60 days of data in a single report # https://developer-docs.amazon.com/sp-api/docs/report-type-values-returns @@ -691,7 +703,7 @@ class FlatFileReturnsDataByReturnDate(IncrementalReportsAmazonSPStream): class FbaInventoryPlaningReport(IncrementalReportsAmazonSPStream): - name = "GET_FBA_INVENTORY_PLANNING_DATA" + report_name = "GET_FBA_INVENTORY_PLANNING_DATA" class AnalyticsStream(ReportsAmazonSPStream): @@ -811,18 +823,18 @@ def stream_slices( class NetPureProductMarginReport(IncrementalAnalyticsStream): - name = "GET_VENDOR_NET_PURE_PRODUCT_MARGIN_REPORT" + report_name = "GET_VENDOR_NET_PURE_PRODUCT_MARGIN_REPORT" result_key = "netPureProductMarginByAsin" class RapidRetailAnalyticsInventoryReport(IncrementalAnalyticsStream): - name = "GET_VENDOR_REAL_TIME_INVENTORY_REPORT" + report_name = "GET_VENDOR_REAL_TIME_INVENTORY_REPORT" result_key = "reportData" cursor_field = "endTime" class BrandAnalyticsMarketBasketReports(IncrementalAnalyticsStream): - name = "GET_BRAND_ANALYTICS_MARKET_BASKET_REPORT" + report_name = "GET_BRAND_ANALYTICS_MARKET_BASKET_REPORT" result_key = "dataByAsin" @@ -831,13 +843,13 @@ class BrandAnalyticsSearchTermsReports(IncrementalAnalyticsStream): Field definitions: https://sellercentral.amazon.co.uk/help/hub/reference/G5NXWNY8HUD3VDCW """ - name = "GET_BRAND_ANALYTICS_SEARCH_TERMS_REPORT" + report_name = "GET_BRAND_ANALYTICS_SEARCH_TERMS_REPORT" result_key = "dataByDepartmentAndSearchTerm" cursor_field = "queryEndDate" class BrandAnalyticsRepeatPurchaseReports(IncrementalAnalyticsStream): - name = "GET_BRAND_ANALYTICS_REPEAT_PURCHASE_REPORT" + report_name = "GET_BRAND_ANALYTICS_REPEAT_PURCHASE_REPORT" result_key = "dataByAsin" @@ -846,13 +858,13 @@ class VendorInventoryReports(IncrementalAnalyticsStream): Field definitions: https://developer-docs.amazon.com/sp-api/docs/report-type-values#vendor-retail-analytics-reports """ - name = "GET_VENDOR_INVENTORY_REPORT" + report_name = "GET_VENDOR_INVENTORY_REPORT" result_key = "inventoryByAsin" availability_sla_days = 3 class VendorTrafficReport(IncrementalAnalyticsStream): - name = "GET_VENDOR_TRAFFIC_REPORT" + report_name = "GET_VENDOR_TRAFFIC_REPORT" result_key = "trafficByAsin" availability_sla_days = 3 fixed_period_in_days = 1 @@ -863,14 +875,14 @@ class SellerAnalyticsSalesAndTrafficReports(IncrementalAnalyticsStream): Field definitions: https://developer-docs.amazon.com/sp-api/docs/report-type-values#seller-retail-analytics-reports """ - name = "GET_SALES_AND_TRAFFIC_REPORT" + report_name = "GET_SALES_AND_TRAFFIC_REPORT" result_key = "salesAndTrafficByAsin" cursor_field = "queryEndDate" fixed_period_in_days = 1 class VendorSalesReports(IncrementalAnalyticsStream): - name = "GET_VENDOR_SALES_REPORT" + report_name = "GET_VENDOR_SALES_REPORT" result_key = "salesByAsin" availability_sla_days = 4 # Data is only available after 4 days @@ -883,16 +895,13 @@ class VendorForecastingReport(AnalyticsStream, ABC): """ result_key = "forecastByAsin" + report_name = None @property @abstractmethod def selling_program(self) -> str: pass - @property - def name(self) -> str: - return f"GET_VENDOR_FORECASTING_{self.selling_program}_REPORT" - def stream_slices( self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None ) -> Iterable[Optional[Mapping[str, Any]]]: @@ -914,10 +923,12 @@ def _report_data( class VendorForecastingFreshReport(VendorForecastingReport): + report_name = "GET_VENDOR_FORECASTING_FRESH_REPORT" selling_program = "FRESH" class VendorForecastingRetailReport(VendorForecastingReport): + report_name = "GET_VENDOR_FORECASTING_RETAIL_REPORT" selling_program = "RETAIL" @@ -957,7 +968,7 @@ class SellerFeedbackReports(IncrementalReportsAmazonSPStream): NORMALIZED_FIELD_NAMES = ["date", "rating", "comments", "response", "order_id", "rater_email"] - name = "GET_SELLER_FEEDBACK_DATA" + report_name = "GET_SELLER_FEEDBACK_DATA" cursor_field = "date" transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization) @@ -1001,7 +1012,7 @@ class FbaAfnInventoryReports(IncrementalReportsAmazonSPStream): https://github.com/amzn/selling-partner-api-docs/issues/2231 """ - name = "GET_AFN_INVENTORY_DATA" + report_name = "GET_AFN_INVENTORY_DATA" class FbaAfnInventoryByCountryReports(IncrementalReportsAmazonSPStream): @@ -1011,7 +1022,7 @@ class FbaAfnInventoryByCountryReports(IncrementalReportsAmazonSPStream): https://github.com/amzn/selling-partner-api-docs/issues/2231 """ - name = "GET_AFN_INVENTORY_DATA_BY_COUNTRY" + report_name = "GET_AFN_INVENTORY_DATA_BY_COUNTRY" class FlatFileOrdersReportsByLastUpdate(IncrementalReportsAmazonSPStream): @@ -1019,7 +1030,7 @@ class FlatFileOrdersReportsByLastUpdate(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/gp/help/help.html?itemID=201648780 """ - name = "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_GENERAL" + report_name = "GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_GENERAL" primary_key = "amazon-order-id" cursor_field = "last-updated-date" replication_start_date_limit_in_days = 30 @@ -1145,7 +1156,7 @@ class LedgerDetailedViewReports(IncrementalReportsAmazonSPStream): API docs: https://developer-docs.amazon.com/sp-api/docs/report-type-values """ - name = "GET_LEDGER_DETAIL_VIEW_DATA" + report_name = "GET_LEDGER_DETAIL_VIEW_DATA" cursor_field = "Date" transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization) @@ -1169,7 +1180,7 @@ def transform_function(original_value: str, field_schema: Dict[str, Any]) -> str class LedgerSummaryViewReport(LedgerDetailedViewReports): - name = "GET_LEDGER_SUMMARY_VIEW_DATA" + report_name = "GET_LEDGER_SUMMARY_VIEW_DATA" class VendorFulfillment(IncrementalAmazonSPStream, ABC): @@ -1388,11 +1399,11 @@ def parse_response( class FbaCustomerReturnsReports(IncrementalReportsAmazonSPStream): - name = "GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA" + report_name = "GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA" class FlatFileSettlementV2Reports(IncrementalReportsAmazonSPStream): - name = "GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE" + report_name = "GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE" transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization) def __init__(self, *args, **kwargs): @@ -1478,4 +1489,4 @@ class FbaReimbursementsReports(IncrementalReportsAmazonSPStream): Field definitions: https://sellercentral.amazon.com/help/hub/reference/G200732720 """ - name = "GET_FBA_REIMBURSEMENTS_DATA" + report_name = "GET_FBA_REIMBURSEMENTS_DATA" diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/conftest.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/conftest.py index 88ae651494b9f..12579417383da 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/conftest.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/conftest.py @@ -12,7 +12,7 @@ @pytest.fixture -def report_init_kwargs() -> Dict[str, Any]: +def init_kwargs() -> Dict[str, Any]: return { "url_base": "https://test.url", "replication_start_date": "2022-09-01T00:00:00Z", @@ -23,6 +23,14 @@ def report_init_kwargs() -> Dict[str, Any]: } +@pytest.fixture +def report_init_kwargs(init_kwargs) -> Dict[str, Any]: + return { + "stream_name": "GET_TEST_REPORT", + **init_kwargs + } + + @pytest.fixture def http_mocker() -> None: """This fixture is needed to pass http_mocker parameter from the @HttpMocker decorator to a test""" diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_analytics_streams.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_analytics_streams.py index ee69ee4ccd309..164f63d92d2a1 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_analytics_streams.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_analytics_streams.py @@ -12,13 +12,13 @@ class SomeAnalyticsStream(AnalyticsStream): - name = "GET_ANALYTICS_STREAM" + report_name = "GET_ANALYTICS_STREAM" result_key = "result_key" availability_sla_days = 3 class SomeIncrementalAnalyticsStream(IncrementalAnalyticsStream): - name = "GET_INCREMENTAL_ANALYTICS_STREAM" + report_name = "GET_INCREMENTAL_ANALYTICS_STREAM" result_key = "result_key" availability_sla_days = 3 cursor_field = "endDate" diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_finance_streams.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_finance_streams.py index 1d3ad8b7cb4f9..41496a800606e 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_finance_streams.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_finance_streams.py @@ -209,6 +209,7 @@ def test_reports_read_records_exit_on_backoff(mocker, requests_mock, caplog): requests_mock.post("https://test.url/reports/2021-06-30/reports", status_code=429) stream = RestockInventoryReports( + stream_name="GET_RESTOCK_INVENTORY_RECOMMENDATIONS_REPORT", url_base="https://test.url", replication_start_date=START_DATE_1, replication_end_date=END_DATE_1, diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations.py index 1421de0b1f3d2..058dfc514d779 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations.py @@ -9,7 +9,7 @@ import pytest from airbyte_cdk.models import OrchestratorType, Type from airbyte_cdk.sources import Source -from source_amazon_seller_partner.config_migrations import MigrateAccountType, MigrateReportOptions +from source_amazon_seller_partner.config_migrations import MigrateAccountType, MigrateReportOptions, MigrateStreamNameOption from source_amazon_seller_partner.source import SourceAmazonSellerPartner CMD = "check" @@ -61,7 +61,7 @@ class TestMigrateReportOptions: ) def test_transform_report_options(self, input_config, expected_report_options_list): expected_config = {**input_config, "report_options_list": expected_report_options_list} - assert MigrateReportOptions._transform_report_options(input_config) == expected_config + assert MigrateReportOptions._transform(input_config) == expected_config def test_migrate_config(self, capsys): config = load_config(self.test_not_migrated_config_path) @@ -82,3 +82,29 @@ def test_should_not_migrate(self): assert config["report_options_list"] migration_instance = MigrateReportOptions() assert not migration_instance._should_migrate(config) + + +class TestMigrateStreamNameOption: + test_not_migrated_config_path = "unit_tests/test_migrations/stream_name_option_migration/not_migrated_config.json" + test_migrated_config_path = "unit_tests/test_migrations/stream_name_option_migration/migrated_config.json" + + def test_migrate_config(self, capsys): + config = load_config(self.test_not_migrated_config_path) + for options_list in config["report_options_list"]: + assert "report_name" not in options_list + + migration_instance = MigrateStreamNameOption() + migration_instance.migrate([CMD, "--config", self.test_not_migrated_config_path], SOURCE) + control_msg = json.loads(capsys.readouterr().out) + assert control_msg["type"] == Type.CONTROL.value + assert control_msg["control"]["type"] == OrchestratorType.CONNECTOR_CONFIG.value + migrated_config = control_msg["control"]["connectorConfig"]["config"] + for options_list in migrated_config["report_options_list"]: + assert options_list["report_name"] == options_list["stream_name"] + + def test_should_not_migrate(self): + config = load_config(self.test_migrated_config_path) + migration_instance = MigrateStreamNameOption() + assert not migration_instance._should_migrate(config) + for options_list in config["report_options_list"]: + assert options_list["stream_name"] diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations/stream_name_option_migration/migrated_config.json b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations/stream_name_option_migration/migrated_config.json new file mode 100644 index 0000000000000..275bd8009e451 --- /dev/null +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations/stream_name_option_migration/migrated_config.json @@ -0,0 +1,20 @@ +{ + "refresh_token": "refresh_token", + "lwa_app_id": "amzn1.application-oa2-client.lwa_app_id", + "lwa_client_secret": "amzn1.oa2-cs.v1.lwa_client_secret", + "replication_start_date": "2022-09-01T00:00:00Z", + "aws_environment": "PRODUCTION", + "region": "US", + "report_options_list": [ + { + "report_name": "GET_REPORT", + "stream_name": "GET_REPORT", + "options_list": [ + { + "option_name": "reportPeriod", + "option_value": "WEEK" + } + ] + } + ] +} diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations/stream_name_option_migration/not_migrated_config.json b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations/stream_name_option_migration/not_migrated_config.json new file mode 100644 index 0000000000000..32d890958eae0 --- /dev/null +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_migrations/stream_name_option_migration/not_migrated_config.json @@ -0,0 +1,16 @@ +{ + "refresh_token": "refresh_token", + "lwa_app_id": "amzn1.application-oa2-client.lwa_app_id", + "lwa_client_secret": "amzn1.oa2-cs.v1.lwa_client_secret", + "replication_start_date": "2022-09-01T00:00:00Z", + "aws_environment": "PRODUCTION", + "region": "US", + "report_options_list": [ + { + "stream_name": "GET_REPORT", + "options_list": [ + { "option_name": "reportPeriod", "option_value": "WEEK" } + ] + } + ] +} diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_reports_streams_settlement_report.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_reports_streams_settlement_report.py index 0bdf83116fbc3..2d50e3adcb9f5 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_reports_streams_settlement_report.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_reports_streams_settlement_report.py @@ -15,6 +15,7 @@ def settlement_reports_stream(): def _internal(start_date: str = START_DATE_1, end_date: str = END_DATE_1): stream = FlatFileSettlementV2Reports( + stream_name="FlatFileSettlementV2Reports", url_base="https://test.url", replication_start_date=start_date, replication_end_date=end_date, diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_source.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_source.py index 8ecc456121552..614f3ef097a20 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_source.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_source.py @@ -28,6 +28,7 @@ def connector_config_with_report_options(): "region": "US", "report_options_list": [ { + "report_name": "GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA", "stream_name": "GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA", "options_list": [ {"option_name": "some_name_1", "option_value": "some_value_1"}, @@ -118,20 +119,24 @@ def test_check_connection_with_orders(requests_mock, connector_config_with_repor @pytest.mark.parametrize( - ("report_name", "options_list"), + ("report_name", "stream_name_w_options"), ( ( "GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA", [ - {"option_name": "some_name_1", "option_value": "some_value_1"}, - {"option_name": "some_name_2", "option_value": "some_value_2"}, - ], + ("GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA", + [ + {"option_name": "some_name_1", "option_value": "some_value_1"}, + {"option_name": "some_name_2", "option_value": "some_value_2"}, + ], + ), + ] ), - ("SOME_OTHER_STREAM", None), + ("SOME_OTHER_STREAM", []), ), ) -def test_get_stream_report_options_list(connector_config_with_report_options, report_name, options_list): - assert SourceAmazonSellerPartner().get_stream_report_options_list(report_name, connector_config_with_report_options) == options_list +def test_get_stream_report_options_list(connector_config_with_report_options, report_name, stream_name_w_options): + assert list(SourceAmazonSellerPartner().get_stream_report_kwargs(report_name, connector_config_with_report_options)) == stream_name_w_options def test_config_report_options_validation_error_duplicated_streams(connector_config_with_report_options): @@ -196,5 +201,5 @@ def test_spec(deployment_mode, common_streams_count, monkeypatch): } streams_with_report_options = SourceAmazonSellerPartner().spec( logger - ).connectionSpecification["properties"]["report_options_list"]["items"]["properties"]["stream_name"]["enum"] + ).connectionSpecification["properties"]["report_options_list"]["items"]["properties"]["report_name"]["enum"] assert len(set(streams_with_report_options).intersection(oss_only_streams)) == common_streams_count diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_streams.py index a6e3661c58469..0862e5896b019 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_streams.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_streams.py @@ -19,11 +19,11 @@ class SomeReportStream(ReportsAmazonSPStream): - name = "GET_TEST_REPORT" + report_name = "GET_TEST_REPORT" class SomeIncrementalReportStream(IncrementalReportsAmazonSPStream): - name = "GET_TEST_INCREMENTAL_REPORT" + report_name = "GET_TEST_INCREMENTAL_REPORT" cursor_field = "dataEndTime" @@ -269,11 +269,11 @@ class TestVendorFulfillment: ("2022-08-01T00:00:00Z", "2022-08-05T00:00:00Z", {"createdBefore": "2022-08-06T00:00:00Z"}, []), ), ) - def test_stream_slices(self, report_init_kwargs, start_date, end_date, stream_state, expected_slices): - report_init_kwargs["replication_start_date"] = start_date - report_init_kwargs["replication_end_date"] = end_date + def test_stream_slices(self, init_kwargs, start_date, end_date, stream_state, expected_slices): + init_kwargs["replication_start_date"] = start_date + init_kwargs["replication_end_date"] = end_date - stream = VendorDirectFulfillmentShipping(**report_init_kwargs) + stream = VendorDirectFulfillmentShipping(**init_kwargs) with patch("pendulum.now", return_value=pendulum.parse("2022-09-05T00:00:00Z")): assert list(stream.stream_slices(sync_mode=SyncMode.full_refresh, stream_state=stream_state)) == expected_slices @@ -298,6 +298,6 @@ def test_stream_slices(self, report_init_kwargs, start_date, end_date, stream_st (None, None, {}), ), ) - def test_request_params(self, report_init_kwargs, stream_slice, next_page_token, expected_params): - stream = VendorDirectFulfillmentShipping(**report_init_kwargs) + def test_request_params(self, init_kwargs, stream_slice, next_page_token, expected_params): + stream = VendorDirectFulfillmentShipping(**init_kwargs) assert stream.request_params(stream_state={}, stream_slice=stream_slice, next_page_token=next_page_token) == expected_params diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py index 0acc47ef9079b..56b31c928d820 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_transform_function.py @@ -15,6 +15,7 @@ def reports_stream(marketplace_id): stream = SellerFeedbackReports( + stream_name="SELLER_FEEDBACK_REPORTS", url_base="https://test.url", replication_start_date="2010-01-25T00:00:00Z", replication_end_date="2017-02-25T00:00:00Z", diff --git a/docs/integrations/sources/amazon-seller-partner.md b/docs/integrations/sources/amazon-seller-partner.md index ed1a5deb1100b..8d3fc0551bb3f 100644 --- a/docs/integrations/sources/amazon-seller-partner.md +++ b/docs/integrations/sources/amazon-seller-partner.md @@ -175,6 +175,7 @@ Information about rate limits you may find [here](https://developer-docs.amazon. | Version | Date | Pull Request | Subject | |:--------|:-----------|:----------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 4.3.0 | 2024-05-24 | [#00000](https://github.com/airbytehq/airbyte/pull/00000) | Extend the report_options spec config with a `stream_name` attribute | | 4.2.4 | 2024-05-15 | [#38210](https://github.com/airbytehq/airbyte/pull/38210) | Fix `GET_VENDOR_TRAFFIC_REPORT` stream with report option `reportPeriod=DAY` | | 4.2.3 | 2024-05-09 | [#38078](https://github.com/airbytehq/airbyte/pull/38078) | Hide OSS-only streams in report options config for cloud users | | 4.2.2 | 2024-04-24 | [#36630](https://github.com/airbytehq/airbyte/pull/36630) | Schema descriptions and CDK 0.80.0 |