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 Ads: filters for state on brand and product campaigns #16829

Conversation

sage-watterworth
Copy link
Contributor

What

This PR will allow Brand and Product campaigns to use the status (state) filter. This is an iteration of the following PR:
#15985

Screen Shot 2022-08-25 at 2 39 48 PM

How

Adding request params to Brand and Product campaigns.

Recommended reading order

  1. sponsored_brands.py
  2. sponsored_product.py
  3. test_report_streams.py

🚨 User Impact 🚨

The parameter is optional and will not affect current functionality.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here

Tests

Unit

Task :airbyte-integrations:connectors:source-amazon-ads:unitTest
Name Stmts Miss Cover


source_amazon_ads/utils.py 9 0 100%
source_amazon_ads/streams/sponsored_products.py 41 0 100%
source_amazon_ads/streams/sponsored_display.py 31 0 100%
source_amazon_ads/streams/sponsored_brands.py 26 0 100%
source_amazon_ads/streams/report_streams/products_report.py 18 0 100%
source_amazon_ads/streams/report_streams/display_report.py 16 0 100%
source_amazon_ads/streams/report_streams/brands_video_report.py 10 0 100%
source_amazon_ads/streams/report_streams/brands_report.py 10 0 100%
source_amazon_ads/streams/report_streams/init.py 5 0 100%
source_amazon_ads/streams/profiles.py 21 0 100%
source_amazon_ads/streams/init.py 6 0 100%
source_amazon_ads/schemas/sponsored_products.py 37 0 100%
source_amazon_ads/schemas/sponsored_display.py 31 0 100%
source_amazon_ads/schemas/sponsored_brands.py 22 0 100%
source_amazon_ads/schemas/profile.py 16 0 100%
source_amazon_ads/schemas/init.py 6 0 100%
source_amazon_ads/constants.py 1 0 100%
source_amazon_ads/init.py 2 0 100%
source_amazon_ads/streams/common.py 76 1 99%
source_amazon_ads/schemas/common.py 51 1 98%
source_amazon_ads/streams/report_streams/report_streams.py 240 18 92%
source_amazon_ads/source.py 38 8 79%

TOTAL 713 28 96%

