Skip to content

Commit

Permalink
Sync product/variant ID from context for property/option specifics st…
Browse files Browse the repository at this point in the history
…reams
  • Loading branch information
ReubenFrankel committed Nov 27, 2024
1 parent 438d4ba commit 07343ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions tap_veeqo/schemas/product_property_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from singer_sdk import typing as th

ProductPropertySpecificObject = th.PropertiesList(
th.Property("product_id", th.IntegerType), # from context
th.Property("id", th.IntegerType),
th.Property("product_property_id", th.IntegerType),
th.Property("product_property_name", th.StringType),
Expand Down
1 change: 1 addition & 0 deletions tap_veeqo/schemas/variant_property_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from singer_sdk import typing as th

VariantPropertySpecificObject = th.PropertiesList(
th.Property("variant_id", th.IntegerType), # from context
th.Property("id", th.IntegerType),
th.Property("product_specific_id", th.IntegerType),
th.Property("product_property_id", th.IntegerType),
Expand Down
14 changes: 7 additions & 7 deletions tap_veeqo/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ProductsStream(VeeqoStream):

@override
def get_child_context(self, record, context):
return {"id": record["id"]}
return {"product_id": record["id"]}


class ProductBrandsStream(VeeqoStream):
Expand All @@ -89,16 +89,16 @@ class ProductPropertySpecificsStream(VeeqoStream):

name = "product_property_specifics"
parent_stream_type = ProductsStream
path = "/products/{id}/product_property_specifics"
path = "/products/{product_id}/product_property_specifics"
schema = ProductPropertySpecificObject.to_dict()
primary_keys = ("id", "product_property_id")
primary_keys = ("product_id", "id", "product_property_id")


class ProductOptionSpecificsStream(ProductPropertySpecificsStream):
"""Define product option specifics stream."""

name = "product_option_specifics"
path = "/products/{id}/product_option_specifics"
path = "/products/{product_id}/product_option_specifics"


class ProductTagsStream(VeeqoStream):
Expand Down Expand Up @@ -136,17 +136,17 @@ class SellablesStream(VeeqoStream):

@override
def get_child_context(self, record, context):
return {"id": record["id"]}
return {"variant_id": record["id"]}


class VariantPropertySpecificsStream(VeeqoStream):
"""Define variant property specifics stream."""

name = "variant_property_specifics"
parent_stream_type = SellablesStream
path = "/product_variants/{id}/variant_property_specifics"
path = "/product_variants/{variant_id}/variant_property_specifics"
schema = VariantPropertySpecificObject.to_dict()
primary_keys = ("id", "product_specific_id", "product_property_id")
primary_keys = ("variant_id", "id", "product_specific_id", "product_property_id")


class StoresStream(VeeqoStream):
Expand Down

0 comments on commit 07343ac

Please sign in to comment.