Task :airbyte-integrations:bases:source-acceptance-test:_unitTestCoverage
collecting ...

      test_asserts.py::test_verify_records_schema ✓                     0%           
      test_asserts.py::test_validate_records_format[record0-configured_catalog0-False] ✓1% ▏         
      test_asserts.py::test_validate_records_format[record1-configured_catalog1-False] ✓1% ▏         
      test_asserts.py::test_validate_records_format[record2-configured_catalog2-False] ✓1% ▎         
      test_asserts.py::test_validate_records_format[record3-configured_catalog3-False] ✓2% ▎         
      test_asserts.py::test_validate_records_format[record4-configured_catalog4-True] ✓2% ▎         
      test_asserts.py::test_validate_records_format[record5-configured_catalog5-False] ✓2% ▎         
      test_asserts.py::test_validate_records_format[record6-configured_catalog6-True] ✓3% ▍         
      test_asserts.py::test_validate_records_format[record7-configured_catalog7-False] ✓3% ▍         
      test_asserts.py::test_validate_records_format[record8-configured_catalog8-False] ✓3% ▍         
      test_asserts.py::test_validate_records_format[record9-configured_catalog9-True] ✓4% ▍         
      test_asserts.py::test_validate_records_format[record10-configured_catalog10-True] ✓4% ▍         
      test_asserts.py::test_validate_records_format[record11-configured_catalog11-True] ✓4% ▌         
      test_asserts.py::test_validate_records_format[record12-configured_catalog12-True] ✓5% ▌         
      test_asserts.py::test_validate_records_format[record13-configured_catalog13-False] ✓5% ▌         
      test_asserts.py::test_validate_records_format[record14-configured_catalog14-False] ✓5% ▌         
      test_asserts.py::test_validate_records_format[record15-configured_catalog15-False] ✓6% ▋         
      test_asserts.py::test_validate_records_format[record16-configured_catalog16-True] ✓6% ▋         
      test_asserts.py::test_validate_records_format[record17-configured_catalog17-False] ✓6% ▋         
      test_asserts.py::test_validate_records_format[record18-configured_catalog18-True] ✓7% ▋         
      test_asserts.py::test_validate_records_format[record19-configured_catalog19-True] ✓7% ▊         
      test_asserts.py::test_validate_records_format[record20-configured_catalog20-True] ✓7% ▊         
      test_asserts.py::test_validate_records_format[record21-configured_catalog21-False] ✓7% ▊         
      test_asserts.py::test_validate_records_format[record22-configured_catalog22-False] ✓8% ▊         
      test_asserts.py::test_validate_records_format[record23-configured_catalog23-True] ✓8% ▊         
      test_asserts.py::test_validate_records_format[record24-configured_catalog24-True] ✓8% ▉         
      test_asserts.py::test_validate_records_format[record25-configured_catalog25-False] ✓9% ▉         
      test_asserts.py::test_validate_records_format[record26-configured_catalog26-False] ✓9% ▉         
      test_asserts.py::test_validate_records_format[record27-configured_catalog27-True] ✓9% ▉         
      test_asserts.py::test_validate_records_format[record28-configured_catalog28-False] ✓10% █         
      test_asserts.py::test_validate_records_format[record29-configured_catalog29-True] ✓10% █         
      test_asserts.py::test_validate_records_format[record30-configured_catalog30-True] ✓10% █▏        
      test_asserts.py::test_validate_records_format[record31-configured_catalog31-True] ✓11% █▏        
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: declaring the required field should fail.] ✓11% █▎        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: adding the required field should fail.] ✓11% █▎        
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: adding a new required property should fail.] ✓12% █▎        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: adding a new required property should fail.] ✓12% █▎        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nullable: Making a field not nullable should fail (not in a list).] ✓12% █▎        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Narrowing a field type should fail.] ✓13% █▍        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nullable field: Making a field not nullable should fail] ✓13% █▍        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type should fail.] ✓13% █▍        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type from a string to a list with a different type value should fail.] ✓14% █▍        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type should fail from a list to string with different value should fail.] ✓14% █▌        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type in list should fail.] ✓14% █▌        
      test_backward_compatibility.py::test_spec_backward_compatibility[Making a field nullable and changing type should fail.] ✓15% █▌        
      test_backward_compatibility.py::test_spec_backward_compatibility[Making a field nullable and changing type should fail (change list order).] ✓15% █▌        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nullable field: Changing a field type should fail] ✓15% █▌        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type in oneOf should fail.] ✓16% █▋        
      test_backward_compatibility.py::test_spec_backward_compatibility[Narrowing a field type in oneOf should fail.] ✓16% █▋        
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: Narrowing a field enum should fail.] ✓16% █▋        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Narrowing a field enum should fail.] ✓17% █▋        
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: Declaring a field enum should fail.] ✓17% █▊        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Declaring a field enum should fail.] ✓17% █▊        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a 'type' field from a string to something else than a list should fail.] ✓18% █▊        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a 'type' field from a list to something else than a string should fail.] ✓18% █▊        
      test_backward_compatibility.py::test_spec_backward_compatibility[Not changing a spec should not fail] ✓18% █▉        
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: Changing the value of additionalProperties should not fail] ✓19% █▉        
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Changing the value of additionalProperties should not fail] ✓19% █▉        
      test_backward_compatibility.py::test_spec_backward_compatibility[Adding an optional field should not fail.] ✓19% █▉        
      test_backward_compatibility.py::test_spec_backward_compatibility[Adding an optional object with required properties should not fail.] ✓20% █▉        
      test_backward_compatibility.py::test_spec_backward_compatibility[No change should not fail.] ✓20% ██        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type from a list to a string with same value should not fail.] ✓20% ██        
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a field type from a string to a list should not fail.] ✓21% ██▏       
      test_backward_compatibility.py::test_spec_backward_compatibility[Adding a field type in list should not fail.] ✓21% ██▏       
      test_backward_compatibility.py::test_spec_backward_compatibility[Making a field nullable should not fail.] ✓21% ██▎       
      test_backward_compatibility.py::test_spec_backward_compatibility[Making a field nullable should not fail (change list order).] ✓21% ██▎       
      test_backward_compatibility.py::test_spec_backward_compatibility[Making a field nullable should not fail (from a list).] ✓22% ██▎       
      test_backward_compatibility.py::test_spec_backward_compatibility[Making a field nullable should not fail (from a list, changing order).] ✓22% ██▎       
      test_backward_compatibility.py::test_spec_backward_compatibility[Nullable field: Changing order should not fail] ✓22% ██▎       
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Expanding a field type should not fail.] ✓23% ██▍       
      test_backward_compatibility.py::test_spec_backward_compatibility[Changing a order in oneOf should not fail.] ✓23% ██▍       
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: Expanding a field enum should not fail.] ✓23% ██▍       
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Expanding a field enum should not fail.] ✓24% ██▍       
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: Adding a new optional field with enum should not fail.] ✓24% ██▌       
      test_backward_compatibility.py::test_spec_backward_compatibility[Top level: Removing the field enum should not fail.] ✓24% ██▌       
      test_backward_compatibility.py::test_spec_backward_compatibility[Nested level: Removing the enum field should not fail.] ✓25% ██▌       
      test_backward_compatibility.py::test_validate_previous_configs[Top level: declaring the required field should fail.] ✓25% ██▌       
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: adding the required field should fail.] ✓25% ██▋       
      test_backward_compatibility.py::test_validate_previous_configs[Top level: adding a new required property should fail.] ✓26% ██▋       
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: adding a new required property should fail.] ✓26% ██▋       
      test_backward_compatibility.py::test_validate_previous_configs[Nullable: Making a field not nullable should fail (not in a list).] ✓26% ██▋       
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Narrowing a field type should fail.] ✓27% ██▋       
      test_backward_compatibility.py::test_validate_previous_configs[Nullable field: Making a field not nullable should fail] ✓27% ██▊       
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type should fail.] ✓27% ██▊       
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type from a string to a list with a different type value should fail.] ✓28% ██▊       
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type should fail from a list to string with different value should fail.] ✓28% ██▊       
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type in list should fail.] ✓28% ██▉       
      test_backward_compatibility.py::test_validate_previous_configs[Making a field nullable and changing type should fail.] ✓29% ██▉       
      test_backward_compatibility.py::test_validate_previous_configs[Making a field nullable and changing type should fail (change list order).] ✓29% ██▉       
      test_backward_compatibility.py::test_validate_previous_configs[Nullable field: Changing a field type should fail] ✓29% ██▉       
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type in oneOf should fail.] ✓30% ██▉       
      test_backward_compatibility.py::test_validate_previous_configs[Narrowing a field type in oneOf should fail.] ✓30% ███       
      test_backward_compatibility.py::test_validate_previous_configs[Top level: Narrowing a field enum should fail.] ✓30% ███       
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Narrowing a field enum should fail.] ✓31% ███▏      
      test_backward_compatibility.py::test_validate_previous_configs[Top level: Declaring a field enum should fail.] ✓31% ███▏      
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Declaring a field enum should fail.] ✓31% ███▎      
      test_backward_compatibility.py::test_validate_previous_configs[Not changing a spec should not fail] ✓32% ███▎      
      test_backward_compatibility.py::test_validate_previous_configs[Top level: Changing the value of additionalProperties should not fail] ✓32% ███▎      
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Changing the value of additionalProperties should not fail] ✓32% ███▎      
      test_backward_compatibility.py::test_validate_previous_configs[Adding an optional field should not fail.] ✓33% ███▍      
      test_backward_compatibility.py::test_validate_previous_configs[Adding an optional object with required properties should not fail.] ✓33% ███▍      
      test_backward_compatibility.py::test_validate_previous_configs[No change should not fail.] ✓33% ███▍      
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type from a list to a string with same value should not fail.] ✓34% ███▍      
      test_backward_compatibility.py::test_validate_previous_configs[Changing a field type from a string to a list should not fail.] ✓34% ███▍      
      test_backward_compatibility.py::test_validate_previous_configs[Adding a field type in list should not fail.] ✓34% ███▌      
      test_backward_compatibility.py::test_validate_previous_configs[Making a field nullable should not fail.] ✓35% ███▌      
      test_backward_compatibility.py::test_validate_previous_configs[Making a field nullable should not fail (change list order).] ✓35% ███▌      
      test_backward_compatibility.py::test_validate_previous_configs[Making a field nullable should not fail (from a list).] ✓35% ███▌      
      test_backward_compatibility.py::test_validate_previous_configs[Making a field nullable should not fail (from a list, changing order).] ✓36% ███▋      
      test_backward_compatibility.py::test_validate_previous_configs[Nullable field: Changing order should not fail] ✓36% ███▋      
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Expanding a field type should not fail.] ✓36% ███▋      
      test_backward_compatibility.py::test_validate_previous_configs[Changing a order in oneOf should not fail.] ✓36% ███▋      
      test_backward_compatibility.py::test_validate_previous_configs[Top level: Expanding a field enum should not fail.] ✓37% ███▊      
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Expanding a field enum should not fail.] ✓37% ███▊      
      test_backward_compatibility.py::test_validate_previous_configs[Top level: Adding a new optional field with enum should not fail.] ✓37% ███▊      
      test_backward_compatibility.py::test_validate_previous_configs[Top level: Removing the field enum should not fail.] ✓38% ███▊      
      test_backward_compatibility.py::test_validate_previous_configs[Nested level: Removing the enum field should not fail.] ✓38% ███▊      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Removing a stream from a catalog should fail.] ✓38% ███▉      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Changing a field type should fail.] ✓39% ███▉      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Renaming a stream should fail.] ✓39% ███▉      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Changing a cursor in a stream should fail.] ✓39% ███▉      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Changing a cursor in a stream should fail (nested cursors).] ✓40% ████      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Changing a cursor in a stream should fail (nested cursors removal).] ✓40% ████      
      test_backward_compatibility.py::test_catalog_backward_compatibility[Adding a stream but changing cursor should fail.] ✓40% ████▏     
      test_backward_compatibility.py::test_catalog_backward_compatibility[Adding a stream to a catalog should not fail.] ✓41% ████▏     
      test_backward_compatibility.py::test_catalog_backward_compatibility[Making a field nullable should not fail.] ✓41% ████▏     
      test_backward_compatibility.py::test_catalog_backward_compatibility[Changing 'type' field to list should not fail.] ✓41% ████▎     
      test_backward_compatibility.py::test_catalog_backward_compatibility[Removing a field should not fail.] ✓42% ████▎     
      test_backward_compatibility.py::test_catalog_backward_compatibility[Not changing a cursor in a stream should not fail.] ✓42% ████▎     
      test_core.py::test_discovery[schema0-cursors0-True] ✓            42% ████▎     
      test_core.py::test_discovery[schema1-cursors1-False] ✓           43% ████▍     
      test_core.py::test_discovery[schema2-cursors2-True] ✓            43% ████▍     
      test_core.py::test_discovery[schema3-cursors3-True] ✓            43% ████▍     
      test_core.py::test_discovery[schema4-cursors4-False] ✓           44% ████▍     
      test_core.py::test_discovery[schema5-cursors5-True] ✓            44% ████▌     
      test_core.py::test_ref_in_discovery_schemas[schema0-False] ✓     44% ████▌     
      test_core.py::test_ref_in_discovery_schemas[schema1-True] ✓      45% ████▌     
      test_core.py::test_ref_in_discovery_schemas[schema2-True] ✓      45% ████▌     
      test_core.py::test_ref_in_discovery_schemas[schema3-True] ✓      45% ████▌     
      test_core.py::test_ref_in_discovery_schemas[schema4-False] ✓     46% ████▋     
      test_core.py::test_ref_in_discovery_schemas[schema5-True] ✓      46% ████▋     
      test_core.py::test_ref_in_discovery_schemas[schema6-True] ✓      46% ████▋     
      test_core.py::test_keyword_in_discovery_schemas[schema0-allOf-False] ✓47% ████▋     
      test_core.py::test_keyword_in_discovery_schemas[schema1-allOf-True] ✓47% ████▊     
      test_core.py::test_keyword_in_discovery_schemas[schema2-allOf-False] ✓47% ████▊     
      test_core.py::test_keyword_in_discovery_schemas[schema3-allOf-True] ✓48% ████▊     
      test_core.py::test_keyword_in_discovery_schemas[schema4-allOf-True] ✓48% ████▊     
      test_core.py::test_keyword_in_discovery_schemas[schema5-allOf-True] ✓48% ████▊     
      test_core.py::test_keyword_in_discovery_schemas[schema6-not-True] ✓49% ████▉     
      test_core.py::test_keyword_in_discovery_schemas[schema7-not-False] ✓49% ████▉     
      test_core.py::test_keyword_in_discovery_schemas[schema8-not-True] ✓49% ████▉     
      test_core.py::test_supported_sync_modes_in_stream[discovered_catalog0-expectation0] ✓50% ████▉     
      test_core.py::test_supported_sync_modes_in_stream[discovered_catalog1-expectation1] ✓50% █████     
      test_core.py::test_supported_sync_modes_in_stream[discovered_catalog2-expectation2] ✓50% █████     
      test_core.py::test_supported_sync_modes_in_stream[discovered_catalog3-expectation3] ✓50% █████▏    
      test_core.py::test_supported_sync_modes_in_stream[discovered_catalog4-expectation4] ✓51% █████▏    
      test_core.py::test_additional_properties_is_true[discovered_catalog0-expectation0] ✓51% █████▎    
      test_core.py::test_additional_properties_is_true[discovered_catalog1-expectation1] ✓51% █████▎    
      test_core.py::test_additional_properties_is_true[discovered_catalog2-expectation2] ✓52% █████▎    
      test_core.py::test_additional_properties_is_true[discovered_catalog3-expectation3] ✓52% █████▎    
      test_core.py::test_additional_properties_is_true[discovered_catalog4-expectation4] ✓52% █████▎    
      test_core.py::test_additional_properties_is_true[discovered_catalog5-expectation5] ✓53% █████▍    
      test_core.py::test_read[schema0-record0-False] ✓                 53% █████▍    
      test_core.py::test_read[schema1-record1-False] ✓                 53% █████▍    
      test_core.py::test_read[schema2-record2-True] ✓                  54% █████▍    
      test_core.py::test_read[schema3-record3-False] ✓                 54% █████▌    
      test_core.py::test_read[schema4-record4-True] ✓                  54% █████▌    
      test_core.py::test_read[schema5-record5-False] ✓                 55% █████▌    
      test_core.py::test_airbyte_trace_message_on_failure[output0-True-False] ✓55% █████▌    
      test_core.py::test_airbyte_trace_message_on_failure[output1-True-False] ✓55% █████▋    
      test_core.py::test_airbyte_trace_message_on_failure[output2-True-False] ✓56% █████▋    
      test_core.py::test_airbyte_trace_message_on_failure[output3-True-True] ✓56% █████▋    
      test_core.py::test_airbyte_trace_message_on_failure[output4-True-True] ✓56% █████▋    
      test_core.py::test_airbyte_trace_message_on_failure[output5-False-False] ✓57% █████▋    
      test_core.py::test_airbyte_trace_message_on_failure[output6-False-False] ✓57% █████▊    
      test_core.py::test_airbyte_trace_message_on_failure[output7-False-False] ✓57% █████▊    
      test_core.py::test_validate_field_appears_at_least_once[records0-configured_catalog0-] ✓58% █████▊    
      test_core.py::test_validate_field_appears_at_least_once[records1-configured_catalog1-`test1` stream has `\\['/f2'\\]`] ✓58% █████▊    
      test_core.py::test_validate_field_appears_at_least_once[records2-configured_catalog2-] ✓58% █████▉    
      test_core.py::test_validate_field_appears_at_least_once[records3-configured_catalog3-] ✓59% █████▉    
      test_core.py::test_validate_field_appears_at_least_once[records4-configured_catalog4-`test1` stream has `\\['/f3/\\[\\]'\\]`] ✓59% █████▉    
      test_core.py::test_validate_field_appears_at_least_once[records5-configured_catalog5-] ✓59% █████▉    
      test_core.py::test_validate_field_appears_at_least_once[records6-configured_catalog6-`test1` stream has `\\['/f3/f5/\\[\\]'\\]`] ✓60% █████▉    
      test_core.py::test_validate_field_appears_at_least_once[records7-configured_catalog7-`test1` stream has `\\['/f3/f5/\\[\\]/f6', '/f3/f5/\\[\\]/f7/\\[\\]'\\]`] ✓60% ██████    
      test_core.py::test_validate_field_appears_at_least_once[records8-configured_catalog8-] ✓60% ██████    
      test_core.py::test_validate_field_appears_at_least_once[records9-configured_catalog9-(`test1` stream has `\\['/f3/f5/\\[\\]/f7/\\[\\]']`)|(`test2` `\\['/f8'\\]`)] ✓61% ██████▏   
      test_core.py::test_validate_field_appears_at_least_once[records10-configured_catalog10-] ✓61% ██████▏   
      test_core.py::test_validate_field_appears_at_least_once[records11-configured_catalog11-] ✓61% ██████▎   
      test_core.py::test_validate_field_appears_at_least_once[records12-configured_catalog12-`test1` stream has `\\['/f3\\(0\\)/f4', '/f3\\(1\\)/f5\\(0\\)/f6', '/f3\\(1\\)/f5\\(1\\)/f7'\\]`] ✓62% ██████▎   IDLE
      test_incremental.py::test_compare_cursor_with_threshold[record_value0-state_value0-0-True] ✓62% ██████▎   
      test_incremental.py::test_compare_cursor_with_threshold[record_value1-state_value1-0-False] ✓62% ██████▎   
      test_incremental.py::test_compare_cursor_with_threshold[record_value2-state_value2-1-True] ✓63% ██████▍   
      test_incremental.py::test_compare_cursor_with_threshold[record_value3-state_value3-0-True] ✓63% ██████▍   
      test_incremental.py::test_compare_cursor_with_threshold[record_value4-state_value4-0-False] ✓63% ██████▍   
      test_incremental.py::test_compare_cursor_with_threshold[record_value5-state_value5-1-True] ✓64% ██████▍   
      test_incremental.py::test_compare_cursor_with_threshold[2020-10-10-2020-10-09-0-True] ✓64% ██████▍   
      test_incremental.py::test_compare_cursor_with_threshold[2020-10-10-2020-10-11-0-False] ✓64% ██████▌   
      test_incremental.py::test_compare_cursor_with_threshold[2020-10-10-2020-10-11-1-True] ✓64% ██████▌   
      test_incremental.py::test_compare_cursor_with_threshold[1602288000000-1602201600000-0-True] ✓65% ██████▌   
      test_incremental.py::test_compare_cursor_with_threshold[1602288000000-1602374400000-0-False] ✓65% ██████▌   
      test_incremental.py::test_compare_cursor_with_threshold[1602288000000-1602374400000-1-True] ✓65% ██████▋   
      test_incremental.py::test_compare_cursor_with_threshold[1602288000-1602201600-0-True] ✓66% ██████▋   
      test_incremental.py::test_compare_cursor_with_threshold[1602288000-1602374400-0-False] ✓66% ██████▋   
      test_incremental.py::test_compare_cursor_with_threshold[1602288000-1602374400-1-True] ✓66% ██████▋   
      test_incremental.py::test_compare_cursor_with_threshold[aaa-bbb-0-False] ✓67% ██████▋   
      test_incremental.py::test_compare_cursor_with_threshold[bbb-aaa-0-True] ✓67% ██████▊   
      test_incremental.py::test_incremental_two_sequential_reads[records10-records20-2020-01-02-0-None-date] ✓67% ██████▊   
      test_incremental.py::test_incremental_two_sequential_reads[records10-records20-2020-01-02-0-None-string] ✓68% ██████▊   
      test_incremental.py::test_incremental_two_sequential_reads[records11-records21-2020-01-02-0-First incremental sync should produce records younger-date] ✓68% ██████▊   
      test_incremental.py::test_incremental_two_sequential_reads[records11-records21-2020-01-02-0-First incremental sync should produce records younger-string] ✓68% ██████▉   
      test_incremental.py::test_incremental_two_sequential_reads[records12-records22-2020-01-02-0-None-date] ✓69% ██████▉   
      test_incremental.py::test_incremental_two_sequential_reads[records12-records22-2020-01-02-0-None-string] ✓69% ██████▉   
      test_incremental.py::test_incremental_two_sequential_reads[records13-records23-2020-01-02-0-Second incremental sync should produce records older-date] ✓69% ██████▉   
      test_incremental.py::test_incremental_two_sequential_reads[records13-records23-2020-01-02-0-Second incremental sync should produce records older-string] ✓70% ███████   
      test_incremental.py::test_incremental_two_sequential_reads[records14-records24-2020-01-03-2-None-date] ✓70% ███████   
      test_incremental.py::test_incremental_two_sequential_reads[records14-records24-2020-01-03-2-None-string] ✓70% ███████▏  
      test_incremental.py::test_incremental_two_sequential_reads[records15-records25-2020-01-02-2-First incremental sync should produce records younger-date] ✓71% ███████▏  
      test_incremental.py::test_incremental_two_sequential_reads[records15-records25-2020-01-02-2-First incremental sync should produce records younger-string] ✓71% ███████▏  
      test_incremental.py::test_incremental_two_sequential_reads[records16-records26-2020-01-06-3-Second incremental sync should produce records older-date] ✓71% ███████▎  
      test_incremental.py::test_incremental_two_sequential_reads[records16-records26-2020-01-06-3-Second incremental sync should produce records older-string] ✓72% ███████▎  
      test_incremental.py::test_read_with_multiple_states[test_incremental_with_2_states-records0-state_records0-0-None] ✓72% ███████▎  
      test_incremental.py::test_read_with_multiple_states[test_first_incremental_only_younger_records-records1-state_records1-0-AssertionError] ✓72% ███████▎  
      test_incremental.py::test_read_with_multiple_states[test_incremental_with_threshold-records2-state_records2-3-None] ✓73% ███████▍  
      test_incremental.py::test_read_with_multiple_states[test_incremental_with_incorrect_messages-records3-state_records3-0-AssertionError] ✓73% ███████▍  
      test_incremental.py::test_read_with_multiple_states[test_incremental_with_multiple_streams-records4-state_records4-0-None] ✓73% ███████▍  
      test_incremental.py::test_read_with_multiple_states[test_incremental_with_none_state-records5-state_records5-0-None] ✓74% ███████▍  
      test_incremental.py::test_config_skip_test ✓                     74% ███████▌  
      test_json_schema_helper.py::test_simple_path ✓                   74% ███████▌  
      test_json_schema_helper.py::test_nested_path ✓                   75% ███████▌  
      test_json_schema_helper.py::test_absolute_path ✓                 75% ███████▌  
      test_json_schema_helper.py::test_none_state ✓                    75% ███████▌  
      test_json_schema_helper.py::test_json_schema_helper_pydantic_generated ✓76% ███████▋  
      test_json_schema_helper.py::test_get_object_strucutre[object0-pathes0] ✓76% ███████▋  
      test_json_schema_helper.py::test_get_object_strucutre[object1-pathes1] ✓76% ███████▋  
      test_json_schema_helper.py::test_get_object_strucutre[object2-pathes2] ✓77% ███████▋  
      test_json_schema_helper.py::test_get_object_strucutre[object3-pathes3] ✓77% ███████▊  
      test_json_schema_helper.py::test_get_object_strucutre[object4-pathes4] ✓77% ███████▊  
      test_json_schema_helper.py::test_get_object_strucutre[object5-pathes5] ✓78% ███████▊  
      test_json_schema_helper.py::test_get_object_strucutre[object6-pathes6] ✓78% ███████▊  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema0-pathes0] ✓78% ███████▊  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema1-pathes1] ✓79% ███████▉  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema2-pathes2] ✓79% ███████▉  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema3-pathes3] ✓79% ███████▉  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema4-pathes4] ✓79% ███████▉  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema5-pathes5] ✓80% ████████  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema6-pathes6] ✓80% ████████  
      test_json_schema_helper.py::test_get_expected_schema_structure[schema7-pathes7] ✓80% ████████▏ 
      test_json_schema_helper.py::test_get_expected_schema_structure[schema8-pathes8] ✓81% ████████▏ 
      test_json_schema_helper.py::test_get_expected_schema_structure[schema9-pathes9] ✓81% ████████▎ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec0-True] ✓   81% ████████▎ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec1-True] ✓   82% ████████▎ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec2-True] ✓   82% ████████▎ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec3-True] ✓   82% ████████▎ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec4-False] ✓  83% ████████▍ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec5-False] ✓  83% ████████▍ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec6-True] ✓   83% ████████▍ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec7-True] ✓   84% ████████▍ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec8-True] ✓   84% ████████▌ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec9-False] ✓  84% ████████▌ 
      test_spec.py::test_ref_in_spec_schemas[connector_spec10-True] ✓  85% ████████▌ 
      test_spec.py::test_oneof_usage[all_good] ✓                       85% ████████▌ 
      test_spec.py::test_oneof_usage[top_level_node_is_not_of_object_type] ✓85% ████████▌ 
      test_spec.py::test_oneof_usage[all_oneof_options_should_have_same_constant_attribute] ✓86% ████████▋ 
      test_spec.py::test_oneof_usage[one_of_item_is_not_of_type_object] ✓86% ████████▋ 
      test_spec.py::test_oneof_usage[no_common_property_for_all_oneof_subobjects] ✓86% ████████▋ 
      test_spec.py::test_oneof_usage[two_common_properties_with_const_keyword] ✓87% ████████▋ 
      test_spec.py::test_oneof_usage[default_keyword_in_common_property] ✓87% ████████▊ 
      test_spec.py::test_validate_oauth_flow[connector_spec0-] ✓       87% ████████▊ 
      test_spec.py::test_validate_oauth_flow[connector_spec1-Specified oauth fields are missed from spec schema:] ✓88% ████████▊ 
      test_spec.py::test_validate_oauth_flow[connector_spec2-] ✓       88% ████████▊ 
      test_spec.py::test_validate_oauth_flow[connector_spec3-Specified oauth fields are missed from spec schema:] ✓88% ████████▉ 
      test_spec.py::test_validate_oauth_flow[connector_spec4-] ✓       89% ████████▉ 
      test_spec.py::test_validate_oauth_flow[connector_spec5-] ✓       89% ████████▉ 
      test_spec.py::test_validate_oauth_flow[connector_spec6-Specified oauth fields are missed from spec schema:] ✓89% ████████▉ 
      test_spec.py::test_validate_oauth_flow[connector_spec7-] ✓       90% ████████▉ 
      test_spec.py::test_additional_properties_is_true[connector_spec0-expectation0] ✓90% █████████ 
      test_spec.py::test_additional_properties_is_true[connector_spec1-expectation1] ✓90% █████████ 
      test_spec.py::test_additional_properties_is_true[connector_spec2-expectation2] ✓91% █████████▏
      test_spec.py::test_additional_properties_is_true[connector_spec3-expectation3] ✓91% █████████▏
      test_spec.py::test_additional_properties_is_true[connector_spec4-expectation4] ✓91% █████████▎
      test_spec_unit.py::TestEnvAttributes.test_correct_connector_image ✓92% █████████▎
      test_spec_unit.py::TestEnvAttributes.test_connector_image_without_env ✓92% █████████▎
      test_spec_unit.py::TestEnvAttributes.test_docker_image_env_ne_entrypoint ✓92% █████████▎
      test_test_full_refresh.py::test_read_with_ignore_fields[no_ignored_fields_present] ✓93% █████████▍
      test_test_full_refresh.py::test_read_with_ignore_fields[with_ignored_field] ✓93% █████████▍
      test_test_full_refresh.py::test_read_with_ignore_fields[ignore_field_present_but_a_required_is_not] ✓93% █████████▍
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj10-obj20-True] ✓93% █████████▍
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj11-obj21-True] ✓94% █████████▍
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj12-obj22-False] ✓94% █████████▌
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj13-obj23-False] ✓94% █████████▌
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj14-obj24-True] ✓95% █████████▌
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj15-obj25-True] ✓95% █████████▌
      test_utils.py::test_compare_two_records_nested_with_different_orders[obj16-obj26-False] ✓95% █████████▋
      test_utils.py::test_exclude_fields ✓                             96% █████████▋
      test_utils.py::test_successful_logs_reading ✓                    96% █████████▋{"type": "LOG", "log": {"level": "ERROR", "message": "Docker container was failed, code 1, error:\nSome Container Error"}}
     
      test_utils.py::test_failed_reading[interal_error] ✓              96% █████████▋{"type": "LOG", "log": {"level": "ERROR", "message": "Docker container was failed, code 1, error:\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\nKeyError: 'bbbb'"}}
     
      test_utils.py::test_failed_reading[traceback] ✓                  97% █████████▋{"type": "LOG", "log": {"level": "ERROR", "message": "Docker container was failed, code 1, error:\nLast Container Logs Line"}}
     
      test_utils.py::test_failed_reading[last_line] ✓                  97% █████████▊
      test_utils.py::test_docker_runner[standard] ✓                    97% █████████▊
      test_utils.py::test_docker_runner[waiting] ✓                     98% █████████▊
      test_utils.py::test_not_found_container ✓                        98% █████████▊
      test_utils.py::TestLoadYamlOrJsonPath.test_load_json ✓           98% █████████▉
      test_utils.py::TestLoadYamlOrJsonPath.test_load_yaml ✓           99% █████████▉
      test_utils.py::TestLoadYamlOrJsonPath.test_load_other ✓          99% █████████▉
      test_utils.py::test_find_all_values_for_key_in_schema[schema0-looking_for_this_key-expected_values0] ✓99% █████████▉
      test_utils.py::test_find_all_values_for_key_in_schema[schema1-looking_for_this_key-expected_values1] ✓99% ██████████
      test_utils.py::test_find_all_values_for_key_in_schema[schema2-looking_for_this_key-expected_values2] ✓100% ██████████=============================== warnings summary ===============================
     source_acceptance_test/tests/test_core.py:170
       /Users/sagewatterworth/airbyte-amazon-ads/airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py:170: PytestUnknownMarkWarning: Unknown pytest.mark.backward_compatibility - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
         @pytest.mark.backward_compatibility
     
     source_acceptance_test/tests/test_core.py:311
       /Users/sagewatterworth/airbyte-amazon-ads/airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_core.py:311: PytestUnknownMarkWarning: Unknown pytest.mark.backward_compatibility - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
         @pytest.mark.backward_compatibility
     
     -- Docs: https://docs.pytest.org/en/stable/warnings.html
     
     ---------- coverage: platform darwin, python 3.9.0-final-0 -----------
     Name                                                 Stmts   Miss  Cover   Missing
     ----------------------------------------------------------------------------------
     source_acceptance_test/base.py                          10      4    60%   15-18
     source_acceptance_test/config.py                        83      6    93%   78-80, 84-86
     source_acceptance_test/conftest.py                     164    164     0%   6-282
     source_acceptance_test/plugin.py                        48     48     0%   6-104
     source_acceptance_test/tests/test_core.py              329    111    66%   39, 50-58, 63-70, 74-75, 79-80, 164, 202-219, 228-236, 240-245, 251, 284-289, 327-334, 374-376, 379, 439-448, 477-478, 484, 487, 520-530, 543-568, 573-577
     source_acceptance_test/tests/test_full_refresh.py       52      2    96%   34, 65
     source_acceptance_test/tests/test_incremental.py       121     25    79%   21-23, 29-31, 36-43, 48-61, 208-216
     source_acceptance_test/utils/asserts.py                 37      2    95%   57-58
     source_acceptance_test/utils/common.py                  77     17    78%   15-16, 24-30, 47-54, 64, 67
     source_acceptance_test/utils/compare.py                 62     23    63%   21-51, 68, 97-99
     source_acceptance_test/utils/connector_runner.py       110     48    56%   23-26, 32, 36, 39-64, 67-69, 72-74, 77-79, 82-84, 87-89, 92-110, 144-146
     source_acceptance_test/utils/json_schema_helper.py     105     13    88%   30-31, 38, 41, 65-68, 96, 120, 190-192
     ----------------------------------------------------------------------------------
     TOTAL                                                 1322    463    65%
     
     4 files skipped due to complete coverage.
     
     Required test coverage of 64.0% reached. Total coverage: 64.98%
     
     Results (245.63s):
          307 passed
Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@github-actions github-actions bot added the area/connectors Connector related issues label Sep 16, 2022
@sage-watterworth sage-watterworth changed the title Airbyte amazon ads brands products filter Airbyte amazon ads: Brands and Products campaign state filter Sep 16, 2022
@sage-watterworth sage-watterworth changed the title Airbyte amazon ads: Brands and Products campaign state filter 🎉 Source Amazon Ads: filters for state on brand and product campaigns Sep 16, 2022
@sajarin
Copy link
Contributor

sajarin commented Sep 21, 2022

Hey @sage-watterworth, thanks for making another PR related to this connector, we really appreciate the awesome work you've been doing! This PR is part of Airbyte's Community Maintainer program and will be reviewed by someone from our community shortly. We hope to get this merged into main soon, thanks for being patient!

@sajarin sajarin added bounty-L Maintainer program: claimable large bounty PR bounty-M Maintainer program: claimable medium bounty PR releaseStage/ga team/connectors-python internal and removed bounty-L Maintainer program: claimable large bounty PR bounty bounty-M Maintainer program: claimable medium bounty PR labels Sep 21, 2022
@sajarin
Copy link
Contributor

sajarin commented Sep 26, 2022

Hey @sage-watterworth, thanks for the wait. I'm escalating this PR to our dev team. Thanks for being patient!

@sage-watterworth
Copy link
Contributor Author

sajarin thank you for the update!

@monai monai self-assigned this Nov 3, 2022
@@ -554,3 +557,42 @@ def test_read_incremental_with_records_start_date(config):
records = list(read_incremental(stream, state))
assert state == {"1": {"reportDate": "20210104"}}
assert {r["reportDate"] for r in records} == {"20210103", "20210104", "20210105", "20210106"}


@pytest.mark.parametrize("state_filter", [["enabled", "archived", "paused"], ["enabled"], None])
Copy link
Contributor

Choose a reason for hiding this comment

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

Now, these three tests are the same except for the class name. Use itertools.product to generate test cases for all state filter and stream class pairs.

from itertools import product

@pytest.mark.parametrize("state_filter", "klass", product(
    [["enabled", "archived", "paused"], ["enabled"], None],
    [SponsoredDisplayCampaigns, SponsoredProductCampaigns, SponsoredBrandsCampaigns]
))
def test_campaign_state_filer(mocker, config, state_filter, klass):
    ...
    mocker.patch.object(klass, "state_filter", new_callable=mocker.PropertyMock, return_value=state_filter)
    ...

model = DisplayCampaign

def path(self, **kvargs) -> str:
def path(self, **kwargs) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix kwargs naming in all the modified files.

@@ -12,12 +12,23 @@ class SponsoredBrandsCampaigns(SubProfilesStream):
https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi#/Campaigns
"""

def __init__(self, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

The use of state_filter parameter is copy-pasted across all three streams. Refactor it to a mixin instead, e.g.

class StateFilterMixin:
    state_filter = None

    def __init__(self, *args, **kwargs):
        self.state_filter = kwargs.get("config", {}).get("state_filter")
        super().__init__(*args, **kwargs)

    def request_params(self, *args, **kwargs):
        params = super().request_params(*args, **kwargs)
        if self.state_filter:
            params["stateFilter"] = ",".join(self.state_filter)
        return params

class SponsoredBrandsCampaigns(StateFilterMixin, SubProfilesStream):
    ...

Place StateFilterMixin in common.py.

@grubberr
Copy link
Contributor

grubberr commented Nov 3, 2022

@sage-watterworth @monai
is this PR has to be close because of this #17475
?

@monai
Copy link
Contributor

monai commented Nov 4, 2022

@sage-watterworth @monai is this PR has to be close because of this #17475 ?

Oh, it looks like it duplicates #17475, indeed. I'm closing it, then.

@monai monai closed this Nov 4, 2022
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.

6 participants