%3 1. model.shopify.int_shopify__customer_email_rollup 1. model.shopify.int_shopify__customer_email_rollup 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails 1. model.shopify.int_shopify__customer_email_rollup->14. model.shopify.shopify__customer_emails 2. model.shopify.int_shopify__daily_abandoned_checkouts 2. model.shopify.int_shopify__daily_abandoned_checkouts 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop 2. model.shopify.int_shopify__daily_abandoned_checkouts->17. model.shopify.shopify__daily_shop 3. model.shopify.int_shopify__daily_orders 3. model.shopify.int_shopify__daily_orders 3. model.shopify.int_shopify__daily_orders->17. model.shopify.shopify__daily_shop 4. model.shopify.int_shopify__discounts__abandoned_checkouts 4. model.shopify.int_shopify__discounts__abandoned_checkouts 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts 4. model.shopify.int_shopify__discounts__abandoned_checkouts->18. model.shopify.shopify__discounts 5. model.shopify.int_shopify__discounts__order_aggregates 5. model.shopify.int_shopify__discounts__order_aggregates 5. model.shopify.int_shopify__discounts__order_aggregates->18. model.shopify.shopify__discounts 6. model.shopify.int_shopify__emails__order_aggregates 6. model.shopify.int_shopify__emails__order_aggregates 6. model.shopify.int_shopify__emails__order_aggregates->14. model.shopify.shopify__customer_emails 7. model.shopify.int_shopify__inventory_level__aggregates 7. model.shopify.int_shopify__inventory_level__aggregates 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels 7. model.shopify.int_shopify__inventory_level__aggregates->19. model.shopify.shopify__inventory_levels 8. model.shopify.int_shopify__order__shipping_aggregates 8. model.shopify.int_shopify__order__shipping_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 8. model.shopify.int_shopify__order__shipping_aggregates->22. model.shopify.shopify__orders__order_line_aggregates 9. model.shopify.int_shopify__product__order_line_aggregates 9. model.shopify.int_shopify__product__order_line_aggregates 24. model.shopify.shopify__products 24. model.shopify.shopify__products 9. model.shopify.int_shopify__product__order_line_aggregates->24. model.shopify.shopify__products 10. model.shopify.int_shopify__products_with_aggregates 10. model.shopify.int_shopify__products_with_aggregates 10. model.shopify.int_shopify__products_with_aggregates->24. model.shopify.shopify__products 11. model.shopify.shopify__calendar 11. model.shopify.shopify__calendar 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts 11. model.shopify.shopify__calendar->12. model.shopify.shopify__customer_cohorts 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts 11. model.shopify.shopify__calendar->13. model.shopify.shopify__customer_email_cohorts 11. model.shopify.shopify__calendar->17. model.shopify.shopify__daily_shop 14. model.shopify.shopify__customer_emails->13. model.shopify.shopify__customer_email_cohorts 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers->12. model.shopify.shopify__customer_cohorts 16. model.shopify.shopify__customers__order_aggregates 16. model.shopify.shopify__customers__order_aggregates 16. model.shopify.shopify__customers__order_aggregates->15. model.shopify.shopify__customers 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines->3. model.shopify.int_shopify__daily_orders 20. model.shopify.shopify__order_lines->9. model.shopify.int_shopify__product__order_line_aggregates 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders->3. model.shopify.int_shopify__daily_orders 21. model.shopify.shopify__orders->5. model.shopify.int_shopify__discounts__order_aggregates 21. model.shopify.shopify__orders->9. model.shopify.int_shopify__product__order_line_aggregates 21. model.shopify.shopify__orders->12. model.shopify.shopify__customer_cohorts 21. model.shopify.shopify__orders->13. model.shopify.shopify__customer_email_cohorts 22. model.shopify.shopify__orders__order_line_aggregates->6. model.shopify.int_shopify__emails__order_aggregates 22. model.shopify.shopify__orders__order_line_aggregates->16. model.shopify.shopify__customers__order_aggregates 22. model.shopify.shopify__orders__order_line_aggregates->21. model.shopify.shopify__orders 23. model.shopify.shopify__orders__order_refunds 23. model.shopify.shopify__orders__order_refunds 23. model.shopify.shopify__orders__order_refunds->7. model.shopify.int_shopify__inventory_level__aggregates 23. model.shopify.shopify__orders__order_refunds->20. model.shopify.shopify__order_lines 23. model.shopify.shopify__orders__order_refunds->21. model.shopify.shopify__orders 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions->6. model.shopify.int_shopify__emails__order_aggregates 25. model.shopify.shopify__transactions->16. model.shopify.shopify__customers__order_aggregates 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout->2. model.shopify.int_shopify__daily_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout->4. model.shopify.int_shopify__discounts__abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout->14. model.shopify.shopify__customer_emails 26. model.shopify_source.stg_shopify__abandoned_checkout->15. model.shopify.shopify__customers 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code->4. model.shopify.int_shopify__discounts__abandoned_checkouts 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp->27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line->4. model.shopify.int_shopify__discounts__abandoned_checkouts 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp->29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp->26. model.shopify_source.stg_shopify__abandoned_checkout 32. model.shopify_source.stg_shopify__collection 32. model.shopify_source.stg_shopify__collection 32. model.shopify_source.stg_shopify__collection->10. model.shopify.int_shopify__products_with_aggregates 33. model.shopify_source.stg_shopify__collection_product 33. model.shopify_source.stg_shopify__collection_product 33. model.shopify_source.stg_shopify__collection_product->10. model.shopify.int_shopify__products_with_aggregates 34. model.shopify_source.stg_shopify__collection_product_tmp 34. model.shopify_source.stg_shopify__collection_product_tmp 34. model.shopify_source.stg_shopify__collection_product_tmp->33. model.shopify_source.stg_shopify__collection_product 35. model.shopify_source.stg_shopify__collection_tmp 35. model.shopify_source.stg_shopify__collection_tmp 35. model.shopify_source.stg_shopify__collection_tmp->32. model.shopify_source.stg_shopify__collection 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer->1. model.shopify.int_shopify__customer_email_rollup 36. model.shopify_source.stg_shopify__customer->6. model.shopify.int_shopify__emails__order_aggregates 36. model.shopify_source.stg_shopify__customer->15. model.shopify.shopify__customers 37. model.shopify_source.stg_shopify__customer_tag 37. model.shopify_source.stg_shopify__customer_tag 37. model.shopify_source.stg_shopify__customer_tag->1. model.shopify.int_shopify__customer_email_rollup 37. model.shopify_source.stg_shopify__customer_tag->16. model.shopify.shopify__customers__order_aggregates 38. model.shopify_source.stg_shopify__customer_tag_tmp 38. model.shopify_source.stg_shopify__customer_tag_tmp 38. model.shopify_source.stg_shopify__customer_tag_tmp->37. model.shopify_source.stg_shopify__customer_tag 39. model.shopify_source.stg_shopify__customer_tmp 39. model.shopify_source.stg_shopify__customer_tmp 39. model.shopify_source.stg_shopify__customer_tmp->36. model.shopify_source.stg_shopify__customer 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code->18. model.shopify.shopify__discounts 41. model.shopify_source.stg_shopify__discount_code_tmp 41. model.shopify_source.stg_shopify__discount_code_tmp 41. model.shopify_source.stg_shopify__discount_code_tmp->40. model.shopify_source.stg_shopify__discount_code 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment->7. model.shopify.int_shopify__inventory_level__aggregates 42. model.shopify_source.stg_shopify__fulfillment->21. model.shopify.shopify__orders 43. model.shopify_source.stg_shopify__fulfillment_tmp 43. model.shopify_source.stg_shopify__fulfillment_tmp 43. model.shopify_source.stg_shopify__fulfillment_tmp->42. model.shopify_source.stg_shopify__fulfillment 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item->19. model.shopify.shopify__inventory_levels 45. model.shopify_source.stg_shopify__inventory_item_tmp 45. model.shopify_source.stg_shopify__inventory_item_tmp 45. model.shopify_source.stg_shopify__inventory_item_tmp->44. model.shopify_source.stg_shopify__inventory_item 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level->19. model.shopify.shopify__inventory_levels 47. model.shopify_source.stg_shopify__inventory_level_tmp 47. model.shopify_source.stg_shopify__inventory_level_tmp 47. model.shopify_source.stg_shopify__inventory_level_tmp->46. model.shopify_source.stg_shopify__inventory_level 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location->19. model.shopify.shopify__inventory_levels 49. model.shopify_source.stg_shopify__location_tmp 49. model.shopify_source.stg_shopify__location_tmp 49. model.shopify_source.stg_shopify__location_tmp->48. model.shopify_source.stg_shopify__location 50. model.shopify_source.stg_shopify__metafield 50. model.shopify_source.stg_shopify__metafield 51. model.shopify_source.stg_shopify__metafield_tmp 51. model.shopify_source.stg_shopify__metafield_tmp 51. model.shopify_source.stg_shopify__metafield_tmp->50. model.shopify_source.stg_shopify__metafield 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order->6. model.shopify.int_shopify__emails__order_aggregates 52. model.shopify_source.stg_shopify__order->7. model.shopify.int_shopify__inventory_level__aggregates 52. model.shopify_source.stg_shopify__order->16. model.shopify.shopify__customers__order_aggregates 52. model.shopify_source.stg_shopify__order->21. model.shopify.shopify__orders 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment->21. model.shopify.shopify__orders 54. model.shopify_source.stg_shopify__order_adjustment_tmp 54. model.shopify_source.stg_shopify__order_adjustment_tmp 54. model.shopify_source.stg_shopify__order_adjustment_tmp->53. model.shopify_source.stg_shopify__order_adjustment 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code->5. model.shopify.int_shopify__discounts__order_aggregates 55. model.shopify_source.stg_shopify__order_discount_code->21. model.shopify.shopify__orders 56. model.shopify_source.stg_shopify__order_discount_code_tmp 56. model.shopify_source.stg_shopify__order_discount_code_tmp 56. model.shopify_source.stg_shopify__order_discount_code_tmp->55. model.shopify_source.stg_shopify__order_discount_code 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line->7. model.shopify.int_shopify__inventory_level__aggregates 57. model.shopify_source.stg_shopify__order_line->20. model.shopify.shopify__order_lines 57. model.shopify_source.stg_shopify__order_line->22. model.shopify.shopify__orders__order_line_aggregates 58. model.shopify_source.stg_shopify__order_line_refund 58. model.shopify_source.stg_shopify__order_line_refund 58. model.shopify_source.stg_shopify__order_line_refund->23. model.shopify.shopify__orders__order_refunds 59. model.shopify_source.stg_shopify__order_line_refund_tmp 59. model.shopify_source.stg_shopify__order_line_refund_tmp 59. model.shopify_source.stg_shopify__order_line_refund_tmp->58. model.shopify_source.stg_shopify__order_line_refund 60. model.shopify_source.stg_shopify__order_line_tmp 60. model.shopify_source.stg_shopify__order_line_tmp 60. model.shopify_source.stg_shopify__order_line_tmp->57. model.shopify_source.stg_shopify__order_line 61. model.shopify_source.stg_shopify__order_note_attribute 61. model.shopify_source.stg_shopify__order_note_attribute 62. model.shopify_source.stg_shopify__order_note_attribute_tmp 62. model.shopify_source.stg_shopify__order_note_attribute_tmp 62. model.shopify_source.stg_shopify__order_note_attribute_tmp->61. model.shopify_source.stg_shopify__order_note_attribute 63. model.shopify_source.stg_shopify__order_shipping_line 63. model.shopify_source.stg_shopify__order_shipping_line 63. model.shopify_source.stg_shopify__order_shipping_line->8. model.shopify.int_shopify__order__shipping_aggregates 64. model.shopify_source.stg_shopify__order_shipping_line_tmp 64. model.shopify_source.stg_shopify__order_shipping_line_tmp 64. model.shopify_source.stg_shopify__order_shipping_line_tmp->63. model.shopify_source.stg_shopify__order_shipping_line 65. model.shopify_source.stg_shopify__order_shipping_tax_line 65. model.shopify_source.stg_shopify__order_shipping_tax_line 65. model.shopify_source.stg_shopify__order_shipping_tax_line->8. model.shopify.int_shopify__order__shipping_aggregates 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp->65. model.shopify_source.stg_shopify__order_shipping_tax_line 67. model.shopify_source.stg_shopify__order_tag 67. model.shopify_source.stg_shopify__order_tag 67. model.shopify_source.stg_shopify__order_tag->21. model.shopify.shopify__orders 68. model.shopify_source.stg_shopify__order_tag_tmp 68. model.shopify_source.stg_shopify__order_tag_tmp 68. model.shopify_source.stg_shopify__order_tag_tmp->67. model.shopify_source.stg_shopify__order_tag 69. model.shopify_source.stg_shopify__order_tmp 69. model.shopify_source.stg_shopify__order_tmp 69. model.shopify_source.stg_shopify__order_tmp->52. model.shopify_source.stg_shopify__order 70. model.shopify_source.stg_shopify__order_url_tag 70. model.shopify_source.stg_shopify__order_url_tag 70. model.shopify_source.stg_shopify__order_url_tag->21. model.shopify.shopify__orders 71. model.shopify_source.stg_shopify__order_url_tag_tmp 71. model.shopify_source.stg_shopify__order_url_tag_tmp 71. model.shopify_source.stg_shopify__order_url_tag_tmp->70. model.shopify_source.stg_shopify__order_url_tag 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule->18. model.shopify.shopify__discounts 73. model.shopify_source.stg_shopify__price_rule_tmp 73. model.shopify_source.stg_shopify__price_rule_tmp 73. model.shopify_source.stg_shopify__price_rule_tmp->72. model.shopify_source.stg_shopify__price_rule 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product->10. model.shopify.int_shopify__products_with_aggregates 74. model.shopify_source.stg_shopify__product->19. model.shopify.shopify__inventory_levels 75. model.shopify_source.stg_shopify__product_image 75. model.shopify_source.stg_shopify__product_image 75. model.shopify_source.stg_shopify__product_image->10. model.shopify.int_shopify__products_with_aggregates 76. model.shopify_source.stg_shopify__product_image_tmp 76. model.shopify_source.stg_shopify__product_image_tmp 76. model.shopify_source.stg_shopify__product_image_tmp->75. model.shopify_source.stg_shopify__product_image 77. model.shopify_source.stg_shopify__product_tag 77. model.shopify_source.stg_shopify__product_tag 77. model.shopify_source.stg_shopify__product_tag->10. model.shopify.int_shopify__products_with_aggregates 78. model.shopify_source.stg_shopify__product_tag_tmp 78. model.shopify_source.stg_shopify__product_tag_tmp 78. model.shopify_source.stg_shopify__product_tag_tmp->77. model.shopify_source.stg_shopify__product_tag 79. model.shopify_source.stg_shopify__product_tmp 79. model.shopify_source.stg_shopify__product_tmp 79. model.shopify_source.stg_shopify__product_tmp->74. model.shopify_source.stg_shopify__product 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant->10. model.shopify.int_shopify__products_with_aggregates 80. model.shopify_source.stg_shopify__product_variant->19. model.shopify.shopify__inventory_levels 80. model.shopify_source.stg_shopify__product_variant->20. model.shopify.shopify__order_lines 81. model.shopify_source.stg_shopify__product_variant_tmp 81. model.shopify_source.stg_shopify__product_variant_tmp 81. model.shopify_source.stg_shopify__product_variant_tmp->80. model.shopify_source.stg_shopify__product_variant 82. model.shopify_source.stg_shopify__refund 82. model.shopify_source.stg_shopify__refund 82. model.shopify_source.stg_shopify__refund->23. model.shopify.shopify__orders__order_refunds 83. model.shopify_source.stg_shopify__refund_tmp 83. model.shopify_source.stg_shopify__refund_tmp 83. model.shopify_source.stg_shopify__refund_tmp->82. model.shopify_source.stg_shopify__refund 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop->17. model.shopify.shopify__daily_shop 85. model.shopify_source.stg_shopify__shop_tmp 85. model.shopify_source.stg_shopify__shop_tmp 85. model.shopify_source.stg_shopify__shop_tmp->84. model.shopify_source.stg_shopify__shop 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line->20. model.shopify.shopify__order_lines 86. model.shopify_source.stg_shopify__tax_line->22. model.shopify.shopify__orders__order_line_aggregates 87. model.shopify_source.stg_shopify__tax_line_tmp 87. model.shopify_source.stg_shopify__tax_line_tmp 87. model.shopify_source.stg_shopify__tax_line_tmp->86. model.shopify_source.stg_shopify__tax_line 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction->25. model.shopify.shopify__transactions 89. model.shopify_source.stg_shopify__tender_transaction_tmp 89. model.shopify_source.stg_shopify__tender_transaction_tmp 89. model.shopify_source.stg_shopify__tender_transaction_tmp->88. model.shopify_source.stg_shopify__tender_transaction 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction->25. model.shopify.shopify__transactions 91. model.shopify_source.stg_shopify__transaction_tmp 91. model.shopify_source.stg_shopify__transaction_tmp 91. model.shopify_source.stg_shopify__transaction_tmp->90. model.shopify_source.stg_shopify__transaction 92. source.shopify_source.shopify.abandoned_checkout 92. source.shopify_source.shopify.abandoned_checkout 92. source.shopify_source.shopify.abandoned_checkout->31. model.shopify_source.stg_shopify__abandoned_checkout_tmp 93. source.shopify_source.shopify.abandoned_checkout_discount_code 93. source.shopify_source.shopify.abandoned_checkout_discount_code 93. source.shopify_source.shopify.abandoned_checkout_discount_code->28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp 94. source.shopify_source.shopify.abandoned_checkout_shipping_line 94. source.shopify_source.shopify.abandoned_checkout_shipping_line 94. source.shopify_source.shopify.abandoned_checkout_shipping_line->30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp 95. source.shopify_source.shopify.collection 95. source.shopify_source.shopify.collection 95. source.shopify_source.shopify.collection->35. model.shopify_source.stg_shopify__collection_tmp 96. source.shopify_source.shopify.collection_product 96. source.shopify_source.shopify.collection_product 96. source.shopify_source.shopify.collection_product->34. model.shopify_source.stg_shopify__collection_product_tmp 97. source.shopify_source.shopify.customer 97. source.shopify_source.shopify.customer 97. source.shopify_source.shopify.customer->39. model.shopify_source.stg_shopify__customer_tmp 98. source.shopify_source.shopify.customer_tag 98. source.shopify_source.shopify.customer_tag 98. source.shopify_source.shopify.customer_tag->38. model.shopify_source.stg_shopify__customer_tag_tmp 99. source.shopify_source.shopify.discount_code 99. source.shopify_source.shopify.discount_code 99. source.shopify_source.shopify.discount_code->41. model.shopify_source.stg_shopify__discount_code_tmp 100. source.shopify_source.shopify.fulfillment 100. source.shopify_source.shopify.fulfillment 100. source.shopify_source.shopify.fulfillment->43. model.shopify_source.stg_shopify__fulfillment_tmp 101. source.shopify_source.shopify.inventory_item 101. source.shopify_source.shopify.inventory_item 101. source.shopify_source.shopify.inventory_item->45. model.shopify_source.stg_shopify__inventory_item_tmp 102. source.shopify_source.shopify.inventory_level 102. source.shopify_source.shopify.inventory_level 102. source.shopify_source.shopify.inventory_level->47. model.shopify_source.stg_shopify__inventory_level_tmp 103. source.shopify_source.shopify.location 103. source.shopify_source.shopify.location 103. source.shopify_source.shopify.location->49. model.shopify_source.stg_shopify__location_tmp 104. source.shopify_source.shopify.metafield 104. source.shopify_source.shopify.metafield 104. source.shopify_source.shopify.metafield->51. model.shopify_source.stg_shopify__metafield_tmp 105. source.shopify_source.shopify.order 105. source.shopify_source.shopify.order 105. source.shopify_source.shopify.order->69. model.shopify_source.stg_shopify__order_tmp 106. source.shopify_source.shopify.order_adjustment 106. source.shopify_source.shopify.order_adjustment 106. source.shopify_source.shopify.order_adjustment->54. model.shopify_source.stg_shopify__order_adjustment_tmp 107. source.shopify_source.shopify.order_discount_code 107. source.shopify_source.shopify.order_discount_code 107. source.shopify_source.shopify.order_discount_code->56. model.shopify_source.stg_shopify__order_discount_code_tmp 108. source.shopify_source.shopify.order_line 108. source.shopify_source.shopify.order_line 108. source.shopify_source.shopify.order_line->60. model.shopify_source.stg_shopify__order_line_tmp 109. source.shopify_source.shopify.order_line_refund 109. source.shopify_source.shopify.order_line_refund 109. source.shopify_source.shopify.order_line_refund->59. model.shopify_source.stg_shopify__order_line_refund_tmp 110. source.shopify_source.shopify.order_note_attribute 110. source.shopify_source.shopify.order_note_attribute 110. source.shopify_source.shopify.order_note_attribute->62. model.shopify_source.stg_shopify__order_note_attribute_tmp 111. source.shopify_source.shopify.order_shipping_line 111. source.shopify_source.shopify.order_shipping_line 111. source.shopify_source.shopify.order_shipping_line->64. model.shopify_source.stg_shopify__order_shipping_line_tmp 112. source.shopify_source.shopify.order_shipping_tax_line 112. source.shopify_source.shopify.order_shipping_tax_line 112. source.shopify_source.shopify.order_shipping_tax_line->66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp 113. source.shopify_source.shopify.order_tag 113. source.shopify_source.shopify.order_tag 113. source.shopify_source.shopify.order_tag->68. model.shopify_source.stg_shopify__order_tag_tmp 114. source.shopify_source.shopify.order_url_tag 114. source.shopify_source.shopify.order_url_tag 114. source.shopify_source.shopify.order_url_tag->71. model.shopify_source.stg_shopify__order_url_tag_tmp 115. source.shopify_source.shopify.price_rule 115. source.shopify_source.shopify.price_rule 115. source.shopify_source.shopify.price_rule->73. model.shopify_source.stg_shopify__price_rule_tmp 116. source.shopify_source.shopify.product 116. source.shopify_source.shopify.product 116. source.shopify_source.shopify.product->79. model.shopify_source.stg_shopify__product_tmp 117. source.shopify_source.shopify.product_image 117. source.shopify_source.shopify.product_image 117. source.shopify_source.shopify.product_image->76. model.shopify_source.stg_shopify__product_image_tmp 118. source.shopify_source.shopify.product_tag 118. source.shopify_source.shopify.product_tag 118. source.shopify_source.shopify.product_tag->78. model.shopify_source.stg_shopify__product_tag_tmp 119. source.shopify_source.shopify.product_variant 119. source.shopify_source.shopify.product_variant 119. source.shopify_source.shopify.product_variant->81. model.shopify_source.stg_shopify__product_variant_tmp 120. source.shopify_source.shopify.refund 120. source.shopify_source.shopify.refund 120. source.shopify_source.shopify.refund->83. model.shopify_source.stg_shopify__refund_tmp 121. source.shopify_source.shopify.shop 121. source.shopify_source.shopify.shop 121. source.shopify_source.shopify.shop->85. model.shopify_source.stg_shopify__shop_tmp 122. source.shopify_source.shopify.tax_line 122. source.shopify_source.shopify.tax_line 122. source.shopify_source.shopify.tax_line->87. model.shopify_source.stg_shopify__tax_line_tmp 123. source.shopify_source.shopify.tender_transaction 123. source.shopify_source.shopify.tender_transaction 123. source.shopify_source.shopify.tender_transaction->89. model.shopify_source.stg_shopify__tender_transaction_tmp 124. source.shopify_source.shopify.transaction 124. source.shopify_source.shopify.transaction 124. source.shopify_source.shopify.transaction->91. model.shopify_source.stg_shopify__transaction_tmp
1. model.shopify.int_shopify__customer_email_rollup

This SQL query creates a rolled-up view of customer data from Shopify. It combines customer information with their tags, groups customers by email address, and aggregates various attributes. The query performs deduplication by using ROW_NUMBER() to identify the most recent customer record for each email. It also cleans the email addresses by converting them to lowercase. The query integrates customer data with customer tags and aggregates multiple fields, including customer IDs, phone numbers, tags, and various timestamps. It also handles boolean fields by taking the maximum value.

CleaningDeduplicationIntegrationAggregation
SQL Query
WITH customers AS (
  SELECT
    *,
    ROW_NUMBER() OVER (PARTITION BY email ORDER BY created_timestamp DESC) AS customer_index
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer
  WHERE
    NOT email IS NULL /* nonsensical to include any null emails here */
), customer_tags AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer_tag
), rollup_customers AS (
  SELECT
    LOWER(customers.email) AS email, /* fields to group by */
    customers.source_relation,
    LISTAGG(DISTINCT CAST(customers.customer_id AS TEXT), ', ') AS customer_ids, /* fields to string agg together */
    LISTAGG(DISTINCT CAST(customers.phone AS TEXT), ', ') AS phone_numbers,
    LISTAGG(DISTINCT CAST(customer_tags.value AS TEXT), ', ') AS customer_tags,
    MIN(customers.created_timestamp) AS first_account_created_at, /* fields to take aggregates of */
    MAX(customers.created_timestamp) AS last_account_created_at,
    MAX(customers.updated_timestamp) AS last_updated_at,
    MAX(customers.marketing_consent_updated_at) AS marketing_consent_updated_at,
    MAX(customers._fivetran_synced) AS last_fivetran_synced,
    MAX(
      CASE WHEN customers.customer_index = 1 THEN customers.is_tax_exempt ELSE NULL END
    ) AS is_tax_exempt, /* take true if ever given for boolean fields */ /* since this changes every year */
    MAX(customers.is_verified_email) AS is_verified_email
  /* for all other fields, just take the latest value */
  FROM customers
  LEFT JOIN customer_tags
    ON customers.customer_id = customer_tags.customer_id
    AND customers.source_relation = customer_tags.source_relation
  GROUP BY
    1,
    2
)
SELECT
  *
FROM rollup_customers
%3 1. model.shopify.int_shopify__customer_email_rollup 1. model.shopify.int_shopify__customer_email_rollup 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer 37. model.shopify_source.stg_shopify__customer_tag 37. model.shopify_source.stg_shopify__customer_tag
Name Type Comment
2. model.shopify.int_shopify__daily_abandoned_checkouts

This SQL query analyzes abandoned checkouts in a Shopify database. It first filters out deleted checkouts, then aggregates daily data on abandoned checkouts, including counts of unique checkouts, customers, and customer emails. The results are grouped by source relation and date.

FilteringFeaturizationAggregation
SQL Query
WITH abandoned_checkout AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout
  /* "deleted" abandoned checkouts do not appear to have any data tying them to customers, */ /* discounts, or products (and should therefore not get joined in) but let's filter them out here */
  WHERE
    NOT COALESCE(is_deleted, FALSE)
), abandoned_checkout_aggregates AS (
  SELECT
    source_relation,
    CAST(DATE_TRUNC('DAY', created_at) AS DATE) AS date_day,
    COUNT(DISTINCT checkout_id) AS count_abandoned_checkouts,
    COUNT(DISTINCT customer_id) AS count_customers_abandoned_checkout,
    COUNT(DISTINCT email) AS count_customer_emails_abandoned_checkout
  FROM abandoned_checkout
  GROUP BY
    1,
    2
)
SELECT
  *
FROM abandoned_checkout_aggregates
%3 2. model.shopify.int_shopify__daily_abandoned_checkouts 2. model.shopify.int_shopify__daily_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout
Name Type Comment
3. model.shopify.int_shopify__daily_orders

This SQL query performs daily aggregations of Shopify order and order line data. It combines information from orders and order lines, calculating various metrics such as order counts, customer counts, sales totals, discounts, refunds, and product quantities. The query also includes time-based aggregations and creates a comprehensive daily summary of order-related activities and financial metrics.

FilteringIntegrationAggregationFeaturization
SQL Query
WITH orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders
  WHERE
    NOT COALESCE(is_deleted, FALSE)
), order_lines AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__order_lines
), order_aggregates AS (
  SELECT
    source_relation,
    CAST(DATE_TRUNC('DAY', created_timestamp) AS DATE) AS date_day,
    COUNT(DISTINCT order_id) AS count_orders,
    SUM(line_item_count) AS count_line_items,
    AVG(line_item_count) AS avg_line_item_count,
    COUNT(DISTINCT customer_id) AS count_customers,
    COUNT(DISTINCT email) AS count_customer_emails,
    SUM(order_adjusted_total) AS order_adjusted_total,
    AVG(order_adjusted_total) AS avg_order_value,
    SUM(shipping_cost) AS shipping_cost,
    SUM(order_adjustment_amount) AS order_adjustment_amount,
    SUM(order_adjustment_tax_amount) AS order_adjustment_tax_amount,
    SUM(refund_subtotal) AS refund_subtotal,
    SUM(refund_total_tax) AS refund_total_tax,
    SUM(total_discounts) AS total_discounts,
    AVG(total_discounts) AS avg_discount,
    SUM(shipping_discount_amount) AS shipping_discount_amount,
    AVG(shipping_discount_amount) AS avg_shipping_discount_amount,
    SUM(percentage_calc_discount_amount) AS percentage_calc_discount_amount,
    AVG(percentage_calc_discount_amount) AS avg_percentage_calc_discount_amount,
    SUM(fixed_amount_discount_amount) AS fixed_amount_discount_amount,
    AVG(fixed_amount_discount_amount) AS avg_fixed_amount_discount_amount,
    SUM(count_discount_codes_applied) AS count_discount_codes_applied,
    COUNT(DISTINCT location_id) AS count_locations_ordered_from,
    SUM(CASE WHEN count_discount_codes_applied > 0 THEN 1 ELSE 0 END) AS count_orders_with_discounts,
    SUM(CASE WHEN refund_subtotal > 0 THEN 1 ELSE 0 END) AS count_orders_with_refunds,
    MIN(created_timestamp) AS first_order_timestamp,
    MAX(created_timestamp) AS last_order_timestamp
  FROM orders
  GROUP BY
    1,
    2
), order_line_aggregates AS (
  SELECT
    order_lines.source_relation,
    CAST(DATE_TRUNC('DAY', orders.created_timestamp) AS DATE) AS date_day,
    SUM(order_lines.quantity) AS quantity_sold,
    SUM(order_lines.refunded_quantity) AS quantity_refunded,
    SUM(order_lines.quantity_net_refunds) AS quantity_net,
    SUM(order_lines.quantity) / COUNT(DISTINCT order_lines.order_id) AS avg_quantity_sold,
    SUM(order_lines.quantity_net_refunds) / COUNT(DISTINCT order_lines.order_id) AS avg_quantity_net,
    COUNT(DISTINCT order_lines.variant_id) AS count_variants_sold,
    COUNT(DISTINCT order_lines.product_id) AS count_products_sold,
    SUM(
      CASE WHEN order_lines.is_gift_card THEN order_lines.quantity_net_refunds ELSE 0 END
    ) AS quantity_gift_cards_sold,
    SUM(
      CASE
        WHEN order_lines.is_shipping_required
        THEN order_lines.quantity_net_refunds
        ELSE 0
      END
    ) AS quantity_requiring_shipping
  FROM order_lines
  LEFT JOIN orders /* just joining with order to get the created_timestamp */
    ON order_lines.order_id = orders.order_id
    AND order_lines.source_relation = orders.source_relation
  GROUP BY
    1,
    2
), final AS (
  SELECT
    order_aggregates.*,
    order_line_aggregates.quantity_sold,
    order_line_aggregates.quantity_refunded,
    order_line_aggregates.quantity_net,
    order_line_aggregates.count_variants_sold,
    order_line_aggregates.count_products_sold,
    order_line_aggregates.quantity_gift_cards_sold,
    order_line_aggregates.quantity_requiring_shipping,
    order_line_aggregates.avg_quantity_sold,
    order_line_aggregates.avg_quantity_net
  FROM order_aggregates
  LEFT JOIN order_line_aggregates
    ON order_aggregates.date_day = order_line_aggregates.date_day
    AND order_aggregates.source_relation = order_line_aggregates.source_relation
)
SELECT
  *
FROM final
%3 3. model.shopify.int_shopify__daily_orders 3. model.shopify.int_shopify__daily_orders 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders
Name Type Comment
4. model.shopify.int_shopify__discounts__abandoned_checkouts

This SQL query analyzes abandoned checkouts and their associated discounts in a Shopify dataset. It filters out deleted checkouts and empty discount types, joins relevant tables (abandoned checkouts, discount codes, and shipping lines), aggregates data on discounts, prices, and customer counts, and presents a summary of abandoned checkouts grouped by discount code, type, and source relation.

FilteringIntegrationAggregation
SQL Query
WITH abandoned_checkout AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout
  /* "deleted" abandoned checkouts do not appear to have any data tying them to customers, */ /* discounts, or products (and should therefore not get joined in) but let's filter them out here */
  WHERE
    NOT COALESCE(is_deleted, FALSE)
), abandoned_checkout_discount_code AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_discount_code
  /* we need the TYPE of discount (shipping, percentage, fixed_amount) to avoid fanning out of joins */ /* so filter out records that have this */
  WHERE
    COALESCE(type, '') <> ''
), abandoned_checkout_shipping_line AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_shipping_line
), roll_up_shipping_line AS (
  SELECT
    checkout_id,
    source_relation,
    SUM(price) AS price
  FROM abandoned_checkout_shipping_line
  GROUP BY
    1,
    2
), abandoned_checkouts_aggregated AS (
  SELECT
    abandoned_checkout_discount_code.code,
    abandoned_checkout_discount_code.type,
    abandoned_checkout_discount_code.source_relation,
    SUM(abandoned_checkout_discount_code.amount) AS total_abandoned_checkout_discount_amount,
    SUM(COALESCE(abandoned_checkout.total_line_items_price, 0)) AS total_abandoned_checkout_line_items_price,
    SUM(COALESCE(roll_up_shipping_line.price, 0)) AS total_abandoned_checkout_shipping_price,
    COUNT(DISTINCT customer_id) AS count_abandoned_checkout_customers,
    COUNT(DISTINCT email) AS count_abandoned_checkout_customer_emails,
    COUNT(DISTINCT abandoned_checkout.checkout_id) AS count_abandoned_checkouts
  FROM abandoned_checkout_discount_code
  LEFT JOIN abandoned_checkout
    ON abandoned_checkout_discount_code.checkout_id = abandoned_checkout.checkout_id
    AND abandoned_checkout_discount_code.source_relation = abandoned_checkout.source_relation
  LEFT JOIN roll_up_shipping_line
    ON roll_up_shipping_line.checkout_id = abandoned_checkout_discount_code.checkout_id
    AND roll_up_shipping_line.source_relation = abandoned_checkout_discount_code.source_relation
  GROUP BY
    1,
    2,
    3
)
SELECT
  *
FROM abandoned_checkouts_aggregated
%3 4. model.shopify.int_shopify__discounts__abandoned_checkouts 4. model.shopify.int_shopify__discounts__abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line
Name Type Comment
5. model.shopify.int_shopify__discounts__order_aggregates

This SQL query aggregates order discount data from Shopify. It joins order discount codes with order details, then calculates various metrics such as average and total discount amounts, total order prices, shipping costs, refund amounts, and counts of unique customers and orders for each discount code. The results are grouped by discount code, type, and source relation.

IntegrationAggregation
SQL Query
WITH order_discount_code AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_discount_code
), orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders
), orders_aggregated AS (
  SELECT
    order_discount_code.code,
    order_discount_code.type,
    order_discount_code.source_relation,
    AVG(order_discount_code.amount) AS avg_order_discount_amount,
    SUM(order_discount_code.amount) AS total_order_discount_amount,
    MAX(orders.total_line_items_price) AS total_order_line_items_price, /* summing would multiply the total by the # of discount codes applied to an order */
    MAX(orders.shipping_cost) AS total_order_shipping_cost, /* summing would multiply the total by the # of discount codes applied to an order */
    MAX(orders.refund_subtotal + orders.refund_total_tax) AS total_order_refund_amount, /* summing would multiply the total by the # of discount codes applied to an order */
    COUNT(DISTINCT customer_id) AS count_customers,
    COUNT(DISTINCT email) AS count_customer_emails,
    COUNT(DISTINCT order_discount_code.order_id) AS count_orders
  FROM order_discount_code
  JOIN orders
    ON order_discount_code.order_id = orders.order_id
    AND order_discount_code.source_relation = orders.source_relation
  GROUP BY
    1,
    2,
    3
)
SELECT
  *
FROM orders_aggregated
%3 5. model.shopify.int_shopify__discounts__order_aggregates 5. model.shopify.int_shopify__discounts__order_aggregates 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code
Name Type Comment
6. model.shopify.int_shopify__emails__order_aggregates

This SQL query aggregates and analyzes customer order data from Shopify. It combines information from various tables including orders, transactions, customers, and order line aggregates. The query calculates several metrics for each customer email and source relation, such as first and most recent order timestamps, average order value, lifetime total spent, refunded amounts, order counts, and various aggregations related to quantity, tax, discounts, and shipping. The result provides a comprehensive view of customer purchasing behavior and order statistics.

FilteringCleaningIntegrationAggregationFeaturization
SQL Query
WITH orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
), order_aggregates AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders__order_line_aggregates
), transactions AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__transactions
  WHERE
    LOWER(status) = 'success'
    AND NOT LOWER(kind) IN ('authorization', 'void')
    AND LOWER(gateway) <> 'gift_card' /* redeeming a giftcard does not introduce new revenue */
), transaction_aggregates AS (
  /* this is necessary as customers can pay via multiple payment gateways */
  SELECT
    order_id,
    source_relation,
    LOWER(kind) AS kind,
    SUM(currency_exchange_calculated_amount) AS currency_exchange_calculated_amount
  FROM transactions
  GROUP BY
    1,
    2,
    3
), customer_emails AS (
  /* in case any orders records don't have the customer email attached yet */
  SELECT
    customer_id,
    source_relation,
    email
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer
  WHERE
    NOT email IS NULL
  GROUP BY
    1,
    2,
    3
), aggregated AS (
  SELECT
    LOWER(customer_emails.email) AS email,
    orders.source_relation,
    MIN(orders.created_timestamp) AS first_order_timestamp,
    MAX(orders.created_timestamp) AS most_recent_order_timestamp,
    AVG(transaction_aggregates.currency_exchange_calculated_amount) AS avg_order_value,
    SUM(transaction_aggregates.currency_exchange_calculated_amount) AS lifetime_total_spent,
    SUM(refunds.currency_exchange_calculated_amount) AS lifetime_total_refunded,
    COUNT(DISTINCT orders.order_id) AS lifetime_count_orders,
    AVG(order_aggregates.order_total_quantity) AS avg_quantity_per_order,
    SUM(order_aggregates.order_total_tax) AS lifetime_total_tax,
    AVG(order_aggregates.order_total_tax) AS avg_tax_per_order,
    SUM(order_aggregates.order_total_discount) AS lifetime_total_discount,
    AVG(order_aggregates.order_total_discount) AS avg_discount_per_order,
    SUM(order_aggregates.order_total_shipping) AS lifetime_total_shipping,
    AVG(order_aggregates.order_total_shipping) AS avg_shipping_per_order,
    SUM(order_aggregates.order_total_shipping_with_discounts) AS lifetime_total_shipping_with_discounts,
    AVG(order_aggregates.order_total_shipping_with_discounts) AS avg_shipping_with_discounts_per_order,
    SUM(order_aggregates.order_total_shipping_tax) AS lifetime_total_shipping_tax,
    AVG(order_aggregates.order_total_shipping_tax) AS avg_shipping_tax_per_order
  FROM orders
  JOIN customer_emails
    ON orders.customer_id = customer_emails.customer_id
    AND orders.source_relation = customer_emails.source_relation
  LEFT JOIN transaction_aggregates
    ON orders.order_id = transaction_aggregates.order_id
    AND orders.source_relation = transaction_aggregates.source_relation
    AND transaction_aggregates.kind IN ('sale', 'capture')
  LEFT JOIN transaction_aggregates AS refunds
    ON orders.order_id = refunds.order_id
    AND orders.source_relation = refunds.source_relation
    AND refunds.kind = 'refund'
  LEFT JOIN order_aggregates
    ON orders.order_id = order_aggregates.order_id
    AND orders.source_relation = order_aggregates.source_relation
  GROUP BY
    1,
    2
)
SELECT
  *
FROM aggregated
%3 6. model.shopify.int_shopify__emails__order_aggregates 6. model.shopify.int_shopify__emails__order_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order
Name Type Comment
7. model.shopify.int_shopify__inventory_level__aggregates

This SQL query aggregates inventory-related data from Shopify orders, focusing on sales, refunds, and fulfillment statistics. It joins various tables (orders, order lines, fulfillments, and refunds) to create a comprehensive view of inventory movements. The query calculates metrics such as total sales, quantity sold, unique orders and customers, first and last order dates, fulfillment status counts, and refund information. The results are grouped by variant ID, location ID, and source relation.

IntegrationAggregationCleaningFeaturization
SQL Query
WITH __dbt__cte__shopify__orders__order_refunds AS (
  WITH refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__refund
  ), order_line_refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_refund
  ), refund_join AS (
    SELECT
      refunds.refund_id,
      refunds.created_at,
      refunds.order_id,
      refunds.user_id,
      refunds.source_relation,
      order_line_refunds.order_line_refund_id,
      order_line_refunds.order_line_id,
      order_line_refunds.restock_type,
      order_line_refunds.quantity,
      order_line_refunds.subtotal,
      order_line_refunds.total_tax
    FROM refunds
    LEFT JOIN order_line_refunds
      ON refunds.refund_id = order_line_refunds.refund_id
      AND refunds.source_relation = order_line_refunds.source_relation
  )
  SELECT
    *
  FROM refund_join
), order_lines AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line
), fulfillment AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__fulfillment
), orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
  WHERE
    NOT COALESCE(is_deleted, FALSE)
), refunds AS (
  SELECT
    *
  FROM __dbt__cte__shopify__orders__order_refunds
), refunds_aggregated AS (
  SELECT
    order_line_id,
    source_relation,
    SUM(quantity) AS quantity,
    SUM(COALESCE(subtotal, 0)) AS subtotal
  FROM refunds
  GROUP BY
    1,
    2
), joined AS (
  SELECT
    order_lines.order_line_id,
    order_lines.variant_id,
    order_lines.source_relation,
    fulfillment.location_id, /* location id is stored in fulfillment rather than order */
    orders.order_id,
    orders.customer_id,
    fulfillment.fulfillment_id,
    LOWER(orders.email) AS email,
    order_lines.pre_tax_price,
    order_lines.quantity,
    orders.created_timestamp AS order_created_timestamp,
    fulfillment.status AS fulfillment_status,
    refunds_aggregated.subtotal AS subtotal_sold_refunds,
    refunds_aggregated.quantity AS quantity_sold_refunds
  FROM order_lines
  JOIN orders
    ON order_lines.order_id = orders.order_id
    AND order_lines.source_relation = orders.source_relation
  JOIN fulfillment
    ON orders.order_id = fulfillment.order_id
    AND orders.source_relation = fulfillment.source_relation
  LEFT JOIN refunds_aggregated
    ON refunds_aggregated.order_line_id = order_lines.order_line_id
    AND refunds_aggregated.source_relation = order_lines.source_relation
), aggregated AS (
  SELECT
    variant_id,
    location_id,
    source_relation,
    SUM(pre_tax_price) AS subtotal_sold,
    SUM(quantity) AS quantity_sold,
    COUNT(DISTINCT order_id) AS count_distinct_orders,
    COUNT(DISTINCT customer_id) AS count_distinct_customers,
    COUNT(DISTINCT email) AS count_distinct_customer_emails,
    MIN(order_created_timestamp) AS first_order_timestamp,
    MAX(order_created_timestamp) AS last_order_timestamp,
    COUNT(DISTINCT CASE WHEN fulfillment_status = 'pending' THEN fulfillment_id END) AS count_fulfillment_pending,
    COUNT(DISTINCT CASE WHEN fulfillment_status = 'open' THEN fulfillment_id END) AS count_fulfillment_open,
    COUNT(DISTINCT CASE WHEN fulfillment_status = 'success' THEN fulfillment_id END) AS count_fulfillment_success,
    COUNT(DISTINCT CASE WHEN fulfillment_status = 'cancelled' THEN fulfillment_id END) AS count_fulfillment_cancelled,
    COUNT(DISTINCT CASE WHEN fulfillment_status = 'error' THEN fulfillment_id END) AS count_fulfillment_error,
    COUNT(DISTINCT CASE WHEN fulfillment_status = 'failure' THEN fulfillment_id END) AS count_fulfillment_failure,
    SUM(COALESCE(subtotal_sold_refunds, 0)) AS subtotal_sold_refunds,
    SUM(COALESCE(quantity_sold_refunds, 0)) AS quantity_sold_refunds
  FROM joined
  GROUP BY
    1,
    2,
    3
)
SELECT
  *
FROM aggregated
%3 7. model.shopify.int_shopify__inventory_level__aggregates 7. model.shopify.int_shopify__inventory_level__aggregates 23. model.shopify.shopify__orders__order_refunds 23. model.shopify.shopify__orders__order_refunds 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line
Name Type Comment
8. model.shopify.int_shopify__order__shipping_aggregates

This SQL query calculates shipping-related aggregates for Shopify orders. It joins order shipping line data with order shipping tax line data, then aggregates the shipping price, discounted shipping price, and shipping tax for each order. The result provides a summary of shipping costs and taxes per order.

IntegrationAggregation
SQL Query
WITH order_shipping_line AS (
  SELECT
    order_id,
    source_relation,
    order_shipping_line_id,
    SUM(price) AS shipping_price,
    SUM(discounted_price) AS discounted_shipping_price
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_shipping_line
  GROUP BY
    1,
    2,
    3
), order_shipping_tax_line AS (
  SELECT
    order_shipping_line_id,
    source_relation,
    SUM(price) AS shipping_tax
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_shipping_tax_line
  GROUP BY
    1,
    2
), aggregated AS (
  SELECT
    order_shipping_line.order_id,
    order_shipping_line.source_relation,
    SUM(order_shipping_line.shipping_price) AS shipping_price,
    SUM(order_shipping_line.discounted_shipping_price) AS discounted_shipping_price,
    SUM(order_shipping_tax_line.shipping_tax) AS shipping_tax
  FROM order_shipping_line
  LEFT JOIN order_shipping_tax_line
    ON order_shipping_line.order_shipping_line_id = order_shipping_tax_line.order_shipping_line_id
    AND order_shipping_line.source_relation = order_shipping_tax_line.source_relation
  GROUP BY
    1,
    2
)
SELECT
  *
FROM aggregated
%3 8. model.shopify.int_shopify__order__shipping_aggregates 8. model.shopify.int_shopify__order__shipping_aggregates 63. model.shopify_source.stg_shopify__order_shipping_line 63. model.shopify_source.stg_shopify__order_shipping_line 65. model.shopify_source.stg_shopify__order_shipping_tax_line 65. model.shopify_source.stg_shopify__order_shipping_tax_line
Name Type Comment
9. model.shopify.int_shopify__product__order_line_aggregates

This SQL query aggregates data from Shopify order lines and orders to create product-level metrics. It calculates various sales statistics for each product, including quantity sold, subtotal, refunds, first and most recent order dates, discounts, taxes, and average quantities and amounts per order line. The query joins order lines with orders and groups the results by product ID and source relation.

IntegrationAggregationFeaturization
SQL Query
WITH order_lines AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__order_lines
), orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders
), product_aggregated AS (
  SELECT
    order_lines.product_id,
    order_lines.source_relation,
    SUM(order_lines.quantity) AS quantity_sold, /* moved over from shopify__products */
    SUM(order_lines.pre_tax_price) AS subtotal_sold,
    SUM(order_lines.quantity_net_refunds) AS quantity_sold_net_refunds,
    SUM(order_lines.subtotal_net_refunds) AS subtotal_sold_net_refunds,
    MIN(orders.created_timestamp) AS first_order_timestamp,
    MAX(orders.created_timestamp) AS most_recent_order_timestamp,
    SUM(order_lines.total_discount) AS product_total_discount, /* new columns */
    SUM(order_lines.order_line_tax) AS product_total_tax,
    AVG(order_lines.quantity) AS avg_quantity_per_order_line,
    AVG(order_lines.total_discount) AS product_avg_discount_per_order_line,
    AVG(order_lines.order_line_tax) AS product_avg_tax_per_order_line
  FROM order_lines
  LEFT JOIN orders
    ON order_lines.order_id = orders.order_id
    AND order_lines.source_relation = orders.source_relation
  GROUP BY
    1,
    2
)
SELECT
  *
FROM product_aggregated
%3 9. model.shopify.int_shopify__product__order_line_aggregates 9. model.shopify.int_shopify__product__order_line_aggregates 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders
Name Type Comment
10. model.shopify.int_shopify__products_with_aggregates

This SQL query integrates data from multiple Shopify-related tables to create a comprehensive view of products. It joins product information with aggregated data from collections, tags, variants, and images. The query performs several aggregations, including collecting collections and tags into comma-separated lists, counting variants and images, and determining if a product has an image. The result is a detailed product dataset with additional attributes derived from related tables.

IntegrationAggregationFeaturization
SQL Query
WITH products AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product
), collection_product AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__collection_product
), collection AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__collection
  WHERE
    NOT COALESCE(is_deleted, FALSE) /* limit to only active collections */
), product_tag AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_tag
), product_variant AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_variant
), product_image AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_image
), collections_aggregated AS (
  SELECT
    collection_product.product_id,
    collection_product.source_relation,
    LISTAGG(collection.title, ', ') AS collections
  FROM collection_product
  JOIN collection
    ON collection_product.collection_id = collection.collection_id
    AND collection_product.source_relation = collection.source_relation
  GROUP BY
    1,
    2
), tags_aggregated AS (
  SELECT
    product_id,
    source_relation,
    LISTAGG(value, ', ') AS tags
  FROM product_tag
  GROUP BY
    1,
    2
), variants_aggregated AS (
  SELECT
    product_id,
    source_relation,
    COUNT(variant_id) AS count_variants
  FROM product_variant
  GROUP BY
    1,
    2
), images_aggregated AS (
  SELECT
    product_id,
    source_relation,
    COUNT(*) AS count_images
  FROM product_image
  GROUP BY
    1,
    2
), joined AS (
  SELECT
    products.*,
    collections_aggregated.collections,
    tags_aggregated.tags,
    variants_aggregated.count_variants,
    COALESCE(images_aggregated.count_images, 0) > 0 AS has_product_image
  FROM products
  LEFT JOIN collections_aggregated
    ON products.product_id = collections_aggregated.product_id
    AND products.source_relation = collections_aggregated.source_relation
  LEFT JOIN tags_aggregated
    ON products.product_id = tags_aggregated.product_id
    AND products.source_relation = tags_aggregated.source_relation
  LEFT JOIN variants_aggregated
    ON products.product_id = variants_aggregated.product_id
    AND products.source_relation = variants_aggregated.source_relation
  LEFT JOIN images_aggregated
    ON products.product_id = images_aggregated.product_id
    AND products.source_relation = images_aggregated.source_relation
)
SELECT
  *
FROM joined
%3 10. model.shopify.int_shopify__products_with_aggregates 10. model.shopify.int_shopify__products_with_aggregates 32. model.shopify_source.stg_shopify__collection 32. model.shopify_source.stg_shopify__collection 33. model.shopify_source.stg_shopify__collection_product 33. model.shopify_source.stg_shopify__collection_product 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product 75. model.shopify_source.stg_shopify__product_image 75. model.shopify_source.stg_shopify__product_image 77. model.shopify_source.stg_shopify__product_tag 77. model.shopify_source.stg_shopify__product_tag 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant
Name Type Comment
11. model.shopify.shopify__calendar

This SQL query generates a calendar table with daily dates from January 1, 2019, up to the current date. It uses a clever bit manipulation technique to create a sequence of numbers, which are then transformed into dates. The result is a filtered list of dates within the specified range.

FeaturizationFilteringOther
SQL Query
WITH rawdata AS (
  WITH p AS (
    SELECT
      0 AS generated_number
    UNION ALL
    SELECT
      1
  ), unioned AS (
    SELECT
      p0.generated_number * POWER(2, 0) + p1.generated_number * POWER(2, 1) + p2.generated_number * POWER(2, 2) + p3.generated_number * POWER(2, 3) + p4.generated_number * POWER(2, 4) + p5.generated_number * POWER(2, 5) + p6.generated_number * POWER(2, 6) + p7.generated_number * POWER(2, 7) + p8.generated_number * POWER(2, 8) + p9.generated_number * POWER(2, 9) + p10.generated_number * POWER(2, 10) + 1 AS generated_number
    FROM p AS p0
    CROSS JOIN p AS p1
    CROSS JOIN p AS p2
    CROSS JOIN p AS p3
    CROSS JOIN p AS p4
    CROSS JOIN p AS p5
    CROSS JOIN p AS p6
    CROSS JOIN p AS p7
    CROSS JOIN p AS p8
    CROSS JOIN p AS p9
    CROSS JOIN p AS p10
  )
  SELECT
    *
  FROM unioned
  WHERE
    generated_number <= 2041
  ORDER BY
    generated_number
), all_periods AS (
  SELECT
    (
      DATEADD(day, ROW_NUMBER() OVER (ORDER BY 1) - 1, CAST('2019-01-01' AS DATE))
    ) AS date_day
  FROM rawdata
), filtered AS (
  SELECT
    *
  FROM all_periods
  WHERE
    date_day <= CURRENT_DATE
)
SELECT
  *
FROM filtered
%3 11. model.shopify.shopify__calendar 11. model.shopify.shopify__calendar
Name Type Comment
12. model.shopify.shopify__customer_cohorts

This SQL query creates customer cohorts based on their first order date and calculates various metrics for each customer on a monthly basis. It joins customer data with order data, calculates lifetime metrics using window functions, and assigns a unique identifier to each customer cohort. The query provides a comprehensive view of customer behavior over time, including order counts, total prices, and line item counts both for individual months and cumulatively.

IntegrationAggregationFeaturizationOther
SQL Query
WITH calendar AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__calendar
  WHERE
    CAST(DATE_TRUNC('MONTH', date_day) AS DATE) = date_day
), customers AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__customers
), orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders
), customer_calendar AS (
  SELECT
    CAST(calendar.date_day AS DATE) AS date_month,
    customers.customer_id,
    customers.first_order_timestamp,
    customers.source_relation,
    CAST(DATE_TRUNC('MONTH', first_order_timestamp) AS DATE) AS cohort_month
  FROM calendar
  INNER JOIN customers
    ON CAST(DATE_TRUNC('MONTH', first_order_timestamp) AS DATE) <= calendar.date_day
), orders_joined AS (
  SELECT
    customer_calendar.date_month,
    customer_calendar.customer_id,
    customer_calendar.first_order_timestamp,
    customer_calendar.cohort_month,
    customer_calendar.source_relation,
    COALESCE(COUNT(DISTINCT orders.order_id), 0) AS order_count_in_month,
    COALESCE(SUM(orders.order_adjusted_total), 0) AS total_price_in_month,
    COALESCE(SUM(orders.line_item_count), 0) AS line_item_count_in_month
  FROM customer_calendar
  LEFT JOIN orders
    ON customer_calendar.customer_id = orders.customer_id
    AND customer_calendar.source_relation = orders.source_relation
    AND customer_calendar.date_month = CAST(DATE_TRUNC('MONTH', created_timestamp) AS DATE)
  GROUP BY
    1,
    2,
    3,
    4,
    5
), windows AS (
  SELECT
    *,
    SUM(total_price_in_month) OVER (PARTITION BY customer_id ORDER BY date_month rows BETWEEN UNBOUNDED preceding AND CURRENT ROW) AS total_price_lifetime,
    SUM(order_count_in_month) OVER (PARTITION BY customer_id ORDER BY date_month rows BETWEEN UNBOUNDED preceding AND CURRENT ROW) AS order_count_lifetime,
    SUM(line_item_count_in_month) OVER (PARTITION BY customer_id ORDER BY date_month rows BETWEEN UNBOUNDED preceding AND CURRENT ROW) AS line_item_count_lifetime,
    ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY date_month ASC) AS cohort_month_number
  FROM orders_joined
), final AS (
  SELECT
    *,
    MD5(
      CAST(COALESCE(CAST(date_month AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(customer_id AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(source_relation AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS customer_cohort_id
  FROM windows
)
SELECT
  *
FROM final
%3 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts cohort_month cohort_month_number customer_cohort_id customer_id date_month first_order_timestamp line_item_count_in_month line_item_count_lifetime order_count_in_month order_count_lifetime source_relation total_price_in_month total_price_lifetime 11. model.shopify.shopify__calendar 11. model.shopify.shopify__calendar 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers customer_id first_order_timestamp source_relation 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f3 15. model.shopify.shopify__customers:f1->12. model.shopify.shopify__customer_cohorts:f5 15. model.shopify.shopify__customers:f1->12. model.shopify.shopify__customer_cohorts:f0 15. model.shopify.shopify__customers:f2->12. model.shopify.shopify__customer_cohorts:f10 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_id order_id source_relation line_item_count order_adjusted_total 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f3 21. model.shopify.shopify__orders:f1->12. model.shopify.shopify__customer_cohorts:f8 21. model.shopify.shopify__orders:f1->12. model.shopify.shopify__customer_cohorts:f9 21. model.shopify.shopify__orders:f2->12. model.shopify.shopify__customer_cohorts:f10 21. model.shopify.shopify__orders:f3->12. model.shopify.shopify__customer_cohorts:f6 21. model.shopify.shopify__orders:f3->12. model.shopify.shopify__customer_cohorts:f7 21. model.shopify.shopify__orders:f4->12. model.shopify.shopify__customer_cohorts:f11 21. model.shopify.shopify__orders:f4->12. model.shopify.shopify__customer_cohorts:f12
Name Type Comment
cohort_month None The month the cohort belongs to, i.e the first month the customer had an order.
cohort_month_number None The 'number' of the `date_month` of the record, i.e. how many months from their start month this cohort occurred
customer_cohort_id None Unique key representing a customer in a given month. Hashed on 'date_month', 'customer_id', and 'source_relation'.
customer_id None The ID of the related customer.
date_month None The calendar month the customer stats relate to.
first_order_timestamp None The timestamp of the customer's first order.
line_item_count_in_month None Number of line items purchased in the `date_month`
line_item_count_lifetime None Number of line items purchased up until and including this `date_month`.
order_count_in_month None Number of orders purchased in the `date_month`
order_count_lifetime None Number of orders purchased up until and including this `date_month`.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
total_price_in_month None Total amount (in shop currency) purchased in the `date_month`
total_price_lifetime None Total amount (in shop currency) up until and including this `date_month`.
Column Lineage
%3 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers first_order_timestamp 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts cohort_month first_order_timestamp 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f1 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[first_order_timestamp]
    • Direct This column is directly copied to the output
    • Integration Used to join with the calendar table
    • Featurization Used to calculate the cohort_month
    • Output Columns:
      • first_order_timestamp: Directly copied
      • cohort_month: Transformed (DATE_TRUNC)
Column Lineage
%3 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers customer_id 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts customer_id 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_id customer_order_seq_number new_vs_repeat 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer customer_id 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order customer_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f2
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[customer_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as a key to join with other tables
    • Output Columns:
      • customer_id: Directly copied to the output
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_id]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number and new vs repeat customer status
    • Output Columns:
      • customer_id: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
      • new_vs_repeat: Used to determine if the order is from a new or repeat customer
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[customer_id]
    • Integration Used as a key to join the customers table with the orders table
    • Deduplication Used in window functions to partition data by customer
    • Output Columns:
      • customer_id: Directly copied to the output
  • Input Column: 21. model.shopify.shopify__orders[customer_id]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in window functions to partition data
    • Output Columns:
      • customer_id: Directly copied to output
Column Lineage
%3 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers first_order_timestamp 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts cohort_month first_order_timestamp 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f1 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[first_order_timestamp]
    • Direct This column is directly copied to the output
    • Integration Used to join with the calendar table
    • Featurization Used to calculate the cohort_month
    • Output Columns:
      • first_order_timestamp: Directly copied
      • cohort_month: Transformed (DATE_TRUNC)
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders line_item_count 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts line_item_count_in_month line_item_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[line_item_count]
    • Aggregation The column is summed up in the GROUP BY clause
    • Output Columns:
      • line_item_count_in_month: Aggregated sum for each month
      • line_item_count_lifetime: Cumulative sum using window function
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders line_item_count 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts line_item_count_in_month line_item_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[line_item_count]
    • Aggregation The column is summed up in the GROUP BY clause
    • Output Columns:
      • line_item_count_in_month: Aggregated sum for each month
      • line_item_count_lifetime: Cumulative sum using window function
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation The column is counted distinctly in the GROUP BY clause
    • Output Columns:
      • order_count_in_month: Distinct count for each month
      • order_count_lifetime: Cumulative distinct count using window function
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation The column is counted distinctly in the GROUP BY clause
    • Output Columns:
      • order_count_in_month: Distinct count for each month
      • order_count_lifetime: Cumulative distinct count using window function
Column Lineage
%3 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers source_relation 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders orders_unique_key source_relation 21. model.shopify.shopify__orders:f1->12. model.shopify.shopify__customer_cohorts:f0 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout source_relation 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f0 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer source_relation 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order source_relation 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment source_relation 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f1
15. model.shopify.shopify__customers
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[source_relation]
    • Integration This column is used as a key to join with other tables in the query
    • Aggregation It's part of the GROUP BY clause in the abandoned checkouts subquery
    • Output Columns:
      • source_relation: It's directly copied to the output 'source_relation' column
  • Input Column: 36. model.shopify_source.stg_shopify__customer[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • source_relation: Directly copied and used in joins
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for orders
    • Output Columns:
      • source_relation: Directly copied
      • orders_unique_key: Part of the MD5 hash to create a unique key
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[source_relation]
    • Integration This column is used as a key to join the order_adjustments table with other tables in the query, ensuring that adjustments are correctly associated with their corresponding orders.
    • Aggregation The column is used in the GROUP BY clause of the order_adjustments_aggregates CTE, allowing for aggregation of adjustment amounts per order and source.
    • Output Columns:
      • source_relation: This column is directly copied to the output, maintaining the information about the source of each order and its associated data.
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used to join with the orders table
    • Output Columns:
      • source_relation: Directly copied
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in creating the customer_cohort_id
    • Output Columns:
      • source_relation: Directly copied to output
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: Aggregated as the sum of order_adjusted_total for each month
      • total_price_lifetime: Further aggregated as a cumulative sum over time
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: Aggregated as the sum of order_adjusted_total for each month
      • total_price_lifetime: Further aggregated as a cumulative sum over time
13. model.shopify.shopify__customer_email_cohorts

This SQL query creates customer email cohorts for Shopify data. It combines calendar, customer, and order data to track customer behavior over time. The query calculates monthly and lifetime metrics for each customer, including order count, total price, and line item count. It also assigns a cohort month and a unique customer cohort ID to each record.

IntegrationAggregationFeaturizationOther
SQL Query
WITH calendar AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__calendar
  WHERE
    CAST(DATE_TRUNC('MONTH', date_day) AS DATE) = date_day
), customers AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__customer_emails
), orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders
), customer_calendar AS (
  SELECT
    CAST(calendar.date_day AS DATE) AS date_month,
    customers.email,
    customers.first_order_timestamp,
    customers.source_relation,
    DATE_TRUNC('MONTH', first_order_timestamp) AS cohort_month
  FROM calendar
  INNER JOIN customers
    ON CAST(DATE_TRUNC('MONTH', first_order_timestamp) AS DATE) <= calendar.date_day
), orders_joined AS (
  SELECT
    customer_calendar.date_month,
    customer_calendar.email,
    customer_calendar.first_order_timestamp,
    customer_calendar.cohort_month,
    customer_calendar.source_relation,
    COALESCE(COUNT(DISTINCT orders.order_id), 0) AS order_count_in_month,
    COALESCE(SUM(orders.order_adjusted_total), 0) AS total_price_in_month,
    COALESCE(SUM(orders.line_item_count), 0) AS line_item_count_in_month
  FROM customer_calendar
  LEFT JOIN orders
    ON customer_calendar.email = orders.email
    AND customer_calendar.source_relation = orders.source_relation
    AND customer_calendar.date_month = CAST(DATE_TRUNC('MONTH', created_timestamp) AS DATE)
  GROUP BY
    1,
    2,
    3,
    4,
    5
), windows AS (
  SELECT
    *,
    SUM(total_price_in_month) OVER (PARTITION BY email ORDER BY date_month rows BETWEEN UNBOUNDED preceding AND CURRENT ROW) AS total_price_lifetime,
    SUM(order_count_in_month) OVER (PARTITION BY email ORDER BY date_month rows BETWEEN UNBOUNDED preceding AND CURRENT ROW) AS order_count_lifetime,
    SUM(line_item_count_in_month) OVER (PARTITION BY email ORDER BY date_month rows BETWEEN UNBOUNDED preceding AND CURRENT ROW) AS line_item_count_lifetime,
    ROW_NUMBER() OVER (PARTITION BY email ORDER BY date_month ASC) AS cohort_month_number
  FROM orders_joined
), final AS (
  SELECT
    *,
    MD5(
      CAST(COALESCE(CAST(date_month AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(email AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(source_relation AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS customer_cohort_id
  FROM windows
)
SELECT
  *
FROM final
%3 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts cohort_month cohort_month_number customer_cohort_id email date_month first_order_timestamp line_item_count_in_month line_item_count_lifetime order_count_in_month order_count_lifetime source_relation total_price_in_month total_price_lifetime 11. model.shopify.shopify__calendar 11. model.shopify.shopify__calendar 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails email first_order_timestamp source_relation 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f3 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f2 14. model.shopify.shopify__customer_emails:f1->13. model.shopify.shopify__customer_email_cohorts:f5 14. model.shopify.shopify__customer_emails:f1->13. model.shopify.shopify__customer_email_cohorts:f0 14. model.shopify.shopify__customer_emails:f2->13. model.shopify.shopify__customer_email_cohorts:f10 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders email order_id source_relation total_price line_item_count order_adjusted_total 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f3 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f8 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f9 21. model.shopify.shopify__orders:f2->13. model.shopify.shopify__customer_email_cohorts:f10 21. model.shopify.shopify__orders:f3->13. model.shopify.shopify__customer_email_cohorts:f11 21. model.shopify.shopify__orders:f3->13. model.shopify.shopify__customer_email_cohorts:f12 21. model.shopify.shopify__orders:f4->13. model.shopify.shopify__customer_email_cohorts:f6 21. model.shopify.shopify__orders:f4->13. model.shopify.shopify__customer_email_cohorts:f7 21. model.shopify.shopify__orders:f5->13. model.shopify.shopify__customer_email_cohorts:f11 21. model.shopify.shopify__orders:f5->13. model.shopify.shopify__customer_email_cohorts:f12
Name Type Comment
cohort_month None The month the cohort belongs to, i.e the first month the customer had an order.
cohort_month_number None The 'number' of the `date_month` of the record, i.e. how many months from their start month this cohort occurred
customer_cohort_id None Unique key representing a customer in a given month. Hashed on 'date_month','email', and 'source_relation'.
email None The ID of the related customer.
date_month None The calendar month the customer stats relate to.
first_order_timestamp None The timestamp of the customer's first order.
line_item_count_in_month None Number of line items purchased in the `date_month`
line_item_count_lifetime None Number of line items purchased up until and including this `date_month`.
order_count_in_month None Number of orders purchased in the `date_month`
order_count_lifetime None Number of orders purchased up until and including this `date_month`.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
total_price_in_month None Total amount (in shop currency) purchased in the `date_month`
total_price_lifetime None Total amount (in shop currency) up until and including this `date_month`.
Column Lineage
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails first_order_timestamp 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts cohort_month first_order_timestamp 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[first_order_timestamp]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the calendar table
    • Featurization Used to create the cohort_month
    • Output Columns:
      • first_order_timestamp: Directly copied
      • cohort_month: Transformed by applying DATE_TRUNC('MONTH', first_order_timestamp)
Column Lineage
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails email 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts customer_cohort_id email 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout email 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[email]
    • Cleaning The email is converted to lowercase
    • Aggregation The email is used in GROUP BY clause
    • Output Columns:
      • email: The lowercase email is directly mapped to the output 'email' column
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the orders table
    • Deduplication Used in window functions to partition data
    • Other Used in the MD5 hash to create the customer_cohort_id
    • Output Columns:
      • email: Directly copied
      • customer_cohort_id: Part of the MD5 hash
Column Lineage
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails email 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts customer_cohort_id email 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders email 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout email 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order email 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[email]
    • Cleaning The email is converted to lowercase
    • Aggregation The email is used in GROUP BY clause
    • Output Columns:
      • email: The lowercase email is directly mapped to the output 'email' column
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the orders table
    • Deduplication Used in window functions to partition data
    • Other Used in the MD5 hash to create the customer_cohort_id
    • Output Columns:
      • email: Directly copied
      • customer_cohort_id: Part of the MD5 hash
  • Input Column: 21. model.shopify.shopify__orders[email]
    • Integration Used to join orders with customer_calendar
    • Deduplication Part of the PARTITION BY clause in window functions
    • Output Columns:
      • email: Directly copied to the output
Column Lineage
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails first_order_timestamp 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts cohort_month first_order_timestamp 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[first_order_timestamp]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the calendar table
    • Featurization Used to create the cohort_month
    • Output Columns:
      • first_order_timestamp: Directly copied
      • cohort_month: Transformed by applying DATE_TRUNC('MONTH', first_order_timestamp)
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders line_item_count 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts line_item_count_in_month line_item_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[line_item_count]
    • Aggregation This column is summed to calculate the line item count in a month and lifetime
    • Output Columns:
      • line_item_count_in_month: Summed for each month
      • line_item_count_lifetime: Cumulative sum over time
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders line_item_count 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts line_item_count_in_month line_item_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[line_item_count]
    • Aggregation This column is summed to calculate the line item count in a month and lifetime
    • Output Columns:
      • line_item_count_in_month: Summed for each month
      • line_item_count_lifetime: Cumulative sum over time
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation Used in COUNT(DISTINCT orders.order_id) to calculate order_count_in_month
    • Output Columns:
      • order_count_in_month: Aggregated as count of distinct order_id
      • order_count_lifetime: Indirectly mapped through window function on order_count_in_month
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation Used in COUNT(DISTINCT orders.order_id) to calculate order_count_in_month
    • Output Columns:
      • order_count_in_month: Aggregated as count of distinct order_id
      • order_count_lifetime: Indirectly mapped through window function on order_count_in_month
Column Lineage
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails source_relation 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts source_relation 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders orders_unique_key source_relation 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout source_relation 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order source_relation 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment source_relation 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f1
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[source_relation]
    • Integration The column is used as a key to join with other tables and ensure data is combined correctly across different sources.
    • Aggregation The column is used in the GROUP BY clause when aggregating abandoned checkout data.
    • Output Columns:
      • source_relation: This column is directly copied to the output 'source_relation' column.
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for orders
    • Output Columns:
      • source_relation: Directly copied
      • orders_unique_key: Part of the MD5 hash to create a unique key
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[source_relation]
    • Integration This column is used as a key to join the order_adjustments table with other tables in the query, ensuring that adjustments are correctly associated with their corresponding orders.
    • Aggregation The column is used in the GROUP BY clause of the order_adjustments_aggregates CTE, allowing for aggregation of adjustment amounts per order and source.
    • Output Columns:
      • source_relation: This column is directly copied to the output, maintaining the information about the source of each order and its associated data.
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with the orders table
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join the orders table with the customer_calendar CTE
    • Direct Directly copied to the output
    • Output Columns:
      • source_relation: Directly copied
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f1 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[total_price]
    • Aggregation This column is summed to calculate the total price in a month and lifetime
    • Output Columns:
      • total_price_in_month: Summed for each month
      • total_price_lifetime: Cumulative sum over time
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: The sum of order_adjusted_total for each month
      • total_price_lifetime: The cumulative sum of total_price_in_month
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f1 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[total_price]
    • Aggregation This column is summed to calculate the total price in a month and lifetime
    • Output Columns:
      • total_price_in_month: Summed for each month
      • total_price_lifetime: Cumulative sum over time
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: The sum of order_adjusted_total for each month
      • total_price_lifetime: The cumulative sum of total_price_in_month
14. model.shopify.shopify__customer_emails

This SQL query aggregates and integrates customer data from various Shopify-related tables. It calculates lifetime metrics for customers, including order totals, average order values, abandoned checkouts, and various financial metrics (spent, refunded, tax, shipping, etc.). The query joins data from orders, transactions, customer emails, and abandoned checkouts to create a comprehensive customer profile.

IntegrationAggregationFeaturizationCleaning
SQL Query
WITH __dbt__cte__int_shopify__emails__order_aggregates AS (
  WITH orders AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
  ), order_aggregates AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__orders__order_line_aggregates
  ), transactions AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__transactions
    WHERE
      LOWER(status) = 'success'
      AND NOT LOWER(kind) IN ('authorization', 'void')
      AND LOWER(gateway) <> 'gift_card' /* redeeming a giftcard does not introduce new revenue */
  ), transaction_aggregates AS (
    /* this is necessary as customers can pay via multiple payment gateways */
    SELECT
      order_id,
      source_relation,
      LOWER(kind) AS kind,
      SUM(currency_exchange_calculated_amount) AS currency_exchange_calculated_amount
    FROM transactions
    GROUP BY
      1,
      2,
      3
  ), customer_emails AS (
    /* in case any orders records don't have the customer email attached yet */
    SELECT
      customer_id,
      source_relation,
      email
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer
    WHERE
      NOT email IS NULL
    GROUP BY
      1,
      2,
      3
  ), aggregated AS (
    SELECT
      LOWER(customer_emails.email) AS email,
      orders.source_relation,
      MIN(orders.created_timestamp) AS first_order_timestamp,
      MAX(orders.created_timestamp) AS most_recent_order_timestamp,
      AVG(transaction_aggregates.currency_exchange_calculated_amount) AS avg_order_value,
      SUM(transaction_aggregates.currency_exchange_calculated_amount) AS lifetime_total_spent,
      SUM(refunds.currency_exchange_calculated_amount) AS lifetime_total_refunded,
      COUNT(DISTINCT orders.order_id) AS lifetime_count_orders,
      AVG(order_aggregates.order_total_quantity) AS avg_quantity_per_order,
      SUM(order_aggregates.order_total_tax) AS lifetime_total_tax,
      AVG(order_aggregates.order_total_tax) AS avg_tax_per_order,
      SUM(order_aggregates.order_total_discount) AS lifetime_total_discount,
      AVG(order_aggregates.order_total_discount) AS avg_discount_per_order,
      SUM(order_aggregates.order_total_shipping) AS lifetime_total_shipping,
      AVG(order_aggregates.order_total_shipping) AS avg_shipping_per_order,
      SUM(order_aggregates.order_total_shipping_with_discounts) AS lifetime_total_shipping_with_discounts,
      AVG(order_aggregates.order_total_shipping_with_discounts) AS avg_shipping_with_discounts_per_order,
      SUM(order_aggregates.order_total_shipping_tax) AS lifetime_total_shipping_tax,
      AVG(order_aggregates.order_total_shipping_tax) AS avg_shipping_tax_per_order
    FROM orders
    JOIN customer_emails
      ON orders.customer_id = customer_emails.customer_id
      AND orders.source_relation = customer_emails.source_relation
    LEFT JOIN transaction_aggregates
      ON orders.order_id = transaction_aggregates.order_id
      AND orders.source_relation = transaction_aggregates.source_relation
      AND transaction_aggregates.kind IN ('sale', 'capture')
    LEFT JOIN transaction_aggregates AS refunds
      ON orders.order_id = refunds.order_id
      AND orders.source_relation = refunds.source_relation
      AND refunds.kind = 'refund'
    LEFT JOIN order_aggregates
      ON orders.order_id = order_aggregates.order_id
      AND orders.source_relation = order_aggregates.source_relation
    GROUP BY
      1,
      2
  )
  SELECT
    *
  FROM aggregated
), customer_emails AS (
  SELECT
    *
  /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
  FROM TEST.PUBLIC_shopify.int_shopify__customer_email_rollup
), orders AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__emails__order_aggregates
  WHERE
    NOT email IS NULL
), abandoned AS (
  SELECT
    LOWER(email) AS email,
    source_relation,
    COUNT(DISTINCT checkout_id) AS lifetime_abandoned_checkouts
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout
  WHERE
    NOT email IS NULL
  GROUP BY
    1,
    2
), joined AS (
  SELECT
    customer_emails.*,
    COALESCE(abandoned.lifetime_abandoned_checkouts, 0) AS lifetime_abandoned_checkouts,
    orders.first_order_timestamp,
    orders.most_recent_order_timestamp,
    orders.avg_order_value,
    COALESCE(orders.lifetime_total_spent, 0) AS lifetime_total_spent,
    COALESCE(orders.lifetime_total_refunded, 0) AS lifetime_total_refunded,
    (
      COALESCE(orders.lifetime_total_spent, 0) - COALESCE(orders.lifetime_total_refunded, 0)
    ) AS lifetime_total_net,
    COALESCE(orders.lifetime_count_orders, 0) AS lifetime_count_orders,
    orders.avg_quantity_per_order,
    COALESCE(orders.lifetime_total_tax, 0) AS lifetime_total_tax,
    orders.avg_tax_per_order,
    COALESCE(orders.lifetime_total_discount, 0) AS lifetime_total_discount,
    orders.avg_discount_per_order,
    COALESCE(orders.lifetime_total_shipping, 0) AS lifetime_total_shipping,
    orders.avg_shipping_per_order,
    COALESCE(orders.lifetime_total_shipping_with_discounts, 0) AS lifetime_total_shipping_with_discounts,
    orders.avg_shipping_with_discounts_per_order,
    COALESCE(orders.lifetime_total_shipping_tax, 0) AS lifetime_total_shipping_tax,
    orders.avg_shipping_tax_per_order
  FROM customer_emails
  LEFT JOIN orders
    ON customer_emails.email = orders.email
    AND customer_emails.source_relation = orders.source_relation
  LEFT JOIN abandoned
    ON customer_emails.email = abandoned.email
    AND customer_emails.source_relation = abandoned.source_relation
)
SELECT
  *
FROM joined
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails last_fivetran_synced default_address_id email first_name customer_ids last_name lifetime_count_orders phone_numbers account_state is_tax_exempt last_updated_at is_verified_email first_order_timestamp most_recent_order_timestamp avg_order_value lifetime_total_spent lifetime_total_refunded lifetime_total_net first_account_created_at last_account_created_at source_relation lifetime_abandoned_checkouts customer_tags avg_quantity_per_order lifetime_total_tax avg_tax_per_order lifetime_total_discount avg_discount_per_order lifetime_total_shipping avg_shipping_per_order lifetime_total_shipping_with_discounts avg_shipping_with_discounts_per_order lifetime_total_shipping_tax avg_shipping_tax_per_order marketing_consent_updated_at currency marketing_consent_state marketing_opt_in_level note 1. model.shopify.int_shopify__customer_email_rollup 1. model.shopify.int_shopify__customer_email_rollup 6. model.shopify.int_shopify__emails__order_aggregates 6. model.shopify.int_shopify__emails__order_aggregates 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout email checkout_id source_relation token 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f2 26. model.shopify_source.stg_shopify__abandoned_checkout:f1->14. model.shopify.shopify__customer_emails:f21 26. model.shopify_source.stg_shopify__abandoned_checkout:f2->14. model.shopify.shopify__customer_emails:f20 26. model.shopify_source.stg_shopify__abandoned_checkout:f3->14. model.shopify.shopify__customer_emails:f21
Name Type Comment
last_fivetran_synced None The time when a record was last updated by Fivetran.
default_address_id None The default address for the customer.
email None The unique email address of the customer.
first_name None The customer's first name.
customer_ids None Comma-separated list of customer IDs associated with the email.
last_name None The customer's last name.
lifetime_count_orders None The number of orders associated with this customer.
phone_numbers None Comma-separated list of phone numbers associated with this email.
account_state None The state of the customer's account with a shop.
is_tax_exempt None Whether the customer is exempt from paying taxes on their order. If true, then taxes won't be applied to an order at checkout. If false, then taxes will be applied at checkout.
last_updated_at None The date and time when the customer information was last updated.
is_verified_email None Whether the customer has verified their email address.
first_order_timestamp None The timestamp the customer completed their first order.
most_recent_order_timestamp None The timestamp the customer completed their most recent order.
avg_order_value None The average order value for the customer.
lifetime_total_spent None The total amount of money that the customer has spent on orders across their order history (in shop currency).
lifetime_total_refunded None The total amount of money that the customer has been refunded on orders across their order history.
lifetime_total_net None The total amount of money (minus refunds) that the customer has spent across their order history.
first_account_created_at None Timestamp of when the first account associated with this email was created.
last_account_created_at None Timestamp of when the last account associated with this email was created.
source_relation None The schema or database this record came from, if you are unioning multiple connectors. Null if not.
lifetime_abandoned_checkouts None Total number of abandoned checkouts abandoned by the customer.
customer_tags None A string aggregated list of all tags associated with a customer.
avg_quantity_per_order None Average quantity of items per order customer orders.
lifetime_total_tax None Total amount of tax attributed to the customer.
avg_tax_per_order None Average tax per order attributed to the customer.
lifetime_total_discount None Total discounts attributed to the customer.
avg_discount_per_order None Average discount per order attributed to the customer.
lifetime_total_shipping None Total shipping costs attributed to the customer.
avg_shipping_per_order None Average shipping cost per order attributed to the customer.
lifetime_total_shipping_with_discounts None Total shipping costs after discounts attributed to the customer.
avg_shipping_with_discounts_per_order None Average shipping costs after discounts per order attributed to the customer.
lifetime_total_shipping_tax None Total shipping tax attributed to the customer.
avg_shipping_tax_per_order None Average shipping tax per order attributed to the customer.
marketing_consent_updated_at None The date and time when the customer consented to receive marketing material by email. If no date is provided, then the date and time when the consent information was sent is used.
currency None The three-letter code (ISO 4217 format) for the currency that the customer used when they paid for their last order. Defaults to the shop currency. Returns the shop currency for test orders.
marketing_consent_state None Field indicating if the customer has consented to receive marketing material via email. Coalescing of the new `email_marketing_consent_state` field and the deprecated `accepts_marketing` field. Records with the old field will be marked with '(legacy)'.
marketing_opt_in_level None The marketing subscription opt-in level, as described in the M3AAWG Sender Best Common Practices, that the customer gave when they consented to receive marketing material by email.
note None A note about the customer.
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout email 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails email 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts customer_cohort_id email 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[email]
    • Cleaning The email is converted to lowercase
    • Aggregation The email is used in GROUP BY clause
    • Output Columns:
      • email: The lowercase email is directly mapped to the output 'email' column
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the orders table
    • Deduplication Used in window functions to partition data
    • Other Used in the MD5 hash to create the customer_cohort_id
    • Output Columns:
      • email: Directly copied
      • customer_cohort_id: Part of the MD5 hash
Column Lineage
%3 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails first_order_timestamp 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts cohort_month first_order_timestamp 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[first_order_timestamp]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the calendar table
    • Featurization Used to create the cohort_month
    • Output Columns:
      • first_order_timestamp: Directly copied
      • cohort_month: Transformed by applying DATE_TRUNC('MONTH', first_order_timestamp)
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout source_relation 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails source_relation 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts source_relation 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[source_relation]
    • Integration The column is used as a key to join with other tables and ensure data is combined correctly across different sources.
    • Aggregation The column is used in the GROUP BY clause when aggregating abandoned checkout data.
    • Output Columns:
      • source_relation: This column is directly copied to the output 'source_relation' column.
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with the orders table
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout checkout_id token 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails lifetime_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 26. model.shopify_source.stg_shopify__abandoned_checkout:f1->14. model.shopify.shopify__customer_emails:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[checkout_id]
    • Aggregation The checkout_id is used in COUNT(DISTINCT checkout_id)
    • Output Columns:
      • lifetime_abandoned_checkouts: The count of distinct checkout_id is mapped to this output column
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[token]
    • Aggregation Used as part of the COUNT(DISTINCT checkout_id) aggregation
    • Output Columns:
      • lifetime_abandoned_checkouts: Contributes to the count of distinct checkout IDs
15. model.shopify.shopify__customers

This SQL query integrates customer data from multiple Shopify-related tables to create a comprehensive customer profile. It combines information from orders, transactions, customer tags, and abandoned checkouts. The query calculates various customer metrics such as lifetime spending, order counts, average order value, and abandoned checkout counts. It also includes aggregations of tax, shipping, and discount information across a customer's order history.

IntegrationAggregationFeaturizationCleaning
SQL Query
WITH __dbt__cte__shopify__customers__order_aggregates AS (
  WITH orders AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
    WHERE
      NOT customer_id IS NULL
  ), order_aggregates AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__orders__order_line_aggregates
  ), transactions AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__transactions
    WHERE
      LOWER(status) = 'success'
      AND NOT LOWER(kind) IN ('authorization', 'void')
      AND LOWER(gateway) <> 'gift_card' /* redeeming a giftcard does not introduce new revenue */
  ), transaction_aggregates AS (
    /* this is necessary as customers can pay via multiple payment gateways */
    SELECT
      order_id,
      source_relation,
      LOWER(kind) AS kind,
      SUM(currency_exchange_calculated_amount) AS currency_exchange_calculated_amount
    FROM transactions
    GROUP BY
      1,
      2,
      3
  ), customer_tags AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer_tag
  ), customer_tags_aggregated AS (
    SELECT
      customer_id,
      source_relation,
      LISTAGG(DISTINCT CAST(value AS TEXT), ', ') AS customer_tags
    FROM customer_tags
    GROUP BY
      1,
      2
  ), aggregated AS (
    SELECT
      orders.customer_id,
      orders.source_relation,
      customer_tags_aggregated.customer_tags,
      MIN(orders.created_timestamp) AS first_order_timestamp,
      MAX(orders.created_timestamp) AS most_recent_order_timestamp,
      AVG(transaction_aggregates.currency_exchange_calculated_amount) AS avg_order_value,
      SUM(transaction_aggregates.currency_exchange_calculated_amount) AS lifetime_total_spent,
      SUM(refunds.currency_exchange_calculated_amount) AS lifetime_total_refunded,
      COUNT(DISTINCT orders.order_id) AS lifetime_count_orders,
      AVG(order_aggregates.order_total_quantity) AS avg_quantity_per_order,
      SUM(order_aggregates.order_total_tax) AS lifetime_total_tax,
      AVG(order_aggregates.order_total_tax) AS avg_tax_per_order,
      SUM(order_aggregates.order_total_discount) AS lifetime_total_discount,
      AVG(order_aggregates.order_total_discount) AS avg_discount_per_order,
      SUM(order_aggregates.order_total_shipping) AS lifetime_total_shipping,
      AVG(order_aggregates.order_total_shipping) AS avg_shipping_per_order,
      SUM(order_aggregates.order_total_shipping_with_discounts) AS lifetime_total_shipping_with_discounts,
      AVG(order_aggregates.order_total_shipping_with_discounts) AS avg_shipping_with_discounts_per_order,
      SUM(order_aggregates.order_total_shipping_tax) AS lifetime_total_shipping_tax,
      AVG(order_aggregates.order_total_shipping_tax) AS avg_shipping_tax_per_order
    FROM orders
    LEFT JOIN transaction_aggregates
      ON orders.order_id = transaction_aggregates.order_id
      AND orders.source_relation = transaction_aggregates.source_relation
      AND transaction_aggregates.kind IN ('sale', 'capture')
    LEFT JOIN transaction_aggregates AS refunds
      ON orders.order_id = refunds.order_id
      AND orders.source_relation = refunds.source_relation
      AND refunds.kind = 'refund'
    LEFT JOIN order_aggregates
      ON orders.order_id = order_aggregates.order_id
      AND orders.source_relation = order_aggregates.source_relation
    LEFT JOIN customer_tags_aggregated
      ON orders.customer_id = customer_tags_aggregated.customer_id
      AND orders.source_relation = customer_tags_aggregated.source_relation
    GROUP BY
      1,
      2,
      3
  )
  SELECT
    *
  FROM aggregated
), customers AS (
  SELECT
    *
  /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer
), orders AS (
  SELECT
    *
  FROM __dbt__cte__shopify__customers__order_aggregates
), abandoned AS (
  SELECT
    customer_id,
    source_relation,
    COUNT(DISTINCT checkout_id) AS lifetime_abandoned_checkouts
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout
  WHERE
    NOT customer_id IS NULL
  GROUP BY
    1,
    2
), joined AS (
  SELECT
    customers.*,
    COALESCE(abandoned.lifetime_abandoned_checkouts, 0) AS lifetime_abandoned_checkouts,
    orders.first_order_timestamp,
    orders.most_recent_order_timestamp,
    orders.customer_tags,
    orders.avg_order_value,
    COALESCE(orders.lifetime_total_spent, 0) AS lifetime_total_spent,
    COALESCE(orders.lifetime_total_refunded, 0) AS lifetime_total_refunded,
    (
      COALESCE(orders.lifetime_total_spent, 0) - COALESCE(orders.lifetime_total_refunded, 0)
    ) AS lifetime_total_net,
    COALESCE(orders.lifetime_count_orders, 0) AS lifetime_count_orders,
    orders.avg_quantity_per_order,
    COALESCE(orders.lifetime_total_tax, 0) AS lifetime_total_tax,
    orders.avg_tax_per_order,
    COALESCE(orders.lifetime_total_discount, 0) AS lifetime_total_discount,
    orders.avg_discount_per_order,
    COALESCE(orders.lifetime_total_shipping, 0) AS lifetime_total_shipping,
    orders.avg_shipping_per_order,
    COALESCE(orders.lifetime_total_shipping_with_discounts, 0) AS lifetime_total_shipping_with_discounts,
    orders.avg_shipping_with_discounts_per_order,
    COALESCE(orders.lifetime_total_shipping_tax, 0) AS lifetime_total_shipping_tax,
    orders.avg_shipping_tax_per_order
  FROM customers
  LEFT JOIN orders
    ON customers.customer_id = orders.customer_id
    AND customers.source_relation = orders.source_relation
  LEFT JOIN abandoned
    ON customers.customer_id = abandoned.customer_id
    AND customers.source_relation = abandoned.source_relation
)
SELECT
  *
FROM joined
%3 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers _fivetran_synced created_timestamp default_address_id email first_name customer_id last_name lifetime_count_orders phone account_state is_tax_exempt updated_timestamp is_verified_email first_order_timestamp most_recent_order_timestamp avg_order_value lifetime_total_spent lifetime_total_refunded lifetime_total_net source_relation lifetime_abandoned_checkouts customer_tags avg_quantity_per_order lifetime_total_tax avg_tax_per_order lifetime_total_discount avg_discount_per_order lifetime_total_shipping avg_shipping_per_order lifetime_total_shipping_with_discounts avg_shipping_with_discounts_per_order lifetime_total_shipping_tax avg_shipping_tax_per_order currency note marketing_consent_updated_at marketing_opt_in_level marketing_consent_state 16. model.shopify.shopify__customers__order_aggregates 16. model.shopify.shopify__customers__order_aggregates 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout customer_id source_relation checkout_id 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f20 26. model.shopify_source.stg_shopify__abandoned_checkout:f1->15. model.shopify.shopify__customers:f19 26. model.shopify_source.stg_shopify__abandoned_checkout:f2->15. model.shopify.shopify__customers:f20 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer _fivetran_synced marketing_consent_state marketing_opt_in_level marketing_consent_updated_at created_timestamp default_address_id email first_name customer_id last_name phone account_state is_tax_exempt updated_timestamp is_verified_email currency source_relation note 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0 36. model.shopify_source.stg_shopify__customer:f1->15. model.shopify.shopify__customers:f37 36. model.shopify_source.stg_shopify__customer:f2->15. model.shopify.shopify__customers:f36 36. model.shopify_source.stg_shopify__customer:f3->15. model.shopify.shopify__customers:f35 36. model.shopify_source.stg_shopify__customer:f4->15. model.shopify.shopify__customers:f1 36. model.shopify_source.stg_shopify__customer:f5->15. model.shopify.shopify__customers:f2 36. model.shopify_source.stg_shopify__customer:f6->15. model.shopify.shopify__customers:f3 36. model.shopify_source.stg_shopify__customer:f7->15. model.shopify.shopify__customers:f4 36. model.shopify_source.stg_shopify__customer:f8->15. model.shopify.shopify__customers:f5 36. model.shopify_source.stg_shopify__customer:f9->15. model.shopify.shopify__customers:f6 36. model.shopify_source.stg_shopify__customer:f10->15. model.shopify.shopify__customers:f8 36. model.shopify_source.stg_shopify__customer:f11->15. model.shopify.shopify__customers:f9 36. model.shopify_source.stg_shopify__customer:f12->15. model.shopify.shopify__customers:f10 36. model.shopify_source.stg_shopify__customer:f13->15. model.shopify.shopify__customers:f11 36. model.shopify_source.stg_shopify__customer:f14->15. model.shopify.shopify__customers:f12 36. model.shopify_source.stg_shopify__customer:f15->15. model.shopify.shopify__customers:f33 36. model.shopify_source.stg_shopify__customer:f16->15. model.shopify.shopify__customers:f19 36. model.shopify_source.stg_shopify__customer:f17->15. model.shopify.shopify__customers:f34
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
created_timestamp None The date and time when the customer was created.
default_address_id None The default address for the customer.
email None The unique email address of the customer. Attempting to assign the same email address to multiple customers returns an error.
first_name None The customer's first name.
customer_id None A unique identifier for the customer.
last_name None The customer's last name.
lifetime_count_orders None The number of orders associated with this customer.
phone None The unique phone number (E.164 format) for this customer. Attempting to assign the same phone number to multiple customers returns an error.
account_state None The state of the customer's account with a shop.
is_tax_exempt None Whether the customer is exempt from paying taxes on their order. If true, then taxes won't be applied to an order at checkout. If false, then taxes will be applied at checkout.
updated_timestamp None The date and time when the customer information was last updated.
is_verified_email None Whether the customer has verified their email address.
first_order_timestamp None The timestamp the customer completed their first order.
most_recent_order_timestamp None The timestamp the customer completed their most recent order.
avg_order_value None The average order value for the customer.
lifetime_total_spent None The total amount of money in shop currency that the customer has spent on orders across their order history.
lifetime_total_refunded None The total amount of money that the customer has been refunded on orders across their order history.
lifetime_total_net None The total amount of money (minus refunds) that the customer has spent across their order history.
source_relation None The schema or database this record came from, if you are unioning multiple connectors. Null if not.
lifetime_abandoned_checkouts None Total number of abandoned checkouts abandoned by the customer.
customer_tags None A string aggregated list of all tags associated with a customer.
avg_quantity_per_order None Average quantity of items per order customer orders.
lifetime_total_tax None Total amount of tax attributed to the customer.
avg_tax_per_order None Average tax per order attributed to the customer.
lifetime_total_discount None Total discounts attributed to the customer.
avg_discount_per_order None Average discount per order attributed to the customer.
lifetime_total_shipping None Total shipping costs attributed to the customer.
avg_shipping_per_order None Average shipping cost per order attributed to the customer.
lifetime_total_shipping_with_discounts None Total shipping costs after discounts attributed to the customer.
avg_shipping_with_discounts_per_order None Average shipping costs after discounts per order attributed to the customer.
lifetime_total_shipping_tax None Total shipping tax attributed to the customer.
avg_shipping_tax_per_order None Average shipping tax per order attributed to the customer.
currency None The three-letter code (ISO 4217 format) for the currency that the customer used when they paid for their last order. Defaults to the shop currency. Returns the shop currency for test orders.
note None A note about the customer.
marketing_consent_updated_at None The date and time when the customer consented to receive marketing material by email. If no date is provided, then the date and time when the consent information was sent is used.
marketing_opt_in_level None The marketing subscription opt-in level, as described in the M3AAWG Sender Best Common Practices, that the customer gave when they consented to receive marketing material by email.
marketing_consent_state None Field indicating if the customer has consented to receive marketing material via email. Coalescing of the new `email_marketing_consent_state` field and the deprecated `accepts_marketing` field. Records with the old field will be marked with '(legacy)'.
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer _fivetran_synced 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers _fivetran_synced 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer created_timestamp 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers created_timestamp 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer default_address_id 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers default_address_id 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[default_address_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • default_address_id: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer email 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers email 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer first_name 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers first_name 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[first_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer customer_id 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers customer_id 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts customer_id 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[customer_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as a key to join with other tables
    • Output Columns:
      • customer_id: Directly copied to the output
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[customer_id]
    • Integration Used as a key to join the customers table with the orders table
    • Deduplication Used in window functions to partition data by customer
    • Output Columns:
      • customer_id: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer last_name 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers last_name 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[last_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer phone 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers phone 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[phone]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • phone: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer account_state 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers account_state 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[account_state]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_state: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer is_tax_exempt 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers is_tax_exempt 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[is_tax_exempt]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_tax_exempt: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer updated_timestamp 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers updated_timestamp 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[updated_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • updated_timestamp: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer is_verified_email 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers is_verified_email 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[is_verified_email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_verified_email: Directly copied
Column Lineage
%3 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers first_order_timestamp 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts cohort_month first_order_timestamp 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f1 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[first_order_timestamp]
    • Direct This column is directly copied to the output
    • Integration Used to join with the calendar table
    • Featurization Used to calculate the cohort_month
    • Output Columns:
      • first_order_timestamp: Directly copied
      • cohort_month: Transformed (DATE_TRUNC)
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout source_relation 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers source_relation 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer source_relation 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[source_relation]
    • Integration This column is used as a key to join with other tables in the query
    • Aggregation It's part of the GROUP BY clause in the abandoned checkouts subquery
    • Output Columns:
      • source_relation: It's directly copied to the output 'source_relation' column
  • Input Column: 36. model.shopify_source.stg_shopify__customer[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • source_relation: Directly copied and used in joins
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used to join with the orders table
    • Output Columns:
      • source_relation: Directly copied
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout checkout_id customer_id 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers lifetime_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout:f1->15. model.shopify.shopify__customers:f0 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[customer_id]
    • Integration Used as a key to join with other tables
    • Aggregation Used in GROUP BY clause to aggregate abandoned checkouts per customer
    • Output Columns:
      • lifetime_abandoned_checkouts: Aggregated count of abandoned checkouts per customer
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[checkout_id]
    • Aggregation Used in COUNT(DISTINCT checkout_id) to calculate the number of abandoned checkouts
    • Output Columns:
      • lifetime_abandoned_checkouts: Aggregated count of distinct checkout_id per customer
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer currency 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers currency 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[currency]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • currency: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer note 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers note 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[note]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer marketing_opt_in_level 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers marketing_opt_in_level 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[marketing_opt_in_level]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • marketing_opt_in_level: Directly copied to the output
16. model.shopify.shopify__customers__order_aggregates

This SQL query aggregates customer order data from various Shopify-related tables. It calculates customer-level metrics such as first and most recent order dates, average order value, lifetime total spent, refunded amounts, order counts, and various aggregations related to quantity, tax, discounts, and shipping. The query also includes customer tags and filters out certain transaction types. The result provides a comprehensive overview of each customer's purchasing behavior and order history.

FilteringIntegrationAggregationFeaturization
SQL Query
WITH orders AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
  WHERE
    NOT customer_id IS NULL
), order_aggregates AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders__order_line_aggregates
), transactions AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__transactions
  WHERE
    LOWER(status) = 'success'
    AND NOT LOWER(kind) IN ('authorization', 'void')
    AND LOWER(gateway) <> 'gift_card' /* redeeming a giftcard does not introduce new revenue */
), transaction_aggregates AS (
  /* this is necessary as customers can pay via multiple payment gateways */
  SELECT
    order_id,
    source_relation,
    LOWER(kind) AS kind,
    SUM(currency_exchange_calculated_amount) AS currency_exchange_calculated_amount
  FROM transactions
  GROUP BY
    1,
    2,
    3
), customer_tags AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer_tag
), customer_tags_aggregated AS (
  SELECT
    customer_id,
    source_relation,
    LISTAGG(DISTINCT CAST(value AS TEXT), ', ') AS customer_tags
  FROM customer_tags
  GROUP BY
    1,
    2
), aggregated AS (
  SELECT
    orders.customer_id,
    orders.source_relation,
    customer_tags_aggregated.customer_tags,
    MIN(orders.created_timestamp) AS first_order_timestamp,
    MAX(orders.created_timestamp) AS most_recent_order_timestamp,
    AVG(transaction_aggregates.currency_exchange_calculated_amount) AS avg_order_value,
    SUM(transaction_aggregates.currency_exchange_calculated_amount) AS lifetime_total_spent,
    SUM(refunds.currency_exchange_calculated_amount) AS lifetime_total_refunded,
    COUNT(DISTINCT orders.order_id) AS lifetime_count_orders,
    AVG(order_aggregates.order_total_quantity) AS avg_quantity_per_order,
    SUM(order_aggregates.order_total_tax) AS lifetime_total_tax,
    AVG(order_aggregates.order_total_tax) AS avg_tax_per_order,
    SUM(order_aggregates.order_total_discount) AS lifetime_total_discount,
    AVG(order_aggregates.order_total_discount) AS avg_discount_per_order,
    SUM(order_aggregates.order_total_shipping) AS lifetime_total_shipping,
    AVG(order_aggregates.order_total_shipping) AS avg_shipping_per_order,
    SUM(order_aggregates.order_total_shipping_with_discounts) AS lifetime_total_shipping_with_discounts,
    AVG(order_aggregates.order_total_shipping_with_discounts) AS avg_shipping_with_discounts_per_order,
    SUM(order_aggregates.order_total_shipping_tax) AS lifetime_total_shipping_tax,
    AVG(order_aggregates.order_total_shipping_tax) AS avg_shipping_tax_per_order
  FROM orders
  LEFT JOIN transaction_aggregates
    ON orders.order_id = transaction_aggregates.order_id
    AND orders.source_relation = transaction_aggregates.source_relation
    AND transaction_aggregates.kind IN ('sale', 'capture')
  LEFT JOIN transaction_aggregates AS refunds
    ON orders.order_id = refunds.order_id
    AND orders.source_relation = refunds.source_relation
    AND refunds.kind = 'refund'
  LEFT JOIN order_aggregates
    ON orders.order_id = order_aggregates.order_id
    AND orders.source_relation = order_aggregates.source_relation
  LEFT JOIN customer_tags_aggregated
    ON orders.customer_id = customer_tags_aggregated.customer_id
    AND orders.source_relation = customer_tags_aggregated.source_relation
  GROUP BY
    1,
    2,
    3
)
SELECT
  *
FROM aggregated
%3 16. model.shopify.shopify__customers__order_aggregates 16. model.shopify.shopify__customers__order_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions 37. model.shopify_source.stg_shopify__customer_tag 37. model.shopify_source.stg_shopify__customer_tag 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order
Name Type Comment
17. model.shopify.shopify__daily_shop

This SQL query creates a daily summary of shop performance metrics, combining order data, abandoned checkout information, and shop details. It calculates various aggregates such as order counts, sales figures, discounts, refunds, and product quantities. The query joins multiple tables to provide a comprehensive daily view of each shop's activities, including both successful orders and abandoned checkouts.

FilteringIntegrationAggregationFeaturization
SQL Query
WITH __dbt__cte__int_shopify__daily_orders AS (
  WITH orders AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__orders
    WHERE
      NOT COALESCE(is_deleted, FALSE)
  ), order_lines AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__order_lines
  ), order_aggregates AS (
    SELECT
      source_relation,
      CAST(DATE_TRUNC('DAY', created_timestamp) AS DATE) AS date_day,
      COUNT(DISTINCT order_id) AS count_orders,
      SUM(line_item_count) AS count_line_items,
      AVG(line_item_count) AS avg_line_item_count,
      COUNT(DISTINCT customer_id) AS count_customers,
      COUNT(DISTINCT email) AS count_customer_emails,
      SUM(order_adjusted_total) AS order_adjusted_total,
      AVG(order_adjusted_total) AS avg_order_value,
      SUM(shipping_cost) AS shipping_cost,
      SUM(order_adjustment_amount) AS order_adjustment_amount,
      SUM(order_adjustment_tax_amount) AS order_adjustment_tax_amount,
      SUM(refund_subtotal) AS refund_subtotal,
      SUM(refund_total_tax) AS refund_total_tax,
      SUM(total_discounts) AS total_discounts,
      AVG(total_discounts) AS avg_discount,
      SUM(shipping_discount_amount) AS shipping_discount_amount,
      AVG(shipping_discount_amount) AS avg_shipping_discount_amount,
      SUM(percentage_calc_discount_amount) AS percentage_calc_discount_amount,
      AVG(percentage_calc_discount_amount) AS avg_percentage_calc_discount_amount,
      SUM(fixed_amount_discount_amount) AS fixed_amount_discount_amount,
      AVG(fixed_amount_discount_amount) AS avg_fixed_amount_discount_amount,
      SUM(count_discount_codes_applied) AS count_discount_codes_applied,
      COUNT(DISTINCT location_id) AS count_locations_ordered_from,
      SUM(CASE WHEN count_discount_codes_applied > 0 THEN 1 ELSE 0 END) AS count_orders_with_discounts,
      SUM(CASE WHEN refund_subtotal > 0 THEN 1 ELSE 0 END) AS count_orders_with_refunds,
      MIN(created_timestamp) AS first_order_timestamp,
      MAX(created_timestamp) AS last_order_timestamp
    FROM orders
    GROUP BY
      1,
      2
  ), order_line_aggregates AS (
    SELECT
      order_lines.source_relation,
      CAST(DATE_TRUNC('DAY', orders.created_timestamp) AS DATE) AS date_day,
      SUM(order_lines.quantity) AS quantity_sold,
      SUM(order_lines.refunded_quantity) AS quantity_refunded,
      SUM(order_lines.quantity_net_refunds) AS quantity_net,
      SUM(order_lines.quantity) / COUNT(DISTINCT order_lines.order_id) AS avg_quantity_sold,
      SUM(order_lines.quantity_net_refunds) / COUNT(DISTINCT order_lines.order_id) AS avg_quantity_net,
      COUNT(DISTINCT order_lines.variant_id) AS count_variants_sold,
      COUNT(DISTINCT order_lines.product_id) AS count_products_sold,
      SUM(
        CASE WHEN order_lines.is_gift_card THEN order_lines.quantity_net_refunds ELSE 0 END
      ) AS quantity_gift_cards_sold,
      SUM(
        CASE
          WHEN order_lines.is_shipping_required
          THEN order_lines.quantity_net_refunds
          ELSE 0
        END
      ) AS quantity_requiring_shipping
    FROM order_lines
    LEFT JOIN orders /* just joining with order to get the created_timestamp */
      ON order_lines.order_id = orders.order_id
      AND order_lines.source_relation = orders.source_relation
    GROUP BY
      1,
      2
  ), final AS (
    SELECT
      order_aggregates.*,
      order_line_aggregates.quantity_sold,
      order_line_aggregates.quantity_refunded,
      order_line_aggregates.quantity_net,
      order_line_aggregates.count_variants_sold,
      order_line_aggregates.count_products_sold,
      order_line_aggregates.quantity_gift_cards_sold,
      order_line_aggregates.quantity_requiring_shipping,
      order_line_aggregates.avg_quantity_sold,
      order_line_aggregates.avg_quantity_net
    FROM order_aggregates
    LEFT JOIN order_line_aggregates
      ON order_aggregates.date_day = order_line_aggregates.date_day
      AND order_aggregates.source_relation = order_line_aggregates.source_relation
  )
  SELECT
    *
  FROM final
), __dbt__cte__int_shopify__daily_abandoned_checkouts AS (
  WITH abandoned_checkout AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout
    /* "deleted" abandoned checkouts do not appear to have any data tying them to customers, */ /* discounts, or products (and should therefore not get joined in) but let's filter them out here */
    WHERE
      NOT COALESCE(is_deleted, FALSE)
  ), abandoned_checkout_aggregates AS (
    SELECT
      source_relation,
      CAST(DATE_TRUNC('DAY', created_at) AS DATE) AS date_day,
      COUNT(DISTINCT checkout_id) AS count_abandoned_checkouts,
      COUNT(DISTINCT customer_id) AS count_customers_abandoned_checkout,
      COUNT(DISTINCT email) AS count_customer_emails_abandoned_checkout
    FROM abandoned_checkout
    GROUP BY
      1,
      2
  )
  SELECT
    *
  FROM abandoned_checkout_aggregates
), shop AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__shop
), calendar AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__calendar
  WHERE
    CAST(DATE_TRUNC('DAY', date_day) AS DATE) = date_day
), daily_orders AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__daily_orders
), daily_abandoned_checkouts AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__daily_abandoned_checkouts
), shop_calendar AS (
  SELECT
    CAST(DATE_TRUNC('DAY', calendar.date_day) AS DATE) AS date_day,
    shop.shop_id,
    shop.name,
    shop.domain,
    shop.is_deleted,
    shop.currency,
    shop.enabled_presentment_currencies,
    shop.iana_timezone,
    shop.created_at,
    shop.source_relation
  FROM calendar
  JOIN shop
    ON CAST(shop.created_at AS DATE) <= calendar.date_day
), final AS (
  SELECT
    shop_calendar.*,
    COALESCE(daily_orders.count_orders, 0) AS count_orders,
    COALESCE(daily_orders.count_line_items, 0) AS count_line_items,
    daily_orders.avg_line_item_count,
    COALESCE(daily_orders.count_customers, 0) AS count_customers,
    COALESCE(daily_orders.count_customer_emails, 0) AS count_customer_emails,
    COALESCE(daily_orders.order_adjusted_total, 0) AS order_adjusted_total,
    daily_orders.avg_order_value,
    COALESCE(daily_orders.shipping_cost, 0) AS shipping_cost,
    COALESCE(daily_orders.order_adjustment_amount, 0) AS order_adjustment_amount,
    COALESCE(daily_orders.order_adjustment_tax_amount, 0) AS order_adjustment_tax_amount,
    COALESCE(daily_orders.refund_subtotal, 0) AS refund_subtotal,
    COALESCE(daily_orders.refund_total_tax, 0) AS refund_total_tax,
    COALESCE(daily_orders.total_discounts, 0) AS total_discounts,
    daily_orders.avg_discount,
    COALESCE(daily_orders.shipping_discount_amount, 0) AS shipping_discount_amount,
    daily_orders.avg_shipping_discount_amount,
    COALESCE(daily_orders.percentage_calc_discount_amount, 0) AS percentage_calc_discount_amount,
    daily_orders.avg_percentage_calc_discount_amount,
    COALESCE(daily_orders.fixed_amount_discount_amount, 0) AS fixed_amount_discount_amount,
    daily_orders.avg_fixed_amount_discount_amount,
    COALESCE(daily_orders.count_discount_codes_applied, 0) AS count_discount_codes_applied,
    COALESCE(daily_orders.count_locations_ordered_from, 0) AS count_locations_ordered_from,
    COALESCE(daily_orders.count_orders_with_discounts, 0) AS count_orders_with_discounts,
    COALESCE(daily_orders.count_orders_with_refunds, 0) AS count_orders_with_refunds,
    daily_orders.first_order_timestamp,
    daily_orders.last_order_timestamp,
    COALESCE(daily_orders.quantity_sold, 0) AS quantity_sold,
    COALESCE(daily_orders.quantity_refunded, 0) AS quantity_refunded,
    COALESCE(daily_orders.quantity_net, 0) AS quantity_net,
    daily_orders.avg_quantity_sold,
    daily_orders.avg_quantity_net,
    COALESCE(daily_orders.count_variants_sold, 0) AS count_variants_sold,
    COALESCE(daily_orders.count_products_sold, 0) AS count_products_sold,
    COALESCE(daily_orders.quantity_gift_cards_sold, 0) AS quantity_gift_cards_sold,
    COALESCE(daily_orders.quantity_requiring_shipping, 0) AS quantity_requiring_shipping,
    COALESCE(daily_abandoned_checkouts.count_abandoned_checkouts, 0) AS count_abandoned_checkouts,
    COALESCE(daily_abandoned_checkouts.count_customers_abandoned_checkout, 0) AS count_customers_abandoned_checkout,
    COALESCE(daily_abandoned_checkouts.count_customer_emails_abandoned_checkout, 0) AS count_customer_emails_abandoned_checkout
  FROM shop_calendar
  LEFT JOIN daily_orders
    ON shop_calendar.source_relation = daily_orders.source_relation
    AND shop_calendar.date_day = daily_orders.date_day
  LEFT JOIN daily_abandoned_checkouts
    ON shop_calendar.source_relation = daily_abandoned_checkouts.source_relation
    AND shop_calendar.date_day = daily_abandoned_checkouts.date_day
)
SELECT
  *
FROM final
%3 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop date_day shop_id name domain is_deleted currency enabled_presentment_currencies iana_timezone created_at count_orders count_line_items count_customers count_customer_emails order_adjusted_total avg_order_value shipping_cost order_adjustment_amount order_adjustment_tax_amount refund_subtotal refund_total_tax total_discounts shipping_discount_amount percentage_calc_discount_amount fixed_amount_discount_amount count_discount_codes_applied count_locations_ordered_from count_orders_with_discounts count_orders_with_refunds first_order_timestamp last_order_timestamp quantity_sold quantity_refunded quantity_net count_variants_sold count_products_sold quantity_gift_cards_sold quantity_requiring_shipping count_abandoned_checkouts count_customers_abandoned_checkout count_customer_emails_abandoned_checkout count_fulfillment_attempted_delivery count_fulfillment_delivered count_fulfillment_failure count_fulfillment_in_transit count_fulfillment_out_for_delivery count_fulfillment_ready_for_pickup count_fulfillment_picked_up count_fulfillment_label_printed count_fulfillment_label_purchased count_fulfillment_confirmed count_fulfillment_delayed avg_line_item_count avg_discount avg_shipping_discount_amount avg_percentage_calc_discount_amount avg_fixed_amount_discount_amount avg_quantity_sold avg_quantity_net source_relation 2. model.shopify.int_shopify__daily_abandoned_checkouts 2. model.shopify.int_shopify__daily_abandoned_checkouts 3. model.shopify.int_shopify__daily_orders 3. model.shopify.int_shopify__daily_orders 11. model.shopify.shopify__calendar 11. model.shopify.shopify__calendar 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop is_deleted created_at currency domain enabled_presentment_currencies iana_timezone shop_id name source_relation 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f4 84. model.shopify_source.stg_shopify__shop:f1->17. model.shopify.shopify__daily_shop:f8 84. model.shopify_source.stg_shopify__shop:f2->17. model.shopify.shopify__daily_shop:f5 84. model.shopify_source.stg_shopify__shop:f3->17. model.shopify.shopify__daily_shop:f3 84. model.shopify_source.stg_shopify__shop:f4->17. model.shopify.shopify__daily_shop:f6 84. model.shopify_source.stg_shopify__shop:f5->17. model.shopify.shopify__daily_shop:f7 84. model.shopify_source.stg_shopify__shop:f6->17. model.shopify.shopify__daily_shop:f1 84. model.shopify_source.stg_shopify__shop:f7->17. model.shopify.shopify__daily_shop:f2 84. model.shopify_source.stg_shopify__shop:f8->17. model.shopify.shopify__daily_shop:f58
Name Type Comment
date_day None Day for which the shop activity is being measured.
shop_id None The ID for the shop. A 64-bit unsigned integer.
name None The name of the shop.
domain None The shop's domain.
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
currency None The three-letter code (ISO 4217 format) for the shop's default currency.
enabled_presentment_currencies None An array of of enabled currencies (ISO 4217 format) that the shop accepts. Merchants can enable currencies from their Shopify Payments settings in the Shopify Admin.
iana_timezone None The name of the timezone assigned by the [IANA](https://www.iana.org/time-zones).
created_at None The date and time (ISO 8601) when the shop was created.
count_orders None Count of the distinct orders placed on this day.
count_line_items None Count of the line items included in orders placed on this day.
count_customers None Count of distinct customers who placed an order on this day.
count_customer_emails None Count of distinct customer email addresses who placed an order on this day.
order_adjusted_total None Order total adjusted for refunds and other adjustments. The calculation used for this field is as follows: total price listed on the original order (including shipping costs and discounts) + adjustments + adjustments tax - total refunds - refunds tax The order_adjusted_total will equate to the total sales - refunds listed within the transactions table for the order (after currency exchange).
avg_order_value None Average adjusted total per order placed on this day (in shop currency).
shipping_cost None The shipping cost of the orders placed on this day (in shop currency).
order_adjustment_amount None Total adjustment amount (in shop currency) applied to the orders placed on this day.
order_adjustment_tax_amount None Total tax applied to adjustments (in shop currency) on the orders placed on this day.
refund_subtotal None Total refund amount applied to the orders placed on this day.
refund_total_tax None Total tax applied to the refund on the orders placed on this day (in shop currency).
total_discounts None The total amount of the discount allocated to this day's orders in the shop's currency.
shipping_discount_amount None The total amount of discount (in shop currency) allocated toward shipping for orders placed on this day.
percentage_calc_discount_amount None The total amount of discount (in shop currency) allocated via a percentage-based discount for orders placed on this day.
fixed_amount_discount_amount None The total amount of discount (in shop currency) allocated via a fixed-amount discount for orders placed on this day.
count_discount_codes_applied None Distinct discount codes applied by customers on orders for this day.
count_locations_ordered_from None Distinct locations with orders placed against them on this day.
count_orders_with_discounts None Count of orders in which a discount was applied.
count_orders_with_refunds None Count of orders in which there was a refund.
first_order_timestamp None Timestamp of the first order of the day for the shop.
last_order_timestamp None Timestamp of the last order of the day for the shop.
quantity_sold None Total quantity sold from the inventory level. Includes refunds.
quantity_refunded None The quantity of goods ORDERED on this day that have been refunded.
quantity_net None Net quantity sold from this shop on this day. Excludes refunds.
count_variants_sold None Distinct product variants sold on this day (includes refunds).
count_products_sold None Distinct products sold on this day (includes refunds).
quantity_gift_cards_sold None Quantity of gift cards sold on this day.
quantity_requiring_shipping None Quantity of goods sold on this day that require shipping.
count_abandoned_checkouts None Count of abandoned checkouts on this day.
count_customers_abandoned_checkout None Count of distinct customers who abandoned checkouts on this day.
count_customer_emails_abandoned_checkout None Count of distinct customer emails who abandoned checkouts on this day.
count_fulfillment_attempted_delivery None Count of distinct fulfillments on this day where the delivery of the shipment was attempted, but unable to be completed.
count_fulfillment_delivered None Count of successful distinct fulfillments successfully delivered on this day.
count_fulfillment_failure None Count of failed distinct fulfillments on this day. Something went wrong when pulling tracking information for the shipment, such as the tracking number was invalid or the shipment was canceled.
count_fulfillment_in_transit None Count of distinct fulfillments in transit on this day. Each shipment is being transported between shipping facilities on the way to its destination.
count_fulfillment_out_for_delivery None Count of distinct fulfillments being delivered to their final destination.
count_fulfillment_ready_for_pickup None Count of distinct fulfillments ready for pickup at a shipping depot.
count_fulfillment_picked_up None Count of distinct fulfillments successfully picked up on this day.
count_fulfillment_label_printed None Count of distinct fulfillments for which a purchased shipping label has been printed on this day.
count_fulfillment_label_purchased None Count of distinct fulfillments for which a shipping label has been purchased (but not printed yet) on this day.
count_fulfillment_confirmed None Count of confirmed distinct fulfillments. This is the default status when no other information is available about a fulfillment.
count_fulfillment_delayed None Count of delayed distinct fulfillments.
avg_line_item_count None Average line item count for orders placed on this day.
avg_discount None Average total discount placed on orders on this day (in shop currency).
avg_shipping_discount_amount None Average discount amount (in shop currency) allocated toward shipping on orders placed on this day.
avg_percentage_calc_discount_amount None Average discount amount (in shop currency) allocated via a percentage-based-discount on orders placed on this day.
avg_fixed_amount_discount_amount None Average discount amount (in shop currency) allocated via a fixed-amount-discount on orders placed on this day.
avg_quantity_sold None Average quantity sold per order on this day. Includes refunds. (in shop currency)
avg_quantity_net None Average net quantity sold per order on this day. Excludes refunds. (in shop currency)
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop shop_id 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop shop_id 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[shop_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with other tables
    • Output Columns:
      • shop_id: Directly copied to the output
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop name 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop name 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • name: Directly mapped to the output 'name' column
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop domain 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop domain 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[domain]
    • Direct The column is directly copied to the output
    • Output Columns:
      • domain: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop is_deleted 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop is_deleted 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[is_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_deleted: Directly copied to the output
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop currency 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop currency 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[currency]
    • Direct The column is directly copied to the output
    • Output Columns:
      • currency: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop enabled_presentment_currencies 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop enabled_presentment_currencies 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[enabled_presentment_currencies]
    • Direct The column is directly copied to the output
    • Output Columns:
      • enabled_presentment_currencies: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop iana_timezone 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop iana_timezone 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[iana_timezone]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • iana_timezone: Directly copied to the output
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop created_at 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop created_at 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[created_at]
    • Direct The column is directly copied to the output
    • Filtering Used to filter shop records based on creation date
    • Output Columns:
      • created_at: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop source_relation 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop source_relation 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables in the query
    • Output Columns:
      • source_relation: Directly mapped to the output column of the same name
18. model.shopify.shopify__discounts

This SQL query integrates data from multiple Shopify-related tables to create a comprehensive view of discounts. It combines information about discount codes, price rules, orders, and abandoned checkouts. The query performs various aggregations to calculate metrics such as total discount amounts, order counts, customer counts, and shipping costs. It also joins these aggregated results with the main discount and price rule data to provide a detailed analysis of discount performance across both completed orders and abandoned checkouts.

IntegrationAggregationFeaturization
SQL Query
WITH __dbt__cte__int_shopify__discounts__order_aggregates AS (
  WITH order_discount_code AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_discount_code
  ), orders AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__orders
  ), orders_aggregated AS (
    SELECT
      order_discount_code.code,
      order_discount_code.type,
      order_discount_code.source_relation,
      AVG(order_discount_code.amount) AS avg_order_discount_amount,
      SUM(order_discount_code.amount) AS total_order_discount_amount,
      MAX(orders.total_line_items_price) AS total_order_line_items_price, /* summing would multiply the total by the # of discount codes applied to an order */
      MAX(orders.shipping_cost) AS total_order_shipping_cost, /* summing would multiply the total by the # of discount codes applied to an order */
      MAX(orders.refund_subtotal + orders.refund_total_tax) AS total_order_refund_amount, /* summing would multiply the total by the # of discount codes applied to an order */
      COUNT(DISTINCT customer_id) AS count_customers,
      COUNT(DISTINCT email) AS count_customer_emails,
      COUNT(DISTINCT order_discount_code.order_id) AS count_orders
    FROM order_discount_code
    JOIN orders
      ON order_discount_code.order_id = orders.order_id
      AND order_discount_code.source_relation = orders.source_relation
    GROUP BY
      1,
      2,
      3
  )
  SELECT
    *
  FROM orders_aggregated
), __dbt__cte__int_shopify__discounts__abandoned_checkouts AS (
  WITH abandoned_checkout AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout
    /* "deleted" abandoned checkouts do not appear to have any data tying them to customers, */ /* discounts, or products (and should therefore not get joined in) but let's filter them out here */
    WHERE
      NOT COALESCE(is_deleted, FALSE)
  ), abandoned_checkout_discount_code AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_discount_code
    /* we need the TYPE of discount (shipping, percentage, fixed_amount) to avoid fanning out of joins */ /* so filter out records that have this */
    WHERE
      COALESCE(type, '') <> ''
  ), abandoned_checkout_shipping_line AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_shipping_line
  ), roll_up_shipping_line AS (
    SELECT
      checkout_id,
      source_relation,
      SUM(price) AS price
    FROM abandoned_checkout_shipping_line
    GROUP BY
      1,
      2
  ), abandoned_checkouts_aggregated AS (
    SELECT
      abandoned_checkout_discount_code.code,
      abandoned_checkout_discount_code.type,
      abandoned_checkout_discount_code.source_relation,
      SUM(abandoned_checkout_discount_code.amount) AS total_abandoned_checkout_discount_amount,
      SUM(COALESCE(abandoned_checkout.total_line_items_price, 0)) AS total_abandoned_checkout_line_items_price,
      SUM(COALESCE(roll_up_shipping_line.price, 0)) AS total_abandoned_checkout_shipping_price,
      COUNT(DISTINCT customer_id) AS count_abandoned_checkout_customers,
      COUNT(DISTINCT email) AS count_abandoned_checkout_customer_emails,
      COUNT(DISTINCT abandoned_checkout.checkout_id) AS count_abandoned_checkouts
    FROM abandoned_checkout_discount_code
    LEFT JOIN abandoned_checkout
      ON abandoned_checkout_discount_code.checkout_id = abandoned_checkout.checkout_id
      AND abandoned_checkout_discount_code.source_relation = abandoned_checkout.source_relation
    LEFT JOIN roll_up_shipping_line
      ON roll_up_shipping_line.checkout_id = abandoned_checkout_discount_code.checkout_id
      AND roll_up_shipping_line.source_relation = abandoned_checkout_discount_code.source_relation
    GROUP BY
      1,
      2,
      3
  )
  SELECT
    *
  FROM abandoned_checkouts_aggregated
), discount AS (
  SELECT
    *,
    MD5(
      CAST(COALESCE(CAST(source_relation AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(discount_code_id AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS discounts_unique_key
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__discount_code
), price_rule AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__price_rule
), orders_aggregated AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__discounts__order_aggregates
), abandoned_checkouts_aggregated AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__discounts__abandoned_checkouts
), discount_price_rule_joined AS (
  SELECT
    discount.*,
    price_rule.target_selection,
    price_rule.target_type,
    price_rule.title,
    price_rule.usage_limit,
    price_rule.value,
    price_rule.value_type,
    price_rule.allocation_limit,
    price_rule.allocation_method,
    price_rule.is_once_per_customer,
    price_rule.customer_selection,
    price_rule.prereq_min_quantity,
    price_rule.prereq_max_shipping_price,
    price_rule.prereq_min_subtotal,
    price_rule.prereq_min_purchase_quantity_for_entitlement,
    price_rule.prereq_buy_x_get_this,
    price_rule.prereq_buy_this_get_y,
    price_rule.starts_at,
    price_rule.ends_at,
    price_rule.created_at AS price_rule_created_at,
    price_rule.updated_at AS price_rule_updated_at
  FROM discount
  LEFT JOIN price_rule
    ON discount.price_rule_id = price_rule.price_rule_id
    AND discount.source_relation = price_rule.source_relation
), aggregates_joined AS (
  SELECT
    discount_price_rule_joined.*,
    COALESCE(orders_aggregated.count_orders, 0) AS count_orders,
    COALESCE(abandoned_checkouts_aggregated.count_abandoned_checkouts, 0) AS count_abandoned_checkouts,
    orders_aggregated.avg_order_discount_amount,
    COALESCE(orders_aggregated.total_order_discount_amount, 0) AS total_order_discount_amount,
    COALESCE(abandoned_checkouts_aggregated.total_abandoned_checkout_discount_amount, 0) AS total_abandoned_checkout_discount_amount,
    COALESCE(orders_aggregated.total_order_line_items_price, 0) AS total_order_line_items_price,
    COALESCE(orders_aggregated.total_order_shipping_cost, 0) AS total_order_shipping_cost,
    COALESCE(abandoned_checkouts_aggregated.total_abandoned_checkout_shipping_price, 0) AS total_abandoned_checkout_shipping_price,
    COALESCE(orders_aggregated.total_order_refund_amount, 0) AS total_order_refund_amount,
    COALESCE(orders_aggregated.count_customers, 0) AS count_customers,
    COALESCE(orders_aggregated.count_customer_emails, 0) AS count_customer_emails,
    COALESCE(abandoned_checkouts_aggregated.count_abandoned_checkout_customers, 0) AS count_abandoned_checkout_customers,
    COALESCE(abandoned_checkouts_aggregated.count_abandoned_checkout_customer_emails, 0) AS count_abandoned_checkout_customer_emails
  FROM discount_price_rule_joined
  LEFT JOIN orders_aggregated
    ON discount_price_rule_joined.code = orders_aggregated.code
    AND discount_price_rule_joined.source_relation = orders_aggregated.source_relation
    AND /* in case one CODE can apply to both shipping and line items, percentages and fixed_amounts */ (
      CASE
        WHEN discount_price_rule_joined.target_type = 'shipping_line'
        THEN 'shipping' /* when target_type = 'shipping', value_type = 'percentage' */
        ELSE discount_price_rule_joined.value_type
      END
    ) = orders_aggregated.type
  LEFT JOIN abandoned_checkouts_aggregated
    ON discount_price_rule_joined.code = abandoned_checkouts_aggregated.code
    AND discount_price_rule_joined.source_relation = abandoned_checkouts_aggregated.source_relation
    AND /* in case one CODE can apply to both shipping and line items, percentages and fixed_amounts */ (
      CASE
        WHEN discount_price_rule_joined.target_type = 'shipping_line'
        THEN 'shipping' /* when target_type = 'shipping', value_type = 'percentage' */
        ELSE discount_price_rule_joined.value_type
      END
    ) = abandoned_checkouts_aggregated.type
)
SELECT
  *
FROM aggregates_joined
%3 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts discounts_unique_key _fivetran_synced code created_at discount_code_id price_rule_id updated_at usage_count allocation_limit allocation_method price_rule_created_at customer_selection ends_at is_once_per_customer prereq_min_quantity prereq_max_shipping_price prereq_min_subtotal prereq_min_purchase_quantity_for_entitlement prereq_buy_x_get_this prereq_buy_this_get_y starts_at target_selection target_type title price_rule_updated_at usage_limit value value_type total_order_discount_amount total_abandoned_checkout_discount_amount total_order_line_items_price total_order_shipping_cost total_abandoned_checkout_shipping_price total_order_refund_amount count_customers count_customer_emails avg_order_discount_amount source_relation count_orders count_abandoned_checkouts count_abandoned_checkout_customers count_abandoned_checkout_customer_emails 4. model.shopify.int_shopify__discounts__abandoned_checkouts 4. model.shopify.int_shopify__discounts__abandoned_checkouts 5. model.shopify.int_shopify__discounts__order_aggregates 5. model.shopify.int_shopify__discounts__order_aggregates 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code _fivetran_synced code created_at discount_code_id price_rule_id updated_at usage_count source_relation 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f1 40. model.shopify_source.stg_shopify__discount_code:f1->18. model.shopify.shopify__discounts:f2 40. model.shopify_source.stg_shopify__discount_code:f2->18. model.shopify.shopify__discounts:f3 40. model.shopify_source.stg_shopify__discount_code:f3->18. model.shopify.shopify__discounts:f4 40. model.shopify_source.stg_shopify__discount_code:f3->18. model.shopify.shopify__discounts:f0 40. model.shopify_source.stg_shopify__discount_code:f4->18. model.shopify.shopify__discounts:f5 40. model.shopify_source.stg_shopify__discount_code:f5->18. model.shopify.shopify__discounts:f6 40. model.shopify_source.stg_shopify__discount_code:f6->18. model.shopify.shopify__discounts:f7 40. model.shopify_source.stg_shopify__discount_code:f7->18. model.shopify.shopify__discounts:f37 40. model.shopify_source.stg_shopify__discount_code:f7->18. model.shopify.shopify__discounts:f0 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule allocation_limit allocation_method created_at customer_selection ends_at is_once_per_customer prereq_min_quantity prereq_max_shipping_price prereq_min_subtotal prereq_min_purchase_quantity_for_entitlement prereq_buy_x_get_this prereq_buy_this_get_y starts_at target_selection target_type title updated_at usage_limit value value_type source_relation 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f8 72. model.shopify_source.stg_shopify__price_rule:f1->18. model.shopify.shopify__discounts:f9 72. model.shopify_source.stg_shopify__price_rule:f2->18. model.shopify.shopify__discounts:f10 72. model.shopify_source.stg_shopify__price_rule:f3->18. model.shopify.shopify__discounts:f11 72. model.shopify_source.stg_shopify__price_rule:f4->18. model.shopify.shopify__discounts:f12 72. model.shopify_source.stg_shopify__price_rule:f5->18. model.shopify.shopify__discounts:f13 72. model.shopify_source.stg_shopify__price_rule:f6->18. model.shopify.shopify__discounts:f14 72. model.shopify_source.stg_shopify__price_rule:f7->18. model.shopify.shopify__discounts:f15 72. model.shopify_source.stg_shopify__price_rule:f8->18. model.shopify.shopify__discounts:f16 72. model.shopify_source.stg_shopify__price_rule:f9->18. model.shopify.shopify__discounts:f17 72. model.shopify_source.stg_shopify__price_rule:f10->18. model.shopify.shopify__discounts:f18 72. model.shopify_source.stg_shopify__price_rule:f11->18. model.shopify.shopify__discounts:f19 72. model.shopify_source.stg_shopify__price_rule:f12->18. model.shopify.shopify__discounts:f20 72. model.shopify_source.stg_shopify__price_rule:f13->18. model.shopify.shopify__discounts:f21 72. model.shopify_source.stg_shopify__price_rule:f14->18. model.shopify.shopify__discounts:f22 72. model.shopify_source.stg_shopify__price_rule:f15->18. model.shopify.shopify__discounts:f23 72. model.shopify_source.stg_shopify__price_rule:f16->18. model.shopify.shopify__discounts:f24 72. model.shopify_source.stg_shopify__price_rule:f17->18. model.shopify.shopify__discounts:f25 72. model.shopify_source.stg_shopify__price_rule:f18->18. model.shopify.shopify__discounts:f26 72. model.shopify_source.stg_shopify__price_rule:f19->18. model.shopify.shopify__discounts:f27 72. model.shopify_source.stg_shopify__price_rule:f20->18. model.shopify.shopify__discounts:f37
Name Type Comment
discounts_unique_key None Unique key representing a discount. Hashed on 'discount_code_id' and 'source_relation'.
_fivetran_synced None The time when a record was last updated by Fivetran.
code None The case-insensitive discount code that customers use at checkout. Shopify recommends this map onto the associated `price_rule.title`.
created_at None The date and time (ISO 8601 format) when the discount code was created.
discount_code_id None The ID for the discount code.
price_rule_id None The ID for the price rule.
updated_at None The date and time (ISO 8601 format) when the discount code was updated.
usage_count None The number of times that the discount code has been redeemed.
allocation_limit None The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the allocation_limit is 3. Empty (null) allocation_limit means unlimited number of allocations.
allocation_method None The allocation method of the price rule. Valid values include `each` (the discount is applied to each of the entitled items. For example, for a price rule that takes $15 off, each entitled line item in a checkout will be discounted by $15) and `across` (the calculated discount amount will be applied across the entitled items. For example, for a price rule that takes $15 off, the discount will be applied across all the entitled items).
price_rule_created_at None The date and time (ISO 8601 format) when the price rule was created.
customer_selection None The customer selection for the price rule. Valid values include `all` (the price rule is valid for all customers) and `prerequisite` (the customer must either belong to one of the customer segments specified by customer_segment_prerequisite_ids, or be one of the customers specified by prerequisite_customer_ids).
ends_at None The date and time (ISO 8601 format) when the price rule ends. Must be after starts_at.
is_once_per_customer None Boolean representing whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID.
prereq_min_quantity None If `customer_selection` is `prerequisite`, the minimum number of items for the price rule to be applicable. The quantity of an entitled cart item must be greater than or equal to this value.
prereq_max_shipping_price None If `customer_selection` is `prerequisite`, the maximum shipping price for the price rule to be applicable. The shipping price must be less than or equal to this value
prereq_min_subtotal None If `customer_selection` is `prerequisite`, the minimum subtotal for the price rule to be applicable. The subtotal of the entitled cart items must be greater than or equal to this value for the discount to apply.
prereq_min_purchase_quantity_for_entitlement None If `customer_selection` is `prerequisite`, the prerequisite purchase for a Buy X Get Y discount. The minimum purchase amount required to be entitled to the discount.
prereq_buy_x_get_this None If `customer_selection` is `prerequisite`, in a Buy/Get ratio for a Buy X Get Y discount, this is the offered 'get' quantity.
prereq_buy_this_get_y None If `customer_selection` is `prerequisite`, in a Buy/Get ratio for a Buy X Get Y discount, this defines the necessary 'buy' quantity.
starts_at None The date and time (ISO 8601 format) when the price rule starts.
target_selection None The target selection method of the price rule. Valid values include `all` (the price rule applies the discount to all line items in the checkout) and `entitled` (the price rule applies the discount to selected entitlements only).
target_type None The target type that the price rule applies to. Valid values include `line_item` (the price rule applies to the cart's line items) and `shipping_line` (the price rule applies to the cart's shipping lines).
title None The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. Shopify recommends that this map onto the associated `discount_code.code`.
price_rule_updated_at None The date and time (ISO 8601 format) when the price rule was updated.
usage_limit None The maximum number of times the price rule can be used, per discount code.
value None The value of the price rule. If if the value of `target_type` is `shipping_line`, then only -100 is accepted. The value must be negative.
value_type None The value type of the price rule. Valid values include `fixed_amount` (applies a discount of value as a unit of the store's currency. For example, if value is -30 and the store's currency is USD, then $30 USD is deducted when the discount is applied) and `percentage` (applies a percentage discount of value. For example, if value is -30, then 30% will be deducted when the discount is applied). If `target_type` is `shipping_line`, then only `percentage` is accepted.
total_order_discount_amount None Total monetary amount (in shop currency) of discounts taken off of orders.
total_abandoned_checkout_discount_amount None Total monetary amount (in shop currency) of discounts taken off abandoned checkout orders.
total_order_line_items_price None Total monetary amount (in shop currency) of line items for orders that have used this discount.
total_order_shipping_cost None Total shipping costs for orders that used this discount.
total_abandoned_checkout_shipping_price None Total projected shipping costs for abandoned checkouts that applied this discount first.
total_order_refund_amount None Total refunded amount (in shop currency) for orders that used this discount code.
count_customers None Count of distinct customers who placed orders using this discount.
count_customer_emails None Count of distinct customer emails who placed orders using this discount.
avg_order_discount_amount None Average amount (in shop currency) of discount taken off orders.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
count_orders None Count of orders in which this discount code was applied.
count_abandoned_checkouts None Count of abandoned checkouts in which this discount code was applied.
count_abandoned_checkout_customers None Distinct count of customers who applied this discount in a checkout that they abandoned.
count_abandoned_checkout_customer_emails None Distinct count of customer emails who applied this discount in a checkout that they abandoned.
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code discount_code_id source_relation 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts discount_code_id discounts_unique_key source_relation 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f1 40. model.shopify_source.stg_shopify__discount_code:f1->18. model.shopify.shopify__discounts:f2 40. model.shopify_source.stg_shopify__discount_code:f1->18. model.shopify.shopify__discounts:f1
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[discount_code_id]
    • Direct The column is directly copied without any transformation
    • Other Used to create the discounts_unique_key
    • Output Columns:
      • discount_code_id: Directly copied to the output
      • discounts_unique_key: Part of the MD5 hash to create this unique key
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join conditions with other tables
    • Other Used to create the discounts_unique_key
    • Output Columns:
      • source_relation: Directly copied to the output
      • discounts_unique_key: Part of the MD5 hash to create this unique key
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code _fivetran_synced 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts _fivetran_synced 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code code 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts code 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[code]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables (orders_aggregated and abandoned_checkouts_aggregated)
    • Output Columns:
      • code: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code created_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts created_at 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[created_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_at: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code discount_code_id 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts discount_code_id discounts_unique_key 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f1
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[discount_code_id]
    • Direct The column is directly copied without any transformation
    • Other Used to create the discounts_unique_key
    • Output Columns:
      • discount_code_id: Directly copied to the output
      • discounts_unique_key: Part of the MD5 hash to create this unique key
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code price_rule_id 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts price_rule_id 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[price_rule_id]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the price_rule table
    • Output Columns:
      • price_rule_id: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code updated_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts updated_at 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • updated_at: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code usage_count 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts usage_count 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[usage_count]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • usage_count: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule allocation_limit 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts allocation_limit 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[allocation_limit]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • allocation_limit: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule allocation_method 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts allocation_method 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[allocation_method]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • allocation_method: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule created_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts price_rule_created_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[created_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • price_rule_created_at: Directly copied to the output with a renamed column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule customer_selection 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts customer_selection 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[customer_selection]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • customer_selection: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule ends_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts ends_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[ends_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • ends_at: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule is_once_per_customer 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts is_once_per_customer 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[is_once_per_customer]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_once_per_customer: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_min_quantity 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_min_quantity 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_min_quantity]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • prereq_min_quantity: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_max_shipping_price 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_max_shipping_price 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_max_shipping_price]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • prereq_max_shipping_price: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_min_subtotal 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_min_subtotal 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_min_subtotal]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_min_subtotal: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_min_purchase_quantity_for_entitlement 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_min_purchase_quantity_for_entitlement 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_min_purchase_quantity_for_entitlement]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_min_purchase_quantity_for_entitlement: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_buy_x_get_this 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_buy_x_get_this 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_buy_x_get_this]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_buy_x_get_this: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_buy_this_get_y 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_buy_this_get_y 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_buy_this_get_y]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_buy_this_get_y: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule starts_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts starts_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[starts_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • starts_at: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule target_selection 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts target_selection 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[target_selection]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • target_selection: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule target_type 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts target_type 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[target_type]
    • Direct This column is directly copied without any transformation
    • Other Used in a CASE statement to determine the discount type for joining with aggregated data
    • Output Columns:
      • target_type: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule title 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts title 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[title]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • title: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule updated_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts price_rule_updated_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[updated_at]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is renamed to 'price_rule_updated_at' for clarity
    • Output Columns:
      • price_rule_updated_at: Mapped after being renamed
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule usage_limit 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts usage_limit 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[usage_limit]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • usage_limit: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule value 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts value 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • value: It is directly mapped to the output column 'value'
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule value_type 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts value_type 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[value_type]
    • Direct The column is directly copied without any transformation
    • Other Used in a CASE statement to determine the type of discount for joining with aggregated data
    • Output Columns:
      • value_type: It is directly mapped to the output column 'value_type'
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code source_relation 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts discounts_unique_key source_relation 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f1 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule source_relation 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f1
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join conditions with other tables
    • Other Used to create the discounts_unique_key
    • Output Columns:
      • source_relation: Directly copied to the output
      • discounts_unique_key: Part of the MD5 hash to create this unique key
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join tables and ensure data from the same source is combined
    • Output Columns:
      • source_relation: It is directly mapped to the output column 'source_relation'
19. model.shopify.shopify__inventory_levels

This SQL query integrates data from multiple Shopify-related tables (inventory levels, items, locations, product variants, orders, refunds, and fulfillments) to create a comprehensive view of inventory and sales performance. It combines inventory data with sales and refund information, calculates various aggregates such as total sales, quantity sold, distinct orders and customers, and fulfillment statuses. The query also includes detailed information about products, variants, and locations, providing a holistic view of inventory across different dimensions.

IntegrationAggregationFeaturizationCleaning
SQL Query
WITH __dbt__cte__shopify__orders__order_refunds AS (
  WITH refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__refund
  ), order_line_refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_refund
  ), refund_join AS (
    SELECT
      refunds.refund_id,
      refunds.created_at,
      refunds.order_id,
      refunds.user_id,
      refunds.source_relation,
      order_line_refunds.order_line_refund_id,
      order_line_refunds.order_line_id,
      order_line_refunds.restock_type,
      order_line_refunds.quantity,
      order_line_refunds.subtotal,
      order_line_refunds.total_tax
    FROM refunds
    LEFT JOIN order_line_refunds
      ON refunds.refund_id = order_line_refunds.refund_id
      AND refunds.source_relation = order_line_refunds.source_relation
  )
  SELECT
    *
  FROM refund_join
), __dbt__cte__int_shopify__inventory_level__aggregates AS (
  WITH order_lines AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line
  ), fulfillment AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__fulfillment
  ), orders AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
    WHERE
      NOT COALESCE(is_deleted, FALSE)
  ), refunds AS (
    SELECT
      *
    FROM __dbt__cte__shopify__orders__order_refunds
  ), refunds_aggregated AS (
    SELECT
      order_line_id,
      source_relation,
      SUM(quantity) AS quantity,
      SUM(COALESCE(subtotal, 0)) AS subtotal
    FROM refunds
    GROUP BY
      1,
      2
  ), joined AS (
    SELECT
      order_lines.order_line_id,
      order_lines.variant_id,
      order_lines.source_relation,
      fulfillment.location_id, /* location id is stored in fulfillment rather than order */
      orders.order_id,
      orders.customer_id,
      fulfillment.fulfillment_id,
      LOWER(orders.email) AS email,
      order_lines.pre_tax_price,
      order_lines.quantity,
      orders.created_timestamp AS order_created_timestamp,
      fulfillment.status AS fulfillment_status,
      refunds_aggregated.subtotal AS subtotal_sold_refunds,
      refunds_aggregated.quantity AS quantity_sold_refunds
    FROM order_lines
    JOIN orders
      ON order_lines.order_id = orders.order_id
      AND order_lines.source_relation = orders.source_relation
    JOIN fulfillment
      ON orders.order_id = fulfillment.order_id
      AND orders.source_relation = fulfillment.source_relation
    LEFT JOIN refunds_aggregated
      ON refunds_aggregated.order_line_id = order_lines.order_line_id
      AND refunds_aggregated.source_relation = order_lines.source_relation
  ), aggregated AS (
    SELECT
      variant_id,
      location_id,
      source_relation,
      SUM(pre_tax_price) AS subtotal_sold,
      SUM(quantity) AS quantity_sold,
      COUNT(DISTINCT order_id) AS count_distinct_orders,
      COUNT(DISTINCT customer_id) AS count_distinct_customers,
      COUNT(DISTINCT email) AS count_distinct_customer_emails,
      MIN(order_created_timestamp) AS first_order_timestamp,
      MAX(order_created_timestamp) AS last_order_timestamp,
      COUNT(DISTINCT CASE WHEN fulfillment_status = 'pending' THEN fulfillment_id END) AS count_fulfillment_pending,
      COUNT(DISTINCT CASE WHEN fulfillment_status = 'open' THEN fulfillment_id END) AS count_fulfillment_open,
      COUNT(DISTINCT CASE WHEN fulfillment_status = 'success' THEN fulfillment_id END) AS count_fulfillment_success,
      COUNT(DISTINCT CASE WHEN fulfillment_status = 'cancelled' THEN fulfillment_id END) AS count_fulfillment_cancelled,
      COUNT(DISTINCT CASE WHEN fulfillment_status = 'error' THEN fulfillment_id END) AS count_fulfillment_error,
      COUNT(DISTINCT CASE WHEN fulfillment_status = 'failure' THEN fulfillment_id END) AS count_fulfillment_failure,
      SUM(COALESCE(subtotal_sold_refunds, 0)) AS subtotal_sold_refunds,
      SUM(COALESCE(quantity_sold_refunds, 0)) AS quantity_sold_refunds
    FROM joined
    GROUP BY
      1,
      2,
      3
  )
  SELECT
    *
  FROM aggregated
), inventory_level AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__inventory_level
), inventory_item AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__inventory_item
), location AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__location
), product_variant AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_variant
), product AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product
), inventory_level_aggregated AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__inventory_level__aggregates
), joined_info AS (
  SELECT
    inventory_level.*,
    inventory_item.sku,
    inventory_item.is_deleted AS is_inventory_item_deleted,
    inventory_item.cost,
    inventory_item.country_code_of_origin,
    inventory_item.province_code_of_origin,
    inventory_item.is_shipping_required,
    inventory_item.is_inventory_quantity_tracked,
    inventory_item.created_at AS inventory_item_created_at,
    inventory_item.updated_at AS inventory_item_updated_at,
    location.name AS location_name,
    location.is_deleted AS is_location_deleted,
    location.is_active AS is_location_active,
    location.address_1,
    location.address_2,
    location.city,
    location.country,
    location.country_code,
    location.is_legacy AS is_legacy_location,
    location.province,
    location.province_code,
    location.phone,
    location.zip,
    location.created_at AS location_created_at,
    location.updated_at AS location_updated_at,
    product_variant.variant_id,
    product_variant.product_id,
    product_variant.title AS variant_title,
    product_variant.inventory_policy AS variant_inventory_policy,
    product_variant.price AS variant_price,
    product_variant.image_id AS variant_image_id,
    product_variant.fulfillment_service AS variant_fulfillment_service,
    product_variant.inventory_management AS variant_inventory_management,
    product_variant.is_taxable AS is_variant_taxable,
    product_variant.barcode AS variant_barcode,
    product_variant.grams AS variant_grams,
    product_variant.inventory_quantity AS variant_inventory_quantity,
    product_variant.weight AS variant_weight,
    product_variant.weight_unit AS variant_weight_unit,
    product_variant.option_1 AS variant_option_1,
    product_variant.option_2 AS variant_option_2,
    product_variant.option_3 AS variant_option_3,
    product_variant.tax_code AS variant_tax_code,
    product_variant.created_timestamp AS variant_created_at,
    product_variant.updated_timestamp AS variant_updated_at
  FROM inventory_level
  JOIN inventory_item
    ON inventory_level.inventory_item_id = inventory_item.inventory_item_id
    AND inventory_level.source_relation = inventory_item.source_relation
  JOIN location
    ON inventory_level.location_id = location.location_id
    AND inventory_level.source_relation = location.source_relation
  JOIN product_variant
    ON inventory_item.inventory_item_id = product_variant.inventory_item_id
    AND inventory_item.source_relation = product_variant.source_relation
), joined_aggregates AS (
  SELECT
    joined_info.*,
    COALESCE(inventory_level_aggregated.subtotal_sold, 0) AS subtotal_sold,
    COALESCE(inventory_level_aggregated.quantity_sold, 0) AS quantity_sold,
    COALESCE(inventory_level_aggregated.count_distinct_orders, 0) AS count_distinct_orders,
    COALESCE(inventory_level_aggregated.count_distinct_customers, 0) AS count_distinct_customers,
    COALESCE(inventory_level_aggregated.count_distinct_customer_emails, 0) AS count_distinct_customer_emails,
    inventory_level_aggregated.first_order_timestamp,
    inventory_level_aggregated.last_order_timestamp,
    COALESCE(inventory_level_aggregated.subtotal_sold_refunds, 0) AS subtotal_sold_refunds,
    COALESCE(inventory_level_aggregated.quantity_sold_refunds, 0) AS quantity_sold_refunds,
    COALESCE(count_fulfillment_pending, 0) AS count_fulfillment_pending,
    COALESCE(count_fulfillment_open, 0) AS count_fulfillment_open,
    COALESCE(count_fulfillment_success, 0) AS count_fulfillment_success,
    COALESCE(count_fulfillment_cancelled, 0) AS count_fulfillment_cancelled,
    COALESCE(count_fulfillment_error, 0) AS count_fulfillment_error,
    COALESCE(count_fulfillment_failure, 0) AS count_fulfillment_failure
  FROM joined_info
  LEFT JOIN inventory_level_aggregated
    ON joined_info.location_id = inventory_level_aggregated.location_id
    AND joined_info.variant_id = inventory_level_aggregated.variant_id
    AND joined_info.source_relation = inventory_level_aggregated.source_relation
), final AS (
  SELECT
    *,
    subtotal_sold - subtotal_sold_refunds AS net_subtotal_sold,
    quantity_sold - quantity_sold_refunds AS net_quantity_sold
  FROM joined_aggregates
)
SELECT
  *
FROM final
%3 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced available_quantity inventory_item_id location_id updated_at is_inventory_item_deleted sku cost province_code_of_origin country_code_of_origin is_shipping_required is_inventory_quantity_tracked inventory_item_created_at inventory_item_updated_at is_location_deleted is_location_active address_1 address_2 city country country_code location_created_at is_legacy_location location_name phone province province_code location_updated_at zip variant_barcode variant_created_at variant_fulfillment_service variant_grams variant_id variant_image_id variant_inventory_management variant_inventory_policy variant_inventory_quantity variant_option_1 variant_option_2 variant_option_3 variant_price product_id is_variant_taxable variant_tax_code variant_title variant_updated_at variant_weight variant_weight_unit subtotal_sold quantity_sold count_distinct_orders count_distinct_customers count_distinct_customer_emails first_order_timestamp last_order_timestamp subtotal_sold_refunds quantity_sold_refunds net_subtotal_sold net_quantity_sold count_fulfillment_pending count_fulfillment_open count_fulfillment_success count_fulfillment_cancelled count_fulfillment_error count_fulfillment_failure source_relation 7. model.shopify.int_shopify__inventory_level__aggregates 7. model.shopify.int_shopify__inventory_level__aggregates 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_deleted _fivetran_synced cost country_code_of_origin created_at inventory_item_id province_code_of_origin is_shipping_required sku is_inventory_quantity_tracked updated_at source_relation 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f5 44. model.shopify_source.stg_shopify__inventory_item:f1->19. model.shopify.shopify__inventory_levels:f0 44. model.shopify_source.stg_shopify__inventory_item:f2->19. model.shopify.shopify__inventory_levels:f7 44. model.shopify_source.stg_shopify__inventory_item:f3->19. model.shopify.shopify__inventory_levels:f9 44. model.shopify_source.stg_shopify__inventory_item:f4->19. model.shopify.shopify__inventory_levels:f12 44. model.shopify_source.stg_shopify__inventory_item:f5->19. model.shopify.shopify__inventory_levels:f2 44. model.shopify_source.stg_shopify__inventory_item:f6->19. model.shopify.shopify__inventory_levels:f8 44. model.shopify_source.stg_shopify__inventory_item:f7->19. model.shopify.shopify__inventory_levels:f10 44. model.shopify_source.stg_shopify__inventory_item:f8->19. model.shopify.shopify__inventory_levels:f6 44. model.shopify_source.stg_shopify__inventory_item:f9->19. model.shopify.shopify__inventory_levels:f11 44. model.shopify_source.stg_shopify__inventory_item:f10->19. model.shopify.shopify__inventory_levels:f13 44. model.shopify_source.stg_shopify__inventory_item:f11->19. model.shopify.shopify__inventory_levels:f66 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level _fivetran_synced available_quantity location_id updated_at source_relation 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0 46. model.shopify_source.stg_shopify__inventory_level:f1->19. model.shopify.shopify__inventory_levels:f1 46. model.shopify_source.stg_shopify__inventory_level:f2->19. model.shopify.shopify__inventory_levels:f3 46. model.shopify_source.stg_shopify__inventory_level:f3->19. model.shopify.shopify__inventory_levels:f4 46. model.shopify_source.stg_shopify__inventory_level:f4->19. model.shopify.shopify__inventory_levels:f66 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_deleted _fivetran_synced is_active address_1 address_2 city country country_code created_at location_id is_legacy name phone province province_code updated_at zip source_relation 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f14 48. model.shopify_source.stg_shopify__location:f1->19. model.shopify.shopify__inventory_levels:f0 48. model.shopify_source.stg_shopify__location:f2->19. model.shopify.shopify__inventory_levels:f15 48. model.shopify_source.stg_shopify__location:f3->19. model.shopify.shopify__inventory_levels:f16 48. model.shopify_source.stg_shopify__location:f4->19. model.shopify.shopify__inventory_levels:f17 48. model.shopify_source.stg_shopify__location:f5->19. model.shopify.shopify__inventory_levels:f18 48. model.shopify_source.stg_shopify__location:f6->19. model.shopify.shopify__inventory_levels:f19 48. model.shopify_source.stg_shopify__location:f7->19. model.shopify.shopify__inventory_levels:f20 48. model.shopify_source.stg_shopify__location:f8->19. model.shopify.shopify__inventory_levels:f21 48. model.shopify_source.stg_shopify__location:f9->19. model.shopify.shopify__inventory_levels:f3 48. model.shopify_source.stg_shopify__location:f10->19. model.shopify.shopify__inventory_levels:f22 48. model.shopify_source.stg_shopify__location:f11->19. model.shopify.shopify__inventory_levels:f23 48. model.shopify_source.stg_shopify__location:f12->19. model.shopify.shopify__inventory_levels:f24 48. model.shopify_source.stg_shopify__location:f13->19. model.shopify.shopify__inventory_levels:f25 48. model.shopify_source.stg_shopify__location:f14->19. model.shopify.shopify__inventory_levels:f26 48. model.shopify_source.stg_shopify__location:f15->19. model.shopify.shopify__inventory_levels:f27 48. model.shopify_source.stg_shopify__location:f16->19. model.shopify.shopify__inventory_levels:f28 48. model.shopify_source.stg_shopify__location:f17->19. model.shopify.shopify__inventory_levels:f66 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product _fivetran_synced product_id source_relation 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0 74. model.shopify_source.stg_shopify__product:f1->19. model.shopify.shopify__inventory_levels:f42 74. model.shopify_source.stg_shopify__product:f2->19. model.shopify.shopify__inventory_levels:f66 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant barcode created_timestamp fulfillment_service grams variant_id image_id inventory_management inventory_policy inventory_quantity option_1 option_2 option_3 price product_id sku is_taxable tax_code title updated_timestamp weight weight_unit _fivetran_synced source_relation 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f29 80. model.shopify_source.stg_shopify__product_variant:f1->19. model.shopify.shopify__inventory_levels:f30 80. model.shopify_source.stg_shopify__product_variant:f2->19. model.shopify.shopify__inventory_levels:f31 80. model.shopify_source.stg_shopify__product_variant:f3->19. model.shopify.shopify__inventory_levels:f32 80. model.shopify_source.stg_shopify__product_variant:f4->19. model.shopify.shopify__inventory_levels:f33 80. model.shopify_source.stg_shopify__product_variant:f5->19. model.shopify.shopify__inventory_levels:f34 80. model.shopify_source.stg_shopify__product_variant:f6->19. model.shopify.shopify__inventory_levels:f35 80. model.shopify_source.stg_shopify__product_variant:f7->19. model.shopify.shopify__inventory_levels:f36 80. model.shopify_source.stg_shopify__product_variant:f8->19. model.shopify.shopify__inventory_levels:f37 80. model.shopify_source.stg_shopify__product_variant:f9->19. model.shopify.shopify__inventory_levels:f38 80. model.shopify_source.stg_shopify__product_variant:f10->19. model.shopify.shopify__inventory_levels:f39 80. model.shopify_source.stg_shopify__product_variant:f11->19. model.shopify.shopify__inventory_levels:f40 80. model.shopify_source.stg_shopify__product_variant:f12->19. model.shopify.shopify__inventory_levels:f41 80. model.shopify_source.stg_shopify__product_variant:f13->19. model.shopify.shopify__inventory_levels:f42 80. model.shopify_source.stg_shopify__product_variant:f14->19. model.shopify.shopify__inventory_levels:f6 80. model.shopify_source.stg_shopify__product_variant:f15->19. model.shopify.shopify__inventory_levels:f43 80. model.shopify_source.stg_shopify__product_variant:f16->19. model.shopify.shopify__inventory_levels:f44 80. model.shopify_source.stg_shopify__product_variant:f17->19. model.shopify.shopify__inventory_levels:f45 80. model.shopify_source.stg_shopify__product_variant:f18->19. model.shopify.shopify__inventory_levels:f46 80. model.shopify_source.stg_shopify__product_variant:f19->19. model.shopify.shopify__inventory_levels:f47 80. model.shopify_source.stg_shopify__product_variant:f20->19. model.shopify.shopify__inventory_levels:f48 80. model.shopify_source.stg_shopify__product_variant:f21->19. model.shopify.shopify__inventory_levels:f0 80. model.shopify_source.stg_shopify__product_variant:f22->19. model.shopify.shopify__inventory_levels:f66
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
available_quantity None The available quantity of an inventory item at the inventory level's associated location. Returns null if the inventory item is not tracked.
inventory_item_id None The ID of the inventory item associated with the inventory level.
location_id None The ID of the location that the inventory level belongs to.
updated_at None The date and time (ISO 8601 format) when the inventory level was last modified.
is_inventory_item_deleted None Boolean representing whether the record was soft-deleted in Shopify.
sku None The unique SKU (stock keeping unit) of the inventory item.
cost None The unit cost of the inventory item. The shop's default currency is used.
province_code_of_origin None The province code (ISO 3166-2 alpha-2) of where the item came from. The province code is only used if the shipping provider for the inventory item is Canada Post.
country_code_of_origin None The country code (ISO 3166-1 alpha-2) of where the item came from.
is_shipping_required None Boolean representing whether a customer needs to provide a shipping address when placing an order containing the inventory item.
is_inventory_quantity_tracked None Boolean representing whether inventory levels are tracked for the item. If true, then the inventory quantity changes are tracked by Shopify.
inventory_item_created_at None The date and time (ISO 8601 format) when the inventory item was created.
inventory_item_updated_at None The date and time (ISO 8601 format) when the inventory item was last modified.
is_location_deleted None Boolean representing whether the record was soft-deleted in Shopify.
is_location_active None Boolean representing whether the location is active. If true, then the location can be used to sell products, stock inventory, and fulfill orders.
address_1 None The location's street address.
address_2 None The optional second line of the location's street address.
city None The city the location is in.
country None The country the location is in (two-letter code).
country_code None The two-letter code (ISO 3166-1 alpha-2 format) corresponding to country the location is in.
location_created_at None The date and time (ISO 8601 format) when the location was created.
is_legacy_location None Boolean representing whether this is a fulfillment service location. If true, then the location is a fulfillment service location. If false, then the location was created by the merchant and isn't tied to a fulfillment service.
location_name None The name of the location.
phone None The phone number of the location. This value can contain special characters, such as - or +.
province None The province, state, or district of the location.
province_code None The province, state, or district code (ISO 3166-2 alpha-2 format) of the location.
location_updated_at None The date and time (ISO 8601 format) when the location was last updated.
zip None The zip or postal code.
variant_barcode None The barcode, UPC, or ISBN number for the product.
variant_created_at None The date and time (ISO 8601 format) when the product variant was created.
variant_fulfillment_service None The fulfillment service associated with the product variant.
variant_grams None The weight of the product variant in grams.
variant_id None The unique numeric identifier for the product variant.
variant_image_id None The unique numeric identifier for a product's image. The image must be associated to the same product as the variant.
variant_inventory_management None The fulfillment service that tracks the number of items in stock for the product variant.
variant_inventory_policy None Whether customers are allowed to place an order for the product variant when it's out of stock.
variant_inventory_quantity None An aggregate of inventory across all locations. To adjust inventory at a specific location, use the InventoryLevel resource.
variant_option_1 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
variant_option_2 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
variant_option_3 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
variant_price None The price of the product variant in shop currency.
product_id None The unique numeric identifier for the product.
is_variant_taxable None Whether a tax is charged when the product variant is sold.
variant_tax_code None This parameter applies only to the stores that have the Avalara AvaTax app installed. Specifies the Avalara tax code for the product variant.
variant_title None The title of the product variant. The title field is a concatenation of the option1, option2, and option3 fields. You can only update title indirectly using the option fields.
variant_updated_at None The date and time when the product variant was last modified. Gets returned in ISO 8601 format.
variant_weight None The weight of the product variant in the unit system specified with weight_unit.
variant_weight_unit None The unit of measurement that applies to the product variant's weight. If you don't specify a value for weight_unit, then the shop's default unit of measurement is applied. Valid values: g, kg, oz, and lb.
subtotal_sold None Total amount (monetary, in shop currency) sold from the inventory level. Includes refunds.
quantity_sold None Total quantity sold from the inventory level. Includes refunds.
count_distinct_orders None The number of distinct orders placed from this inventory level.
count_distinct_customers None The number of distinct customers (based on customer_id) that have placed orders against this inventory level.
count_distinct_customer_emails None The number of distinct customer emails that have placed orders against this inventory level.
first_order_timestamp None The timetamp of the first order against this inventory level.
last_order_timestamp None The timestamp of the first order against this inventory level.
subtotal_sold_refunds None The monetary amount (in shop currency) of inventory level goods that have been refunded.
quantity_sold_refunds None The quantity of inventory level goods that have been refunded.
net_subtotal_sold None Net monetary amount sold (in shop currency) from the inventory level. Excludes refunds.
net_quantity_sold None Net quantity sold from this inventory level. Excludes refunds.
count_fulfillment_pending None Count of currently pending distinct fulfillments for this inventory level. "Pending" = Shopify has created the fulfillment and is waiting for the third-party fulfillment service to transition it to 'open' or 'success'.
count_fulfillment_open None Count of currently open distinct fulfillments for this inventory level. "Open" = The fulfillment has been acknowledged by the service and is in processing.
count_fulfillment_success None Count of successful distinct fulfillments for this inventory level. "Success" = The fulfillment was successful.
count_fulfillment_cancelled None Count of cancelled distinct fulfillments for this inventory level. "Cancelled" = The fulfillment was cancelled.
count_fulfillment_error None Count of distinct fulfillments for this inventory level that encountered an error. "Error" = There was an error with the fulfillment request.
count_fulfillment_failure None Count of distinct fulfillments for this inventory level that failed. "Failure" = The fulfillment request failed.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item _fivetran_synced 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level _fivetran_synced 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location _fivetran_synced 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product _fivetran_synced 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant _fivetran_synced 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 48. model.shopify_source.stg_shopify__location[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 74. model.shopify_source.stg_shopify__product[_fivetran_synced]
    • Direct This column is likely directly copied to the output for tracking the last sync time
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[_fivetran_synced]
    • Direct The column is likely directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to this output column
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level available_quantity 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels available_quantity 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[available_quantity]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • available_quantity: Directly copied to the output
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item inventory_item_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels inventory_item_id 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[inventory_item_id]
    • Integration Used as a key to join with other tables
    • Output Columns:
      • inventory_item_id: Directly copied
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level location_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_id 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location location_id 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[location_id]
    • Integration This column is used as a key to join with the location table
    • Aggregation This column is used in grouping for aggregations
    • Output Columns:
      • location_id: Directly copied to the output and used in aggregations
  • Input Column: 48. model.shopify_source.stg_shopify__location[location_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables
    • Output Columns:
      • location_id: Directly copied to the output
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level updated_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels updated_at 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[updated_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • updated_at: Directly copied to the output
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_deleted 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_inventory_item_deleted 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[is_deleted]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_inventory_item_deleted: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item sku 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels sku 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant sku 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[sku]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sku: Directly copied
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[sku]
    • Direct This column is directly copied to the output
    • Output Columns:
      • sku: Directly copied without transformation
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item cost 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels cost 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[cost]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • cost: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item province_code_of_origin 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels province_code_of_origin 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[province_code_of_origin]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • province_code_of_origin: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item country_code_of_origin 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels country_code_of_origin 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[country_code_of_origin]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • country_code_of_origin: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_shipping_required 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_shipping_required 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[is_shipping_required]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_shipping_required: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_inventory_quantity_tracked 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_inventory_quantity_tracked 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[is_inventory_quantity_tracked]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_inventory_quantity_tracked: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item created_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels inventory_item_created_at 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[created_at]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • inventory_item_created_at: Directly copied with a renamed column
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item updated_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels inventory_item_updated_at 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • inventory_item_updated_at: This column is directly mapped to inventory_item_updated_at in the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_deleted 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_location_deleted 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[is_deleted]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_location_deleted: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_active 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_location_active 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[is_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_location_active: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location address_1 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels address_1 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[address_1]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • address_1: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location address_2 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels address_2 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[address_2]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • address_2: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location city 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels city 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[city]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • city: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location country 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels country 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[country]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • country: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location country_code 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels country_code 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[country_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location created_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_created_at 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[created_at]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • location_created_at: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_legacy 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_legacy_location 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[is_legacy]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_legacy_location: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location name 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_name 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • location_name: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location phone 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels phone 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[phone]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • phone: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location province 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels province 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[province]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • province: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location province_code 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels province_code 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[province_code]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • province_code: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location updated_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_updated_at 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • location_updated_at: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location zip 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels zip 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[zip]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • zip: Directly copied to the output
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant barcode 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_barcode 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[barcode]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_barcode: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant created_timestamp 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_created_at 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column may be formatted to ensure consistent ISO 8601 format
    • Output Columns:
      • variant_created_at: Directly copied to this output column, possibly with formatting
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant fulfillment_service 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_fulfillment_service 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[fulfillment_service]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_fulfillment_service: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant grams 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_grams 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[grams]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_grams: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant variant_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_id 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[variant_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables
    • Output Columns:
      • variant_id: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant image_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_image_id 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[image_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_image_id: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_management 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_inventory_management 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_management]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_inventory_management: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_policy 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_inventory_policy 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_policy]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_inventory_policy: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_quantity 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_inventory_quantity 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_quantity]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_inventory_quantity: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_1 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_option_1 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_1]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_option_1: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_2 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_option_2 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_2]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_option_2: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_3 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_option_3 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_3]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_option_3: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant price 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_price 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[price]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_price: Directly copied without transformation
Column Lineage
%3 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product product_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels product_id 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant product_id 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 74. model.shopify_source.stg_shopify__product[product_id]
    • Integration This column is used to join with other tables, particularly the product_variant table
    • Output Columns:
      • product_id: Directly copied
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[product_id]
    • Direct This column is directly copied to the output
    • Integration Used to join with other tables
    • Output Columns:
      • product_id: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant is_taxable 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_variant_taxable 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[is_taxable]
    • Direct This column is directly copied to the output
    • Output Columns:
      • is_variant_taxable: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant tax_code 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_tax_code 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[tax_code]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_tax_code: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant title 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_title 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_title: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant updated_timestamp 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_updated_at 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[updated_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column might be cast or formatted to ensure consistent datetime format
    • Output Columns:
      • variant_updated_at: Directly copied to this output column, possibly with formatting
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant weight 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_weight 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant weight_unit 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_weight_unit 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight_unit]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight_unit: Directly copied to this output column
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item source_relation 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels source_relation 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level source_relation 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location source_relation 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product source_relation 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant source_relation 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[source_relation]
    • Integration The column is used as a key to join tables
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • source_relation: This column is directly copied to the output source_relation column
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[source_relation]
    • Integration This column is used as a key to join with other tables
    • Aggregation This column is used in grouping for aggregations
    • Output Columns:
      • source_relation: Directly copied to the output and used in joins and aggregations
  • Input Column: 48. model.shopify_source.stg_shopify__location[source_relation]
    • Integration This column is used as part of the join condition to combine data from different tables
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • source_relation: Directly copied to the output column with the same name
  • Input Column: 74. model.shopify_source.stg_shopify__product[source_relation]
    • Integration This column is used as a key to join tables and ensure data from the same source is combined correctly.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join or union with other tables
    • Output Columns:
      • source_relation: Directly copied to this output column
20. model.shopify.shopify__order_lines

This SQL query integrates data from multiple Shopify-related tables to create a comprehensive view of order lines. It joins order line data with refund information, product variant details, and tax information. The query calculates net quantities and subtotals after refunds, and includes various product variant attributes. It also aggregates refund and tax data at the order line level.

IntegrationAggregationFeaturization
SQL Query
WITH __dbt__cte__shopify__orders__order_refunds AS (
  WITH refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__refund
  ), order_line_refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_refund
  ), refund_join AS (
    SELECT
      refunds.refund_id,
      refunds.created_at,
      refunds.order_id,
      refunds.user_id,
      refunds.source_relation,
      order_line_refunds.order_line_refund_id,
      order_line_refunds.order_line_id,
      order_line_refunds.restock_type,
      order_line_refunds.quantity,
      order_line_refunds.subtotal,
      order_line_refunds.total_tax
    FROM refunds
    LEFT JOIN order_line_refunds
      ON refunds.refund_id = order_line_refunds.refund_id
      AND refunds.source_relation = order_line_refunds.source_relation
  )
  SELECT
    *
  FROM refund_join
), order_lines AS (
  SELECT
    *,
    MD5(
      CAST(COALESCE(CAST(source_relation AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(order_line_id AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS order_lines_unique_key
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line
), product_variants AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_variant
), refunds AS (
  SELECT
    *
  FROM __dbt__cte__shopify__orders__order_refunds
), refunds_aggregated AS (
  SELECT
    order_line_id,
    source_relation,
    SUM(quantity) AS quantity,
    SUM(COALESCE(subtotal, 0)) AS subtotal,
    LISTAGG(DISTINCT CAST(refunds.restock_type AS TEXT), ', ') AS restock_types
  FROM refunds
  GROUP BY
    1,
    2
), tax_lines AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__tax_line
), tax_lines_aggregated AS (
  SELECT
    tax_lines.order_line_id,
    tax_lines.source_relation,
    SUM(tax_lines.price) AS order_line_tax
  FROM tax_lines
  GROUP BY
    1,
    2
), joined AS (
  SELECT
    order_lines.*,
    refunds_aggregated.restock_types,
    COALESCE(refunds_aggregated.quantity, 0) AS refunded_quantity,
    COALESCE(refunds_aggregated.subtotal, 0) AS refunded_subtotal,
    order_lines.quantity - COALESCE(refunds_aggregated.quantity, 0) AS quantity_net_refunds,
    order_lines.pre_tax_price - COALESCE(refunds_aggregated.subtotal, 0) AS subtotal_net_refunds,
    product_variants.created_timestamp AS variant_created_at,
    product_variants.updated_timestamp AS variant_updated_at,
    product_variants.inventory_item_id,
    product_variants.image_id,
    product_variants.price AS variant_price,
    product_variants.sku AS variant_sku,
    product_variants.position AS variant_position,
    product_variants.inventory_policy AS variant_inventory_policy,
    product_variants.compare_at_price AS variant_compare_at_price,
    product_variants.fulfillment_service AS variant_fulfillment_service,
    product_variants.is_taxable AS variant_is_taxable,
    product_variants.barcode AS variant_barcode,
    product_variants.grams AS variant_grams,
    product_variants.inventory_quantity AS variant_inventory_quantity,
    product_variants.weight AS variant_weight,
    product_variants.weight_unit AS variant_weight_unit,
    product_variants.option_1 AS variant_option_1,
    product_variants.option_2 AS variant_option_2,
    product_variants.option_3 AS variant_option_3,
    product_variants.tax_code AS variant_tax_code,
    tax_lines_aggregated.order_line_tax
  FROM order_lines
  LEFT JOIN refunds_aggregated
    ON refunds_aggregated.order_line_id = order_lines.order_line_id
    AND refunds_aggregated.source_relation = order_lines.source_relation
  LEFT JOIN product_variants
    ON product_variants.variant_id = order_lines.variant_id
    AND product_variants.source_relation = order_lines.source_relation
  LEFT JOIN tax_lines_aggregated
    ON tax_lines_aggregated.order_line_id = order_lines.order_line_id
    AND tax_lines_aggregated.source_relation = order_lines.source_relation
)
SELECT
  *
FROM joined
%3 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_lines_unique_key _fivetran_synced fulfillable_quantity fulfillment_status is_gift_card grams order_line_id name order_id price product_id quantity is_shipping_required sku is_taxable title total_discount variant_id vendor refunded_quantity quantity_net_refunds variant_barcode variant_compare_at_price variant_created_at variant_fulfillment_service variant_grams inventory_item_id variant_inventory_management variant_inventory_policy variant_inventory_quantity variant_option_1 variant_option_2 variant_option_3 variant_position variant_price variant_sku variant_is_taxable variant_tax_code variant_title variant_updated_at variant_weight variant_weight_unit refunded_subtotal subtotal_net_refunds image_id source_relation restock_types order_line_tax index pre_tax_price tax_code pre_tax_price_set price_set total_discount_set properties 23. model.shopify.shopify__orders__order_refunds 23. model.shopify.shopify__orders__order_refunds 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line _fivetran_synced fulfillable_quantity fulfillment_status is_gift_card grams order_line_id name order_id price product_id quantity is_shipping_required sku is_taxable title total_discount variant_id vendor source_relation index pre_tax_price pre_tax_price_set price_set tax_code total_discount_set variant_title variant_inventory_management properties 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1 57. model.shopify_source.stg_shopify__order_line:f1->20. model.shopify.shopify__order_lines:f2 57. model.shopify_source.stg_shopify__order_line:f2->20. model.shopify.shopify__order_lines:f3 57. model.shopify_source.stg_shopify__order_line:f3->20. model.shopify.shopify__order_lines:f4 57. model.shopify_source.stg_shopify__order_line:f4->20. model.shopify.shopify__order_lines:f5 57. model.shopify_source.stg_shopify__order_line:f5->20. model.shopify.shopify__order_lines:f6 57. model.shopify_source.stg_shopify__order_line:f5->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f6->20. model.shopify.shopify__order_lines:f7 57. model.shopify_source.stg_shopify__order_line:f7->20. model.shopify.shopify__order_lines:f8 57. model.shopify_source.stg_shopify__order_line:f8->20. model.shopify.shopify__order_lines:f9 57. model.shopify_source.stg_shopify__order_line:f9->20. model.shopify.shopify__order_lines:f10 57. model.shopify_source.stg_shopify__order_line:f10->20. model.shopify.shopify__order_lines:f11 57. model.shopify_source.stg_shopify__order_line:f10->20. model.shopify.shopify__order_lines:f20 57. model.shopify_source.stg_shopify__order_line:f11->20. model.shopify.shopify__order_lines:f12 57. model.shopify_source.stg_shopify__order_line:f12->20. model.shopify.shopify__order_lines:f13 57. model.shopify_source.stg_shopify__order_line:f13->20. model.shopify.shopify__order_lines:f14 57. model.shopify_source.stg_shopify__order_line:f14->20. model.shopify.shopify__order_lines:f15 57. model.shopify_source.stg_shopify__order_line:f15->20. model.shopify.shopify__order_lines:f16 57. model.shopify_source.stg_shopify__order_line:f16->20. model.shopify.shopify__order_lines:f17 57. model.shopify_source.stg_shopify__order_line:f17->20. model.shopify.shopify__order_lines:f18 57. model.shopify_source.stg_shopify__order_line:f18->20. model.shopify.shopify__order_lines:f45 57. model.shopify_source.stg_shopify__order_line:f18->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f19->20. model.shopify.shopify__order_lines:f48 57. model.shopify_source.stg_shopify__order_line:f20->20. model.shopify.shopify__order_lines:f49 57. model.shopify_source.stg_shopify__order_line:f20->20. model.shopify.shopify__order_lines:f43 57. model.shopify_source.stg_shopify__order_line:f21->20. model.shopify.shopify__order_lines:f51 57. model.shopify_source.stg_shopify__order_line:f22->20. model.shopify.shopify__order_lines:f52 57. model.shopify_source.stg_shopify__order_line:f23->20. model.shopify.shopify__order_lines:f50 57. model.shopify_source.stg_shopify__order_line:f24->20. model.shopify.shopify__order_lines:f53 57. model.shopify_source.stg_shopify__order_line:f25->20. model.shopify.shopify__order_lines:f38 57. model.shopify_source.stg_shopify__order_line:f26->20. model.shopify.shopify__order_lines:f27 57. model.shopify_source.stg_shopify__order_line:f27->20. model.shopify.shopify__order_lines:f54 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant barcode compare_at_price created_timestamp fulfillment_service grams image_id inventory_item_id inventory_policy inventory_quantity option_1 option_2 option_3 position price sku is_taxable tax_code title updated_timestamp weight weight_unit 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f21 80. model.shopify_source.stg_shopify__product_variant:f1->20. model.shopify.shopify__order_lines:f22 80. model.shopify_source.stg_shopify__product_variant:f2->20. model.shopify.shopify__order_lines:f23 80. model.shopify_source.stg_shopify__product_variant:f3->20. model.shopify.shopify__order_lines:f24 80. model.shopify_source.stg_shopify__product_variant:f4->20. model.shopify.shopify__order_lines:f25 80. model.shopify_source.stg_shopify__product_variant:f5->20. model.shopify.shopify__order_lines:f44 80. model.shopify_source.stg_shopify__product_variant:f6->20. model.shopify.shopify__order_lines:f26 80. model.shopify_source.stg_shopify__product_variant:f7->20. model.shopify.shopify__order_lines:f28 80. model.shopify_source.stg_shopify__product_variant:f8->20. model.shopify.shopify__order_lines:f29 80. model.shopify_source.stg_shopify__product_variant:f9->20. model.shopify.shopify__order_lines:f30 80. model.shopify_source.stg_shopify__product_variant:f10->20. model.shopify.shopify__order_lines:f31 80. model.shopify_source.stg_shopify__product_variant:f11->20. model.shopify.shopify__order_lines:f32 80. model.shopify_source.stg_shopify__product_variant:f12->20. model.shopify.shopify__order_lines:f33 80. model.shopify_source.stg_shopify__product_variant:f13->20. model.shopify.shopify__order_lines:f34 80. model.shopify_source.stg_shopify__product_variant:f14->20. model.shopify.shopify__order_lines:f35 80. model.shopify_source.stg_shopify__product_variant:f15->20. model.shopify.shopify__order_lines:f36 80. model.shopify_source.stg_shopify__product_variant:f16->20. model.shopify.shopify__order_lines:f37 80. model.shopify_source.stg_shopify__product_variant:f17->20. model.shopify.shopify__order_lines:f38 80. model.shopify_source.stg_shopify__product_variant:f18->20. model.shopify.shopify__order_lines:f39 80. model.shopify_source.stg_shopify__product_variant:f19->20. model.shopify.shopify__order_lines:f40 80. model.shopify_source.stg_shopify__product_variant:f20->20. model.shopify.shopify__order_lines:f41 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line price 86. model.shopify_source.stg_shopify__tax_line:f0->20. model.shopify.shopify__order_lines:f47
Name Type Comment
order_lines_unique_key None Unique key representing an order line. Hashed on 'order_line_id' and 'source_relation'.
_fivetran_synced None The time when a record was last updated by Fivetran.
fulfillable_quantity None The amount available to fulfill, calculated as follows: quantity - max(refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity - open_fulfilled_quantity
fulfillment_status None How far along an order is in terms line items fulfilled.
is_gift_card None Whether the item is a gift card. If true, then the item is not taxed or considered for shipping charges.
grams None The weight of the item in grams.
order_line_id None The ID of the line item.
name None The name of the product variant.
order_id None The ID of the related order.
price None The price of the item before discounts have been applied in the shop currency.
product_id None The ID of the product that the line item belongs to. Can be null if the original product associated with the order is deleted at a later date.
quantity None The number of items that were purchased.
is_shipping_required None Whether the item requires shipping.
sku None The item's SKU (stock keeping unit).
is_taxable None Whether the item was taxable.
title None The title of the product.
total_discount None The total amount of the discount allocated to the line item in the shop currency.
variant_id None The ID of the product variant.
vendor None The name of the item's supplier.
refunded_quantity None Quantity of the item that has been refunded.
quantity_net_refunds None Quantity ordered, excluding refunds.
variant_barcode None The barcode, UPC, or ISBN number for the product.
variant_compare_at_price None The original price of the item before an adjustment or a sale in shop currency.
variant_created_at None The date and time (ISO 8601 format) when the product variant was created.
variant_fulfillment_service None The fulfillment service associated with the product variant.
variant_grams None The weight of the product variant in grams.
inventory_item_id None The unique identifier for the inventory item, which is used in the Inventory API to query for inventory information.
variant_inventory_management None The fulfillment service that tracks the number of items in stock for the product variant.
variant_inventory_policy None Whether customers are allowed to place an order for the product variant when it's out of stock.
variant_inventory_quantity None An aggregate of inventory across all locations. To adjust inventory at a specific location, use the InventoryLevel resource.
variant_option_1 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
variant_option_2 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
variant_option_3 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
variant_position None The order of the product variant in the list of product variants. The first position in the list is 1. The position of variants is indicated by the order in which they are listed.
variant_price None The price of the product variant.
variant_sku None A unique identifier for the product variant in the shop. Required in order to connect to a FulfillmentService.
variant_is_taxable None Whether a tax is charged when the product variant is sold.
variant_tax_code None This parameter applies only to the stores that have the Avalara AvaTax app installed. Specifies the Avalara tax code for the product variant.
variant_title None The title of the product variant. The title field is a concatenation of the option1, option2, and option3 fields. You can only update title indirectly using the option fields.
variant_updated_at None The date and time when the product variant was last modified. Gets returned in ISO 8601 format.
variant_weight None The weight of the product variant in the unit system specified with weight_unit.
variant_weight_unit None The unit of measurement that applies to the product variant's weight. If you don't specify a value for weight_unit, then the shop's default unit of measurement is applied. Valid values: g, kg, oz, and lb.
refunded_subtotal None Subtotal amount of the refund applied to the order line in shop currency.
subtotal_net_refunds None Subtotal of the order line with refunds subtracted in shop currency.
image_id None Image id of the product variant associated with the order line.
source_relation None The schema or database this record came from, if you are unioning multiple connectors. Null if not.
restock_types None List of how this refund line item affects inventory levels.
order_line_tax None Total taxes for the line item.
index None The index associated with the order.
pre_tax_price None The total pre tax price of the order.
tax_code None This parameter applies only to the stores that have the Avalara AvaTax app installed. Specifies the Avalara tax code for the product variant.
pre_tax_price_set None The pre tax price of the line item in shop currency and presentment currency.
price_set None The price of the line item in shop and presentment currencies.
total_discount_set None The total amount allocated to the line item in the presentment currency.
properties None Line item properties.
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line order_line_id source_relation 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_line_id order_lines_unique_key source_relation 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1 57. model.shopify_source.stg_shopify__order_line:f1->20. model.shopify.shopify__order_lines:f2 57. model.shopify_source.stg_shopify__order_line:f1->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[order_line_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as a key to join with other tables (refunds_aggregated, tax_lines_aggregated)
    • Featurization Used to create a unique key for the order line
    • Output Columns:
      • order_line_id: Directly copied to the output
      • order_lines_unique_key: Part of the MD5 hash to create a unique key
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used in joins with refunds_aggregated, product_variants, and tax_lines_aggregated
    • Other Used in creating the unique key 'order_lines_unique_key'
    • Output Columns:
      • source_relation: Directly copied
      • order_lines_unique_key: Used in MD5 hash calculation
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line _fivetran_synced 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines _fivetran_synced 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line fulfillable_quantity 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines fulfillable_quantity 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[fulfillable_quantity]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • fulfillable_quantity: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line fulfillment_status 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines fulfillment_status 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[fulfillment_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • fulfillment_status: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line is_gift_card 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines is_gift_card 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[is_gift_card]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_gift_card: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line grams 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines grams 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[grams]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • grams: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line order_line_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_line_id order_lines_unique_key 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[order_line_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as a key to join with other tables (refunds_aggregated, tax_lines_aggregated)
    • Featurization Used to create a unique key for the order line
    • Output Columns:
      • order_line_id: Directly copied to the output
      • order_lines_unique_key: Part of the MD5 hash to create a unique key
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line name 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines name 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • name: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line order_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_id 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[order_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • order_id: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines price 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[price]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • price: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line product_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines product_id 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[product_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • product_id: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line quantity 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines quantity quantity_net_refunds 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[quantity]
    • Direct This column is directly copied to the output
    • Other It's used in calculations for 'quantity_net_refunds'
    • Output Columns:
      • quantity: Directly copied
      • quantity_net_refunds: Used in calculation (quantity - COALESCE(refunds_aggregated.quantity, 0))
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line is_shipping_required 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines is_shipping_required 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[is_shipping_required]
    • Direct This column is directly copied to the output
    • Output Columns:
      • is_shipping_required: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line sku 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines sku 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[sku]
    • Direct This column is directly copied to the output
    • Output Columns:
      • sku: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line is_taxable 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines is_taxable 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[is_taxable]
    • Direct This column is directly copied to the output
    • Output Columns:
      • is_taxable: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line title 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines title 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[title]
    • Direct This column is directly copied to the output
    • Output Columns:
      • title: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line total_discount 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines total_discount 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[total_discount]
    • Direct This column is directly copied to the output
    • Output Columns:
      • total_discount: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line variant_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_id 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[variant_id]
    • Direct This column is directly copied to the output
    • Integration Used to join with product_variants table
    • Output Columns:
      • variant_id: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line vendor 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines vendor 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[vendor]
    • Direct This column is directly copied to the output
    • Output Columns:
      • vendor: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line quantity 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines quantity quantity_net_refunds 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[quantity]
    • Direct This column is directly copied to the output
    • Other It's used in calculations for 'quantity_net_refunds'
    • Output Columns:
      • quantity: Directly copied
      • quantity_net_refunds: Used in calculation (quantity - COALESCE(refunds_aggregated.quantity, 0))
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant barcode 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_barcode 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[barcode]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_barcode: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant compare_at_price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_compare_at_price 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[compare_at_price]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_compare_at_price: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant created_timestamp 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_created_at 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_created_at: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant fulfillment_service 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_fulfillment_service 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[fulfillment_service]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_fulfillment_service: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant grams 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_grams 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[grams]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_grams: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_item_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines inventory_item_id 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_item_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • inventory_item_id: Directly copied to this output column
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line variant_inventory_management 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_inventory_management 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[variant_inventory_management]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_inventory_management: Directly copied
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_policy 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_inventory_policy 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_policy]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_inventory_policy: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_quantity 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_inventory_quantity 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_quantity]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_inventory_quantity: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_1 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_option_1 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_1]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_option_1: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_2 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_option_2 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_2]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_option_2: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_3 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_option_3 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_3]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_option_3: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant position 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_position 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[position]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_position: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_price 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[price]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_price: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant sku 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_sku 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[sku]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_sku: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant is_taxable 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_is_taxable 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[is_taxable]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_is_taxable: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant tax_code 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_tax_code 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[tax_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_tax_code: Directly mapped
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line variant_title 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_title 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant title 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[variant_title]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_title: Directly copied
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_title: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant updated_timestamp 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_updated_at 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[updated_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_updated_at: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant weight 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_weight 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant weight_unit 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_weight_unit 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight_unit]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight_unit: Directly copied to this output column
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line pre_tax_price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines pre_tax_price subtotal_net_refunds 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[pre_tax_price]
    • Direct The column is directly used in calculations
    • Other Used in calculating 'subtotal_net_refunds'
    • Output Columns:
      • pre_tax_price: Directly copied
      • subtotal_net_refunds: Used in calculation (pre_tax_price - COALESCE(refunds_aggregated.subtotal, 0))
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant image_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines image_id 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[image_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • image_id: Directly copied to this output column
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line source_relation 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_lines_unique_key source_relation 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used in joins with refunds_aggregated, product_variants, and tax_lines_aggregated
    • Other Used in creating the unique key 'order_lines_unique_key'
    • Output Columns:
      • source_relation: Directly copied
      • order_lines_unique_key: Used in MD5 hash calculation
Column Lineage
%3 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_line_tax 86. model.shopify_source.stg_shopify__tax_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 86. model.shopify_source.stg_shopify__tax_line[price]
    • Aggregation This column is summed up in the tax_lines_aggregated CTE
    • Output Columns:
      • order_line_tax: The sum of this column becomes the order_line_tax in the final output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line index 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines index 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[index]
    • Direct This column is directly copied to the output
    • Output Columns:
      • index: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line pre_tax_price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines pre_tax_price subtotal_net_refunds 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[pre_tax_price]
    • Direct The column is directly used in calculations
    • Other Used in calculating 'subtotal_net_refunds'
    • Output Columns:
      • pre_tax_price: Directly copied
      • subtotal_net_refunds: Used in calculation (pre_tax_price - COALESCE(refunds_aggregated.subtotal, 0))
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line tax_code 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines tax_code 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[tax_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • tax_code: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line pre_tax_price_set 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines pre_tax_price_set 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[pre_tax_price_set]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • pre_tax_price_set: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line price_set 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines price_set 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[price_set]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • price_set: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line total_discount_set 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines total_discount_set 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[total_discount_set]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • total_discount_set: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line properties 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines properties 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[properties]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • properties: Directly copied
21. model.shopify.shopify__orders

This SQL query combines and transforms data from multiple Shopify-related tables to create a comprehensive view of orders. It joins order information with related data such as refunds, adjustments, discounts, tags, and fulfillments. The query calculates various aggregates and derived fields, including adjusted totals, discount amounts, and shipping information. It also determines whether each order is from a new or repeat customer based on the order sequence for each customer.

IntegrationAggregationFeaturizationCleaning
SQL Query
WITH __dbt__cte__shopify__orders__order_refunds AS (
  WITH refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__refund
  ), order_line_refunds AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_refund
  ), refund_join AS (
    SELECT
      refunds.refund_id,
      refunds.created_at,
      refunds.order_id,
      refunds.user_id,
      refunds.source_relation,
      order_line_refunds.order_line_refund_id,
      order_line_refunds.order_line_id,
      order_line_refunds.restock_type,
      order_line_refunds.quantity,
      order_line_refunds.subtotal,
      order_line_refunds.total_tax
    FROM refunds
    LEFT JOIN order_line_refunds
      ON refunds.refund_id = order_line_refunds.refund_id
      AND refunds.source_relation = order_line_refunds.source_relation
  )
  SELECT
    *
  FROM refund_join
), orders AS (
  SELECT
    *,
    MD5(
      CAST(COALESCE(CAST(source_relation AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(order_id AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS orders_unique_key
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order
), order_lines AS (
  SELECT
    *
  FROM TEST.PUBLIC_shopify.shopify__orders__order_line_aggregates
), order_adjustments AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_adjustment
), order_adjustments_aggregates AS (
  SELECT
    order_id,
    source_relation,
    SUM(amount) AS order_adjustment_amount,
    SUM(tax_amount) AS order_adjustment_tax_amount
  FROM order_adjustments
  GROUP BY
    1,
    2
), refunds AS (
  SELECT
    *
  FROM __dbt__cte__shopify__orders__order_refunds
), refund_aggregates AS (
  SELECT
    order_id,
    source_relation,
    SUM(subtotal) AS refund_subtotal,
    SUM(total_tax) AS refund_total_tax
  FROM refunds
  GROUP BY
    1,
    2
), order_discount_code AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_discount_code
), discount_aggregates AS (
  SELECT
    order_id,
    source_relation,
    SUM(CASE WHEN type = 'shipping' THEN amount ELSE 0 END) AS shipping_discount_amount,
    SUM(CASE WHEN type = 'percentage' THEN amount ELSE 0 END) AS percentage_calc_discount_amount,
    SUM(CASE WHEN type = 'fixed_amount' THEN amount ELSE 0 END) AS fixed_amount_discount_amount,
    COUNT(DISTINCT code) AS count_discount_codes_applied
  FROM order_discount_code
  GROUP BY
    1,
    2
), order_tag AS (
  SELECT
    order_id,
    source_relation,
    LISTAGG(DISTINCT CAST(value AS TEXT), ', ') AS order_tags
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_tag
  GROUP BY
    1,
    2
), order_url_tag AS (
  SELECT
    order_id,
    source_relation,
    LISTAGG(DISTINCT CAST(value AS TEXT), ', ') AS order_url_tags
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_url_tag
  GROUP BY
    1,
    2
), fulfillments AS (
  SELECT
    order_id,
    source_relation,
    COUNT(fulfillment_id) AS number_of_fulfillments,
    LISTAGG(DISTINCT CAST(service AS TEXT), ', ') AS fulfillment_services,
    LISTAGG(DISTINCT CAST(tracking_company AS TEXT), ', ') AS tracking_companies,
    LISTAGG(DISTINCT CAST(tracking_number AS TEXT), ', ') AS tracking_numbers
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__fulfillment
  GROUP BY
    1,
    2
), joined AS (
  SELECT
    orders.*,
    COALESCE(CAST(PARSE_JSON(total_shipping_price_set)['shop_money']['amount'] AS FLOAT), 0) AS shipping_cost,
    order_adjustments_aggregates.order_adjustment_amount,
    order_adjustments_aggregates.order_adjustment_tax_amount,
    refund_aggregates.refund_subtotal,
    refund_aggregates.refund_total_tax,
    (
      orders.total_price + COALESCE(order_adjustments_aggregates.order_adjustment_amount, 0) + COALESCE(order_adjustments_aggregates.order_adjustment_tax_amount, 0) - COALESCE(refund_aggregates.refund_subtotal, 0) - COALESCE(refund_aggregates.refund_total_tax, 0)
    ) AS order_adjusted_total,
    order_lines.line_item_count,
    COALESCE(discount_aggregates.shipping_discount_amount, 0) AS shipping_discount_amount,
    COALESCE(discount_aggregates.percentage_calc_discount_amount, 0) AS percentage_calc_discount_amount,
    COALESCE(discount_aggregates.fixed_amount_discount_amount, 0) AS fixed_amount_discount_amount,
    COALESCE(discount_aggregates.count_discount_codes_applied, 0) AS count_discount_codes_applied,
    COALESCE(order_lines.order_total_shipping_tax, 0) AS order_total_shipping_tax,
    order_tag.order_tags,
    order_url_tag.order_url_tags,
    fulfillments.number_of_fulfillments,
    fulfillments.fulfillment_services,
    fulfillments.tracking_companies,
    fulfillments.tracking_numbers
  FROM orders
  LEFT JOIN order_lines
    ON orders.order_id = order_lines.order_id
    AND orders.source_relation = order_lines.source_relation
  LEFT JOIN refund_aggregates
    ON orders.order_id = refund_aggregates.order_id
    AND orders.source_relation = refund_aggregates.source_relation
  LEFT JOIN order_adjustments_aggregates
    ON orders.order_id = order_adjustments_aggregates.order_id
    AND orders.source_relation = order_adjustments_aggregates.source_relation
  LEFT JOIN discount_aggregates
    ON orders.order_id = discount_aggregates.order_id
    AND orders.source_relation = discount_aggregates.source_relation
  LEFT JOIN order_tag
    ON orders.order_id = order_tag.order_id
    AND orders.source_relation = order_tag.source_relation
  LEFT JOIN order_url_tag
    ON orders.order_id = order_url_tag.order_id
    AND orders.source_relation = order_url_tag.source_relation
  LEFT JOIN fulfillments
    ON orders.order_id = fulfillments.order_id
    AND orders.source_relation = fulfillments.source_relation
), windows AS (
  SELECT
    *,
    ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY created_timestamp) AS customer_order_seq_number
  FROM joined
), new_vs_repeat AS (
  SELECT
    *,
    CASE WHEN customer_order_seq_number = 1 THEN 'new' ELSE 'repeat' END AS new_vs_repeat
  FROM windows
)
SELECT
  *
FROM new_vs_repeat
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders orders_unique_key _fivetran_synced app_id billing_address_address_1 billing_address_address_2 billing_address_city billing_address_company billing_address_country billing_address_country_code billing_address_first_name billing_address_last_name billing_address_latitude billing_address_longitude billing_address_name billing_address_phone billing_address_province billing_address_province_code billing_address_zip browser_ip has_buyer_accepted_marketing cancel_reason cancelled_timestamp cart_token closed_timestamp created_timestamp currency customer_id email financial_status fulfillment_status order_id landing_site_base_url location_id name note number order_number processed_timestamp referring_site shipping_address_address_1 shipping_address_address_2 shipping_address_city shipping_address_company shipping_address_country shipping_address_country_code shipping_address_first_name shipping_address_last_name shipping_address_latitude shipping_address_longitude shipping_address_name shipping_address_phone shipping_address_province shipping_address_province_code shipping_address_zip source_name source_relation subtotal_price has_taxes_included is_test_order token total_discounts total_line_items_price total_price total_tax total_weight updated_timestamp user_id line_item_count customer_order_seq_number new_vs_repeat shipping_cost order_adjustment_amount order_adjustment_tax_amount refund_subtotal refund_total_tax order_adjusted_total checkout_token total_shipping_price_set order_total_shipping_tax order_tags order_url_tags number_of_fulfillments fulfillment_services tracking_companies tracking_numbers total_tip_received checkout_id client_details_user_agent customer_locale order_status_url presentment_currency is_deleted total_discounts_set total_line_items_price_set total_price_set total_tax_set is_confirmed shipping_discount_amount percentage_calc_discount_amount fixed_amount_discount_amount count_discount_codes_applied 22. model.shopify.shopify__orders__order_line_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 23. model.shopify.shopify__orders__order_refunds 23. model.shopify.shopify__orders__order_refunds 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment fulfillment_id service tracking_company tracking_number 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f81 42. model.shopify_source.stg_shopify__fulfillment:f1->21. model.shopify.shopify__orders:f82 42. model.shopify_source.stg_shopify__fulfillment:f2->21. model.shopify.shopify__orders:f83 42. model.shopify_source.stg_shopify__fulfillment:f3->21. model.shopify.shopify__orders:f84 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order _fivetran_synced app_id checkout_id order_status_url billing_address_address_1 billing_address_address_2 billing_address_city billing_address_company billing_address_country billing_address_country_code billing_address_first_name billing_address_last_name billing_address_latitude billing_address_longitude billing_address_name billing_address_phone billing_address_province billing_address_province_code billing_address_zip browser_ip has_buyer_accepted_marketing cancel_reason cancelled_timestamp cart_token closed_timestamp created_timestamp currency customer_id email financial_status fulfillment_status order_id landing_site_base_url location_id name note number order_number processed_timestamp referring_site shipping_address_address_1 shipping_address_address_2 shipping_address_city shipping_address_company shipping_address_country shipping_address_country_code shipping_address_first_name shipping_address_last_name shipping_address_latitude shipping_address_longitude shipping_address_name shipping_address_phone shipping_address_province shipping_address_province_code shipping_address_zip source_name subtotal_price has_taxes_included is_test_order token total_discounts total_line_items_price total_price total_tax total_weight updated_timestamp user_id total_shipping_price_set checkout_token customer_locale is_deleted total_tip_received client_details_user_agent total_tax_set total_discounts_set presentment_currency source_relation total_line_items_price_set total_price_set is_confirmed 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f1->21. model.shopify.shopify__orders:f2 52. model.shopify_source.stg_shopify__order:f2->21. model.shopify.shopify__orders:f86 52. model.shopify_source.stg_shopify__order:f3->21. model.shopify.shopify__orders:f89 52. model.shopify_source.stg_shopify__order:f4->21. model.shopify.shopify__orders:f3 52. model.shopify_source.stg_shopify__order:f5->21. model.shopify.shopify__orders:f4 52. model.shopify_source.stg_shopify__order:f6->21. model.shopify.shopify__orders:f5 52. model.shopify_source.stg_shopify__order:f7->21. model.shopify.shopify__orders:f6 52. model.shopify_source.stg_shopify__order:f8->21. model.shopify.shopify__orders:f7 52. model.shopify_source.stg_shopify__order:f9->21. model.shopify.shopify__orders:f8 52. model.shopify_source.stg_shopify__order:f10->21. model.shopify.shopify__orders:f9 52. model.shopify_source.stg_shopify__order:f11->21. model.shopify.shopify__orders:f10 52. model.shopify_source.stg_shopify__order:f12->21. model.shopify.shopify__orders:f11 52. model.shopify_source.stg_shopify__order:f13->21. model.shopify.shopify__orders:f12 52. model.shopify_source.stg_shopify__order:f14->21. model.shopify.shopify__orders:f13 52. model.shopify_source.stg_shopify__order:f15->21. model.shopify.shopify__orders:f14 52. model.shopify_source.stg_shopify__order:f16->21. model.shopify.shopify__orders:f15 52. model.shopify_source.stg_shopify__order:f17->21. model.shopify.shopify__orders:f16 52. model.shopify_source.stg_shopify__order:f18->21. model.shopify.shopify__orders:f17 52. model.shopify_source.stg_shopify__order:f19->21. model.shopify.shopify__orders:f18 52. model.shopify_source.stg_shopify__order:f20->21. model.shopify.shopify__orders:f19 52. model.shopify_source.stg_shopify__order:f21->21. model.shopify.shopify__orders:f20 52. model.shopify_source.stg_shopify__order:f22->21. model.shopify.shopify__orders:f21 52. model.shopify_source.stg_shopify__order:f23->21. model.shopify.shopify__orders:f22 52. model.shopify_source.stg_shopify__order:f24->21. model.shopify.shopify__orders:f23 52. model.shopify_source.stg_shopify__order:f25->21. model.shopify.shopify__orders:f24 52. model.shopify_source.stg_shopify__order:f25->21. model.shopify.shopify__orders:f68 52. model.shopify_source.stg_shopify__order:f26->21. model.shopify.shopify__orders:f25 52. model.shopify_source.stg_shopify__order:f27->21. model.shopify.shopify__orders:f26 52. model.shopify_source.stg_shopify__order:f27->21. model.shopify.shopify__orders:f68 52. model.shopify_source.stg_shopify__order:f27->21. model.shopify.shopify__orders:f69 52. model.shopify_source.stg_shopify__order:f28->21. model.shopify.shopify__orders:f27 52. model.shopify_source.stg_shopify__order:f29->21. model.shopify.shopify__orders:f28 52. model.shopify_source.stg_shopify__order:f30->21. model.shopify.shopify__orders:f29 52. model.shopify_source.stg_shopify__order:f31->21. model.shopify.shopify__orders:f30 52. model.shopify_source.stg_shopify__order:f31->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f32->21. model.shopify.shopify__orders:f31 52. model.shopify_source.stg_shopify__order:f33->21. model.shopify.shopify__orders:f32 52. model.shopify_source.stg_shopify__order:f34->21. model.shopify.shopify__orders:f33 52. model.shopify_source.stg_shopify__order:f35->21. model.shopify.shopify__orders:f34 52. model.shopify_source.stg_shopify__order:f36->21. model.shopify.shopify__orders:f35 52. model.shopify_source.stg_shopify__order:f37->21. model.shopify.shopify__orders:f36 52. model.shopify_source.stg_shopify__order:f38->21. model.shopify.shopify__orders:f37 52. model.shopify_source.stg_shopify__order:f39->21. model.shopify.shopify__orders:f38 52. model.shopify_source.stg_shopify__order:f40->21. model.shopify.shopify__orders:f39 52. model.shopify_source.stg_shopify__order:f41->21. model.shopify.shopify__orders:f40 52. model.shopify_source.stg_shopify__order:f42->21. model.shopify.shopify__orders:f41 52. model.shopify_source.stg_shopify__order:f43->21. model.shopify.shopify__orders:f42 52. model.shopify_source.stg_shopify__order:f44->21. model.shopify.shopify__orders:f43 52. model.shopify_source.stg_shopify__order:f45->21. model.shopify.shopify__orders:f44 52. model.shopify_source.stg_shopify__order:f46->21. model.shopify.shopify__orders:f45 52. model.shopify_source.stg_shopify__order:f47->21. model.shopify.shopify__orders:f46 52. model.shopify_source.stg_shopify__order:f48->21. model.shopify.shopify__orders:f47 52. model.shopify_source.stg_shopify__order:f49->21. model.shopify.shopify__orders:f48 52. model.shopify_source.stg_shopify__order:f50->21. model.shopify.shopify__orders:f49 52. model.shopify_source.stg_shopify__order:f51->21. model.shopify.shopify__orders:f50 52. model.shopify_source.stg_shopify__order:f52->21. model.shopify.shopify__orders:f51 52. model.shopify_source.stg_shopify__order:f53->21. model.shopify.shopify__orders:f52 52. model.shopify_source.stg_shopify__order:f54->21. model.shopify.shopify__orders:f53 52. model.shopify_source.stg_shopify__order:f55->21. model.shopify.shopify__orders:f54 52. model.shopify_source.stg_shopify__order:f56->21. model.shopify.shopify__orders:f56 52. model.shopify_source.stg_shopify__order:f57->21. model.shopify.shopify__orders:f57 52. model.shopify_source.stg_shopify__order:f58->21. model.shopify.shopify__orders:f58 52. model.shopify_source.stg_shopify__order:f59->21. model.shopify.shopify__orders:f59 52. model.shopify_source.stg_shopify__order:f60->21. model.shopify.shopify__orders:f60 52. model.shopify_source.stg_shopify__order:f61->21. model.shopify.shopify__orders:f61 52. model.shopify_source.stg_shopify__order:f62->21. model.shopify.shopify__orders:f62 52. model.shopify_source.stg_shopify__order:f62->21. model.shopify.shopify__orders:f75 52. model.shopify_source.stg_shopify__order:f63->21. model.shopify.shopify__orders:f63 52. model.shopify_source.stg_shopify__order:f64->21. model.shopify.shopify__orders:f64 52. model.shopify_source.stg_shopify__order:f65->21. model.shopify.shopify__orders:f65 52. model.shopify_source.stg_shopify__order:f66->21. model.shopify.shopify__orders:f66 52. model.shopify_source.stg_shopify__order:f67->21. model.shopify.shopify__orders:f70 52. model.shopify_source.stg_shopify__order:f68->21. model.shopify.shopify__orders:f76 52. model.shopify_source.stg_shopify__order:f69->21. model.shopify.shopify__orders:f88 52. model.shopify_source.stg_shopify__order:f70->21. model.shopify.shopify__orders:f91 52. model.shopify_source.stg_shopify__order:f71->21. model.shopify.shopify__orders:f85 52. model.shopify_source.stg_shopify__order:f72->21. model.shopify.shopify__orders:f87 52. model.shopify_source.stg_shopify__order:f73->21. model.shopify.shopify__orders:f95 52. model.shopify_source.stg_shopify__order:f74->21. model.shopify.shopify__orders:f92 52. model.shopify_source.stg_shopify__order:f75->21. model.shopify.shopify__orders:f90 52. model.shopify_source.stg_shopify__order:f76->21. model.shopify.shopify__orders:f55 52. model.shopify_source.stg_shopify__order:f76->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f77->21. model.shopify.shopify__orders:f93 52. model.shopify_source.stg_shopify__order:f78->21. model.shopify.shopify__orders:f94 52. model.shopify_source.stg_shopify__order:f79->21. model.shopify.shopify__orders:f96 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment amount tax_amount source_relation 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f71 53. model.shopify_source.stg_shopify__order_adjustment:f1->21. model.shopify.shopify__orders:f72 53. model.shopify_source.stg_shopify__order_adjustment:f2->21. model.shopify.shopify__orders:f55 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code amount code 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f97 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f98 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f99 55. model.shopify_source.stg_shopify__order_discount_code:f1->21. model.shopify.shopify__orders:f100 67. model.shopify_source.stg_shopify__order_tag 67. model.shopify_source.stg_shopify__order_tag value 67. model.shopify_source.stg_shopify__order_tag:f0->21. model.shopify.shopify__orders:f79 70. model.shopify_source.stg_shopify__order_url_tag 70. model.shopify_source.stg_shopify__order_url_tag value 70. model.shopify_source.stg_shopify__order_url_tag:f0->21. model.shopify.shopify__orders:f80
Name Type Comment
orders_unique_key None Unique key representing an order. Hashed on 'order_id' and 'source_relation'.
_fivetran_synced None The time when a record was last updated by Fivetran.
app_id None The ID of the app that created the order.
billing_address_address_1 None The street address of the billing address.
billing_address_address_2 None An optional additional field for the street address of the billing address.
billing_address_city None The city, town, or village of the billing address.
billing_address_company None The company of the person associated with the billing address.
billing_address_country None The name of the country of the billing address.
billing_address_country_code None The two-letter code (ISO 3166-1 format) for the country of the billing address.
billing_address_first_name None The first name of the person associated with the payment method.
billing_address_last_name None The last name of the person associated with the payment method.
billing_address_latitude None The latitude of the billing address.
billing_address_longitude None The longitude of the billing address.
billing_address_name None The full name of the person associated with the payment method.
billing_address_phone None The phone number at the billing address.
billing_address_province None The name of the region (province, state, prefecture, …) of the billing address.
billing_address_province_code None The two-letter abbreviation of the region of the billing address.
billing_address_zip None The postal code (zip, postcode, Eircode, …) of the billing address.
browser_ip None The IP address of the browser used by the customer when they placed the order.
has_buyer_accepted_marketing None Whether the customer consented to receive email updates from the shop.
cancel_reason None The reason why the order was canceled.
cancelled_timestamp None The date and time when the order was canceled.
cart_token None The ID of the cart that's associated with the order.
closed_timestamp None The date and time when the order was closed (archived).
created_timestamp None The autogenerated date and time when the order was created in Shopify.
currency None The three-letter code for the shop currency.
customer_id None The ID of the order's customer.
email None The customer's email address.
financial_status None The status of payments associated with the order. Can only be set when the order is created
fulfillment_status None The order's status in terms of fulfilled line items.
order_id None The ID of the order, used for API purposes. This is different from the order_number property, which is the ID used by the shop owner and customer.
landing_site_base_url None The URL for the page where the buyer landed when they entered the shop.
location_id None The ID of the physical location where the order was processed.
name None The order name, generated by combining the order_number property with the order prefix and suffix that are set in the merchant's general settings.
note None An optional note that a shop owner can attach to the order.
number None The order's position in the shop's count of orders. Numbers are sequential and start at 1.
order_number None The order 's position in the shop's count of orders starting at 1001. Order numbers are sequential and start at 1001.
processed_timestamp None The date and time when an order was processed. This value is the date that appears on your orders and that's used in the analytic reports.
referring_site None The website where the customer clicked a link to the shop.
shipping_address_address_1 None The street address of the shipping address.
shipping_address_address_2 None An optional additional field for the street address of the shipping address.
shipping_address_city None The city, town, or village of the shipping address.
shipping_address_company None The company of the person associated with the shipping address.
shipping_address_country None The name of the country of the shipping address.
shipping_address_country_code None The two-letter code (ISO 3166-1 format) for the country of the shipping address.
shipping_address_first_name None The first name of the person associated with the shipping address.
shipping_address_last_name None The last name of the person associated with the shipping address.
shipping_address_latitude None The latitude of the shipping address.
shipping_address_longitude None The longitude of the shipping address.
shipping_address_name None The full name of the person associated with the payment method.
shipping_address_phone None The phone number at the shipping address.
shipping_address_province None The name of the region (province, state, prefecture, …) of the shipping address.
shipping_address_province_code None The two-letter abbreviation of the region of the shipping address.
shipping_address_zip None The postal code (zip, postcode, Eircode, …) of the shipping address.
source_name None Where the order originated. Can be set only during order creation, and is not writeable afterwards.
source_relation None The ID of the order placed on the originating platform. This value doesn't correspond to the Shopify ID that's generated from a completed draft.
subtotal_price None The price of the order in the shop currency after discounts but before shipping, taxes, and tips.
has_taxes_included None Whether taxes are included in the order subtotal.
is_test_order None Whether this is a test order.
token None A unique token for the order.
total_discounts None The total discounts applied to the price of the order in the shop currency.
total_line_items_price None The sum of all line item prices in the shop currency.
total_price None The sum of all line item prices, discounts, shipping, taxes, and tips in the shop currency. Must be positive.
total_tax None The sum of all the taxes applied to the order in th shop currency. Must be positive.
total_weight None The sum of all line item weights in grams.
updated_timestamp None The date and time (ISO 8601 format) when the order was last modified.
user_id None The ID of the user logged into Shopify POS who processed the order, if applicable.
line_item_count None Number of line items included in the order.
customer_order_seq_number None The sequential number of the order as it relates to the customer
new_vs_repeat None Whether the order was a new or repeat order for the customer.
shipping_cost None The shipping cost of the order.
order_adjustment_amount None Total adjustment amount applied to the order in shop currency.
order_adjustment_tax_amount None Total tax applied to the adjustment on the order in shop currency.
refund_subtotal None Total refund amount applied to the order in shop currency.
refund_total_tax None Total tax applied to the refund on the order in shop currency.
order_adjusted_total None Order total adjusted for refunds and other adjustments. The calculation used for this field is as follows: total price listed on the original order (including shipping costs and discounts) + adjustments + adjustments tax - total refunds - refunds tax The order_adjusted_total will equate to the total sales - refunds listed within the transactions table for the order (after currency exchange).
checkout_token None The checkout token applied to the order.
total_shipping_price_set None The total shipping price set to the order.
order_total_shipping_tax None Total shipping tax attributed to the order.
order_tags None List of tags associated with the order.
order_url_tags None List of url tags associated with the order.
number_of_fulfillments None Total fulfillments for the order.
fulfillment_services None List of fulfillment services for the order.
tracking_companies None List of tracking companies for the order.
tracking_numbers None List of tracking numbers for the order.
total_tip_received None The sum of all the tips in the order in the shop currency.
checkout_id None The ID for the checkout.
client_details_user_agent None Details of the browsing client, including software and operating versions.
customer_locale None The two or three-letter language code, optionally followed by a region modifier. Example values - en, en-CA.
order_status_url None The URL pointing to the order status web page, if applicable.
presentment_currency None The three-letter code (ISO 4217 format) of the currency that the customer used at checkout. For the shop's default currency, see `currency`.
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
total_discounts_set None The total discounts applied to the price of the order in shop and presentment currencies.
total_line_items_price_set None The total of all line item prices in shop and presentment currencies.
total_price_set None The total price of the order in shop and presentment currencies.
total_tax_set None The total tax applied to the order in shop and presentment currencies.
is_confirmed None Whether the order is confirmed.
shipping_discount_amount None The total amount of discount (in shop currency) allocated toward shipping.
percentage_calc_discount_amount None The total amount of discount (in shop currency) allocated via a percentage-based discount
fixed_amount_discount_amount None The total amount of discount (in shop currency) allocated via a fixed-amount discount
count_discount_codes_applied None Distinct discount codes applied on the order
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id source_relation 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key source_relation 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f1->21. model.shopify.shopify__orders:f2 52. model.shopify_source.stg_shopify__order:f1->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for orders
    • Output Columns:
      • source_relation: Directly copied
      • orders_unique_key: Part of the MD5 hash to create a unique key
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order _fivetran_synced 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders _fivetran_synced 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order app_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders app_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[app_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_id: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_address_1 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_address_1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_address_1]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_address_1: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_address_2 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_address_2 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_address_2]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_address_2: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_city 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_city 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_city]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_city: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_company 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_company 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_company]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_company: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_country 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_country 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_country]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_country: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_country_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_country_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_country_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_country_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_first_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_first_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_first_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_first_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_last_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_last_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_last_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_last_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_latitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_latitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_latitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_latitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_longitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_longitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_longitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_longitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_phone 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_phone 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_phone]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_phone: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_province 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_province 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_province]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_province: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_province_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_province_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_province_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_province_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_zip 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_zip 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_zip]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_zip: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order browser_ip 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders browser_ip 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[browser_ip]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser_ip: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order has_buyer_accepted_marketing 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders has_buyer_accepted_marketing 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[has_buyer_accepted_marketing]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • has_buyer_accepted_marketing: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order cancel_reason 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders cancel_reason 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[cancel_reason]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cancel_reason: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order cancelled_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders cancelled_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[cancelled_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cancelled_timestamp: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order cart_token 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders cart_token 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[cart_token]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cart_token: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order closed_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders closed_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[closed_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • closed_timestamp: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order created_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders created_timestamp customer_order_seq_number 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number
    • Output Columns:
      • created_timestamp: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order currency 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders currency 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[currency]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • currency: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order customer_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_id customer_order_seq_number new_vs_repeat 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f2 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts customer_id 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_id]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number and new vs repeat customer status
    • Output Columns:
      • customer_id: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
      • new_vs_repeat: Used to determine if the order is from a new or repeat customer
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[customer_id]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in window functions to partition data
    • Output Columns:
      • customer_id: Directly copied to output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order email 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders email 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts email 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[email]
    • Integration Used to join orders with customer_calendar
    • Deduplication Part of the PARTITION BY clause in window functions
    • Output Columns:
      • email: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order financial_status 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders financial_status 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[financial_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • financial_status: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order fulfillment_status 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fulfillment_status 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[fulfillment_status]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • fulfillment_status: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation The column is counted distinctly in the GROUP BY clause
    • Output Columns:
      • order_count_in_month: Distinct count for each month
      • order_count_lifetime: Cumulative distinct count using window function
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation Used in COUNT(DISTINCT orders.order_id) to calculate order_count_in_month
    • Output Columns:
      • order_count_in_month: Aggregated as count of distinct order_id
      • order_count_lifetime: Indirectly mapped through window function on order_count_in_month
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order landing_site_base_url 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders landing_site_base_url 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[landing_site_base_url]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • landing_site_base_url: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order location_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders location_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[location_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • location_id: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[name]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • name: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order note 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders note 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[note]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • note: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order number 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders number 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[number]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • number: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_number 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_number 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_number]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • order_number: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order processed_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders processed_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[processed_timestamp]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • processed_timestamp: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order referring_site 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders referring_site 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[referring_site]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • referring_site: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_address_1 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_address_1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_address_1]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_address_1: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_address_2 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_address_2 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_address_2]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_address_2: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_city 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_city 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_city]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_city: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_company 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_company 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_company]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_company: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_country 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_country 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_country]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_country: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_country_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_country_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_country_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_country_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_first_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_first_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_first_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_first_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_last_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_last_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_last_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_last_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_latitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_latitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_latitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_latitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_longitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_longitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_longitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_longitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_phone 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_phone 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_phone]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_phone: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_province 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_province 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_province]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_province: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_province_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_province_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_province_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_province_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_zip 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_zip 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_zip]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_zip: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order source_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders source_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • source_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order source_relation 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders orders_unique_key source_relation 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts source_relation 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 21. model.shopify.shopify__orders:f1->12. model.shopify.shopify__customer_cohorts:f0 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment source_relation 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for orders
    • Output Columns:
      • source_relation: Directly copied
      • orders_unique_key: Part of the MD5 hash to create a unique key
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[source_relation]
    • Integration This column is used as a key to join the order_adjustments table with other tables in the query, ensuring that adjustments are correctly associated with their corresponding orders.
    • Aggregation The column is used in the GROUP BY clause of the order_adjustments_aggregates CTE, allowing for aggregation of adjustment amounts per order and source.
    • Output Columns:
      • source_relation: This column is directly copied to the output, maintaining the information about the source of each order and its associated data.
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in creating the customer_cohort_id
    • Output Columns:
      • source_relation: Directly copied to output
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join the orders table with the customer_calendar CTE
    • Direct Directly copied to the output
    • Output Columns:
      • source_relation: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order subtotal_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders subtotal_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[subtotal_price]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • subtotal_price: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order has_taxes_included 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders has_taxes_included 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[has_taxes_included]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • has_taxes_included: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order is_test_order 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders is_test_order 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[is_test_order]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_test_order: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order token 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders token 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[token]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • token: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_discounts 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_discounts 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_discounts]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_discounts: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_line_items_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_line_items_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_line_items_price]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_line_items_price: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[total_price]
    • Aggregation This column is summed to calculate the total price in a month and lifetime
    • Output Columns:
      • total_price_in_month: Summed for each month
      • total_price_lifetime: Cumulative sum over time
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_tax 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_tax 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_tax]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_tax: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_weight 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_weight 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_weight]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_weight: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order updated_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders updated_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[updated_timestamp]
    • Direct This column is directly used in the output
    • Output Columns:
      • updated_timestamp: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order user_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders user_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[user_id]
    • Direct This column is directly used in the output
    • Output Columns:
      • user_id: Directly mapped to the output column
Column Lineage
%3 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders line_item_count 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts line_item_count_in_month line_item_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts line_item_count_in_month line_item_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[line_item_count]
    • Aggregation The column is summed up in the GROUP BY clause
    • Output Columns:
      • line_item_count_in_month: Aggregated sum for each month
      • line_item_count_lifetime: Cumulative sum using window function
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[line_item_count]
    • Aggregation This column is summed to calculate the line item count in a month and lifetime
    • Output Columns:
      • line_item_count_in_month: Summed for each month
      • line_item_count_lifetime: Cumulative sum over time
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order created_timestamp customer_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders created_timestamp customer_id customer_order_seq_number new_vs_repeat 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f2 52. model.shopify_source.stg_shopify__order:f1->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f1->21. model.shopify.shopify__orders:f2 52. model.shopify_source.stg_shopify__order:f1->21. model.shopify.shopify__orders:f3
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number
    • Output Columns:
      • created_timestamp: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_id]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number and new vs repeat customer status
    • Output Columns:
      • customer_id: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
      • new_vs_repeat: Used to determine if the order is from a new or repeat customer
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order customer_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_id customer_order_seq_number new_vs_repeat 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f2
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_id]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number and new vs repeat customer status
    • Output Columns:
      • customer_id: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
      • new_vs_repeat: Used to determine if the order is from a new or repeat customer
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_shipping_price_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_cost 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_shipping_price_set]
    • Cleaning The JSON is parsed and the 'shop_money' 'amount' is extracted and cast to FLOAT
    • Output Columns:
      • shipping_cost: Transformed from total_shipping_price_set
Column Lineage
%3 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjustment_amount 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[amount]
    • Aggregation Summed up to calculate total order adjustment amount
    • Output Columns:
      • order_adjustment_amount: Aggregated sum of this column
Column Lineage
%3 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment tax_amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjustment_tax_amount 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[tax_amount]
    • Aggregation Summed up to calculate total order adjustment tax amount
    • Output Columns:
      • order_adjustment_tax_amount: Aggregated sum of this column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: Aggregated as the sum of order_adjusted_total for each month
      • total_price_lifetime: Further aggregated as a cumulative sum over time
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: The sum of order_adjusted_total for each month
      • total_price_lifetime: The cumulative sum of total_price_in_month
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order checkout_token 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders checkout_token 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[checkout_token]
    • Direct This column is directly used in the output
    • Output Columns:
      • checkout_token: Directly mapped to the output column
Column Lineage
%3 67. model.shopify_source.stg_shopify__order_tag 67. model.shopify_source.stg_shopify__order_tag value 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_tags 67. model.shopify_source.stg_shopify__order_tag:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 67. model.shopify_source.stg_shopify__order_tag[value]
    • Aggregation Used in the LISTAGG function to concatenate all distinct tag values
    • Output Columns:
      • order_tags: Transformed and aggregated into this output column
Column Lineage
%3 70. model.shopify_source.stg_shopify__order_url_tag 70. model.shopify_source.stg_shopify__order_url_tag value 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_url_tags 70. model.shopify_source.stg_shopify__order_url_tag:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 70. model.shopify_source.stg_shopify__order_url_tag[value]
    • Aggregation Used in LISTAGG function to concatenate distinct values
    • Output Columns:
      • order_url_tags: Aggregated into this output column
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment fulfillment_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders number_of_fulfillments 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[fulfillment_id]
    • Aggregation Used in COUNT to determine the number of fulfillments
    • Output Columns:
      • number_of_fulfillments: Aggregated count of distinct fulfillment_id
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment service 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fulfillment_services 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[service]
    • Aggregation Used in LISTAGG to create a list of distinct fulfillment services
    • Output Columns:
      • fulfillment_services: Aggregated list of distinct service values
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment tracking_company 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders tracking_companies 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[tracking_company]
    • Aggregation Used in LISTAGG to create a list of distinct tracking companies
    • Output Columns:
      • tracking_companies: Aggregated list of distinct tracking_company values
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment tracking_number 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders tracking_numbers 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[tracking_number]
    • Aggregation The tracking_number is aggregated using LISTAGG to create a list of distinct tracking numbers for each order.
    • Output Columns:
      • tracking_numbers: Aggregated into a comma-separated list of distinct tracking numbers.
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_tip_received 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_tip_received 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_tip_received]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_tip_received: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order checkout_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders checkout_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[checkout_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • checkout_id: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order client_details_user_agent 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders client_details_user_agent 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[client_details_user_agent]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • client_details_user_agent: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order customer_locale 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_locale 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_locale]
    • Direct This column is directly used in the output
    • Output Columns:
      • customer_locale: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_status_url 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_status_url 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_status_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • order_status_url: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order presentment_currency 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders presentment_currency 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[presentment_currency]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • presentment_currency: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order is_deleted 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders is_deleted 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[is_deleted]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • is_deleted: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_discounts_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_discounts_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_discounts_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_discounts_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_line_items_price_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_line_items_price_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_line_items_price_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_line_items_price_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_price_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_price_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_tax_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_tax_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_tax_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_tax_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order is_confirmed 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders is_confirmed 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[is_confirmed]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • is_confirmed: Directly copied
Column Lineage
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fixed_amount_discount_amount percentage_calc_discount_amount shipping_discount_amount 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f2 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f1 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 55. model.shopify_source.stg_shopify__order_discount_code[amount]
    • Aggregation The amount is summed up based on the discount type
    • Output Columns:
      • shipping_discount_amount: Summed when type is 'shipping'
      • percentage_calc_discount_amount: Summed when type is 'percentage'
      • fixed_amount_discount_amount: Summed when type is 'fixed_amount'
Column Lineage
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fixed_amount_discount_amount percentage_calc_discount_amount shipping_discount_amount 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f2 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f1 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 55. model.shopify_source.stg_shopify__order_discount_code[amount]
    • Aggregation The amount is summed up based on the discount type
    • Output Columns:
      • shipping_discount_amount: Summed when type is 'shipping'
      • percentage_calc_discount_amount: Summed when type is 'percentage'
      • fixed_amount_discount_amount: Summed when type is 'fixed_amount'
Column Lineage
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fixed_amount_discount_amount percentage_calc_discount_amount shipping_discount_amount 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f2 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f1 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 55. model.shopify_source.stg_shopify__order_discount_code[amount]
    • Aggregation The amount is summed up based on the discount type
    • Output Columns:
      • shipping_discount_amount: Summed when type is 'shipping'
      • percentage_calc_discount_amount: Summed when type is 'percentage'
      • fixed_amount_discount_amount: Summed when type is 'fixed_amount'
Column Lineage
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders count_discount_codes_applied 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 55. model.shopify_source.stg_shopify__order_discount_code[code]
    • Aggregation Distinct codes are counted
    • Output Columns:
      • count_discount_codes_applied: Count of distinct discount codes
22. model.shopify.shopify__orders__order_line_aggregates

This SQL query aggregates order-related data from various Shopify tables. It calculates metrics such as line item count, total quantity, total tax, total discount, shipping costs, and shipping taxes for each order. The query joins information from order lines, tax lines, and shipping details to create a comprehensive summary of order aggregates.

IntegrationAggregation
SQL Query
WITH __dbt__cte__int_shopify__order__shipping_aggregates AS (
  WITH order_shipping_line AS (
    SELECT
      order_id,
      source_relation,
      order_shipping_line_id,
      SUM(price) AS shipping_price,
      SUM(discounted_price) AS discounted_shipping_price
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_shipping_line
    GROUP BY
      1,
      2,
      3
  ), order_shipping_tax_line AS (
    SELECT
      order_shipping_line_id,
      source_relation,
      SUM(price) AS shipping_tax
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_shipping_tax_line
    GROUP BY
      1,
      2
  ), aggregated AS (
    SELECT
      order_shipping_line.order_id,
      order_shipping_line.source_relation,
      SUM(order_shipping_line.shipping_price) AS shipping_price,
      SUM(order_shipping_line.discounted_shipping_price) AS discounted_shipping_price,
      SUM(order_shipping_tax_line.shipping_tax) AS shipping_tax
    FROM order_shipping_line
    LEFT JOIN order_shipping_tax_line
      ON order_shipping_line.order_shipping_line_id = order_shipping_tax_line.order_shipping_line_id
      AND order_shipping_line.source_relation = order_shipping_tax_line.source_relation
    GROUP BY
      1,
      2
  )
  SELECT
    *
  FROM aggregated
), order_line AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line
), tax AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__tax_line
), shipping AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__order__shipping_aggregates
), tax_aggregates AS (
  SELECT
    order_line_id,
    source_relation,
    SUM(price) AS price
  FROM tax
  GROUP BY
    1,
    2
), order_line_aggregates AS (
  SELECT
    order_line.order_id,
    order_line.source_relation,
    COUNT(*) AS line_item_count,
    SUM(order_line.quantity) AS order_total_quantity,
    SUM(tax_aggregates.price) AS order_total_tax,
    SUM(order_line.total_discount) AS order_total_discount
  FROM order_line
  LEFT JOIN tax_aggregates
    ON tax_aggregates.order_line_id = order_line.order_line_id
    AND tax_aggregates.source_relation = order_line.source_relation
  GROUP BY
    1,
    2
), final AS (
  SELECT
    order_line_aggregates.order_id,
    order_line_aggregates.source_relation,
    order_line_aggregates.line_item_count,
    order_line_aggregates.order_total_quantity,
    order_line_aggregates.order_total_tax,
    order_line_aggregates.order_total_discount,
    shipping.shipping_price AS order_total_shipping,
    shipping.discounted_shipping_price AS order_total_shipping_with_discounts,
    shipping.shipping_tax AS order_total_shipping_tax
  FROM order_line_aggregates
  LEFT JOIN shipping
    ON shipping.order_id = order_line_aggregates.order_id
    AND shipping.source_relation = order_line_aggregates.source_relation
)
SELECT
  *
FROM final
%3 22. model.shopify.shopify__orders__order_line_aggregates 22. model.shopify.shopify__orders__order_line_aggregates 8. model.shopify.int_shopify__order__shipping_aggregates 8. model.shopify.int_shopify__order__shipping_aggregates 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line
Name Type Comment
23. model.shopify.shopify__orders__order_refunds

This SQL query integrates data from two staging tables: 'stg_shopify__refund' and 'stg_shopify__order_line_refund'. It joins these tables based on the refund_id and source_relation columns, combining information about refunds with their corresponding order line details. The query selects all columns from both tables, providing a comprehensive view of refund information along with associated order line refund data.

Integration
SQL Query
WITH refunds AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__refund
), order_line_refunds AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_refund
), refund_join AS (
  SELECT
    refunds.refund_id,
    refunds.created_at,
    refunds.order_id,
    refunds.user_id,
    refunds.source_relation,
    order_line_refunds.order_line_refund_id,
    order_line_refunds.order_line_id,
    order_line_refunds.restock_type,
    order_line_refunds.quantity,
    order_line_refunds.subtotal,
    order_line_refunds.total_tax
  FROM refunds
  LEFT JOIN order_line_refunds
    ON refunds.refund_id = order_line_refunds.refund_id
    AND refunds.source_relation = order_line_refunds.source_relation
)
SELECT
  *
FROM refund_join
%3 23. model.shopify.shopify__orders__order_refunds 23. model.shopify.shopify__orders__order_refunds 58. model.shopify_source.stg_shopify__order_line_refund 58. model.shopify_source.stg_shopify__order_line_refund 82. model.shopify_source.stg_shopify__refund 82. model.shopify_source.stg_shopify__refund
Name Type Comment
24. model.shopify.shopify__products

This SQL query integrates data from multiple Shopify-related tables to create a comprehensive view of products. It joins product information with collections, tags, variants, and images. The query also aggregates order line data to add sales-related metrics to each product. It includes various calculations such as quantity sold, subtotal sold, average quantity per order line, total discounts, and taxes. The result is a detailed product report that combines product attributes with sales performance data.

IntegrationAggregationFeaturization
SQL Query
WITH __dbt__cte__int_shopify__products_with_aggregates AS (
  WITH products AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__product
  ), collection_product AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__collection_product
  ), collection AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__collection
    WHERE
      NOT COALESCE(is_deleted, FALSE) /* limit to only active collections */
  ), product_tag AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_tag
  ), product_variant AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_variant
  ), product_image AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_image
  ), collections_aggregated AS (
    SELECT
      collection_product.product_id,
      collection_product.source_relation,
      LISTAGG(collection.title, ', ') AS collections
    FROM collection_product
    JOIN collection
      ON collection_product.collection_id = collection.collection_id
      AND collection_product.source_relation = collection.source_relation
    GROUP BY
      1,
      2
  ), tags_aggregated AS (
    SELECT
      product_id,
      source_relation,
      LISTAGG(value, ', ') AS tags
    FROM product_tag
    GROUP BY
      1,
      2
  ), variants_aggregated AS (
    SELECT
      product_id,
      source_relation,
      COUNT(variant_id) AS count_variants
    FROM product_variant
    GROUP BY
      1,
      2
  ), images_aggregated AS (
    SELECT
      product_id,
      source_relation,
      COUNT(*) AS count_images
    FROM product_image
    GROUP BY
      1,
      2
  ), joined AS (
    SELECT
      products.*,
      collections_aggregated.collections,
      tags_aggregated.tags,
      variants_aggregated.count_variants,
      COALESCE(images_aggregated.count_images, 0) > 0 AS has_product_image
    FROM products
    LEFT JOIN collections_aggregated
      ON products.product_id = collections_aggregated.product_id
      AND products.source_relation = collections_aggregated.source_relation
    LEFT JOIN tags_aggregated
      ON products.product_id = tags_aggregated.product_id
      AND products.source_relation = tags_aggregated.source_relation
    LEFT JOIN variants_aggregated
      ON products.product_id = variants_aggregated.product_id
      AND products.source_relation = variants_aggregated.source_relation
    LEFT JOIN images_aggregated
      ON products.product_id = images_aggregated.product_id
      AND products.source_relation = images_aggregated.source_relation
  )
  SELECT
    *
  FROM joined
), __dbt__cte__int_shopify__product__order_line_aggregates AS (
  WITH order_lines AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__order_lines
  ), orders AS (
    SELECT
      *
    FROM TEST.PUBLIC_shopify.shopify__orders
  ), product_aggregated AS (
    SELECT
      order_lines.product_id,
      order_lines.source_relation,
      SUM(order_lines.quantity) AS quantity_sold, /* moved over from shopify__products */
      SUM(order_lines.pre_tax_price) AS subtotal_sold,
      SUM(order_lines.quantity_net_refunds) AS quantity_sold_net_refunds,
      SUM(order_lines.subtotal_net_refunds) AS subtotal_sold_net_refunds,
      MIN(orders.created_timestamp) AS first_order_timestamp,
      MAX(orders.created_timestamp) AS most_recent_order_timestamp,
      SUM(order_lines.total_discount) AS product_total_discount, /* new columns */
      SUM(order_lines.order_line_tax) AS product_total_tax,
      AVG(order_lines.quantity) AS avg_quantity_per_order_line,
      AVG(order_lines.total_discount) AS product_avg_discount_per_order_line,
      AVG(order_lines.order_line_tax) AS product_avg_tax_per_order_line
    FROM order_lines
    LEFT JOIN orders
      ON order_lines.order_id = orders.order_id
      AND order_lines.source_relation = orders.source_relation
    GROUP BY
      1,
      2
  )
  SELECT
    *
  FROM product_aggregated
), products AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__products_with_aggregates
), product_order_lines AS (
  SELECT
    *
  FROM __dbt__cte__int_shopify__product__order_line_aggregates
), joined AS (
  SELECT
    products.*,
    COALESCE(product_order_lines.quantity_sold, 0) AS total_quantity_sold,
    COALESCE(product_order_lines.subtotal_sold, 0) AS subtotal_sold,
    COALESCE(product_order_lines.quantity_sold_net_refunds, 0) AS quantity_sold_net_refunds,
    COALESCE(product_order_lines.subtotal_sold_net_refunds, 0) AS subtotal_sold_net_refunds,
    product_order_lines.first_order_timestamp,
    product_order_lines.most_recent_order_timestamp,
    product_order_lines.avg_quantity_per_order_line AS avg_quantity_per_order_line,
    COALESCE(product_order_lines.product_total_discount, 0) AS product_total_discount,
    product_order_lines.product_avg_discount_per_order_line AS product_avg_discount_per_order_line,
    COALESCE(product_order_lines.product_total_tax, 0) AS product_total_tax,
    product_order_lines.product_avg_tax_per_order_line AS product_avg_tax_per_order_line
  FROM products
  LEFT JOIN product_order_lines
    ON products.product_id = product_order_lines.product_id
    AND products.source_relation = product_order_lines.source_relation
)
SELECT
  *
FROM joined
%3 24. model.shopify.shopify__products 24. model.shopify.shopify__products is_deleted _fivetran_synced created_timestamp handle product_id product_type published_timestamp published_scope title updated_timestamp vendor total_quantity_sold subtotal_sold quantity_sold_net_refunds subtotal_sold_net_refunds first_order_timestamp most_recent_order_timestamp source_relation avg_quantity_per_order_line product_total_discount product_avg_discount_per_order_line product_total_tax product_avg_tax_per_order_line count_variants has_product_image status collections tags 9. model.shopify.int_shopify__product__order_line_aggregates 9. model.shopify.int_shopify__product__order_line_aggregates 10. model.shopify.int_shopify__products_with_aggregates 10. model.shopify.int_shopify__products_with_aggregates
Name Type Comment
is_deleted None Whether the record has been deleted in the source system.
_fivetran_synced None The time when a record was last updated by Fivetran.
created_timestamp None The date and time when the product was created.
handle None A unique human-friendly string for the product. Automatically generated from the product's title.
product_id None An unsigned 64-bit integer that's used as a unique identifier for the product. Each id is unique across the Shopify system. No two products will have the same id, even if they're from different shops.
product_type None A categorization for the product used for filtering and searching products.
published_timestamp None The date and time (ISO 8601 format) when the product was published. Can be set to null to unpublish the product from the Online Store channel.
published_scope None Whether the product is published to the Point of Sale channel.
title None The name of the product.
updated_timestamp None The date and time when the product was last modified.
vendor None The name of the product's vendor.
total_quantity_sold None Quantity of the product sold.
subtotal_sold None Total amount (in shop currency) of the product sold.
quantity_sold_net_refunds None Quantity of the product sold, excluding refunds.
subtotal_sold_net_refunds None Total amount (in shop currency) of the product sold, excluding refunds.
first_order_timestamp None The timestamp the product was first ordered.
most_recent_order_timestamp None The timestamp the product was most recently ordered.
source_relation None The schema or database this record came from, if you are unioning multiple connectors. Null if not.
avg_quantity_per_order_line None Average quantity per order line with this product.
product_total_discount None Total discounts associated with the product.
product_avg_discount_per_order_line None Average discount per order line with this product.
product_total_tax None Total taxes associated with the product.
product_avg_tax_per_order_line None Average taxes per order line with this product.
count_variants None Count of product variants.
has_product_image None If the product has an image.
status None The status of the product. Valid values: - active: The product is ready to sell and is available to customers on the online store, sales channels, and apps. By default, existing products are set to active. - archived: The product is no longer being sold and isn't available to customers on sales channels and apps. - draft: The product isn't ready to sell and is unavailable to customers on sales channels and apps. By default, duplicated and unarchived products are set to draft.
collections None Comma-separated list of collections associated with the product.
tags None Comma-separated list of tags associated with the product.
25. model.shopify.shopify__transactions

This SQL query integrates data from three Shopify-related tables: transactions, tender transactions, and parent transactions. It creates a unique identifier for each transaction, joins the tables based on transaction IDs and source relations, and calculates exchange rates and currency-adjusted amounts from JSON data in the receipt field. The query enhances the transaction data with payment methods, parent transaction details, and currency exchange information.

IntegrationFeaturizationCleaning
SQL Query
WITH transactions AS (
  SELECT
    *,
    MD5(
      CAST(COALESCE(CAST(source_relation AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(transaction_id AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS transactions_unique_id
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__transaction
), tender_transactions AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__tender_transaction
), joined AS (
  SELECT
    transactions.*,
    tender_transactions.payment_method,
    parent_transactions.created_timestamp AS parent_created_timestamp,
    parent_transactions.kind AS parent_kind,
    parent_transactions.amount AS parent_amount,
    parent_transactions.status AS parent_status
  FROM transactions
  LEFT JOIN tender_transactions
    ON transactions.transaction_id = tender_transactions.transaction_id
    AND transactions.source_relation = tender_transactions.source_relation
  LEFT JOIN transactions AS parent_transactions
    ON transactions.parent_id = parent_transactions.transaction_id
    AND transactions.source_relation = parent_transactions.source_relation
), exchange_rate AS (
  SELECT
    *,
    COALESCE(
      CAST(NULLIF(
        PARSE_JSON(receipt)['charges']['data'][0]['balance_transaction']['exchange_rate'],
        ''
      ) AS DECIMAL(28, 6)),
      1
    ) AS exchange_rate,
    COALESCE(
      CAST(NULLIF(
        PARSE_JSON(receipt)['charges']['data'][0]['balance_transaction']['exchange_rate'],
        ''
      ) AS DECIMAL(28, 6)),
      1
    ) * amount AS currency_exchange_calculated_amount
  FROM joined
)
SELECT
  *
FROM exchange_rate
%3 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions transactions_unique_id transaction_id order_id refund_id amount authorization created_timestamp processed_timestamp device_id gateway source_name message currency location_id parent_id payment_avs_result_code payment_credit_card_bin payment_cvv_result_code payment_credit_card_number payment_credit_card_company kind receipt currency_exchange_id currency_exchange_adjustment currency_exchange_original_amount currency_exchange_final_amount currency_exchange_currency error_code status user_id _fivetran_synced exchange_rate currency_exchange_calculated_amount source_relation payment_method parent_created_timestamp parent_kind parent_amount parent_status authorization_expires_at authorization_code 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction _fivetran_synced payment_method 88. model.shopify_source.stg_shopify__tender_transaction:f0->25. model.shopify.shopify__transactions:f30 88. model.shopify_source.stg_shopify__tender_transaction:f1->25. model.shopify.shopify__transactions:f34 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction transaction_id order_id refund_id amount authorization_code created_timestamp processed_timestamp device_id gateway source_name message currency location_id parent_id payment_avs_result_code payment_credit_card_bin payment_cvv_result_code payment_credit_card_number payment_credit_card_company kind receipt currency_exchange_id currency_exchange_adjustment currency_exchange_original_amount currency_exchange_final_amount currency_exchange_currency error_code status user_id _fivetran_synced source_relation authorization_expires_at 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f1->25. model.shopify.shopify__transactions:f2 90. model.shopify_source.stg_shopify__transaction:f2->25. model.shopify.shopify__transactions:f3 90. model.shopify_source.stg_shopify__transaction:f3->25. model.shopify.shopify__transactions:f4 90. model.shopify_source.stg_shopify__transaction:f3->25. model.shopify.shopify__transactions:f32 90. model.shopify_source.stg_shopify__transaction:f4->25. model.shopify.shopify__transactions:f40 90. model.shopify_source.stg_shopify__transaction:f5->25. model.shopify.shopify__transactions:f6 90. model.shopify_source.stg_shopify__transaction:f6->25. model.shopify.shopify__transactions:f7 90. model.shopify_source.stg_shopify__transaction:f7->25. model.shopify.shopify__transactions:f8 90. model.shopify_source.stg_shopify__transaction:f8->25. model.shopify.shopify__transactions:f9 90. model.shopify_source.stg_shopify__transaction:f9->25. model.shopify.shopify__transactions:f10 90. model.shopify_source.stg_shopify__transaction:f10->25. model.shopify.shopify__transactions:f11 90. model.shopify_source.stg_shopify__transaction:f11->25. model.shopify.shopify__transactions:f12 90. model.shopify_source.stg_shopify__transaction:f12->25. model.shopify.shopify__transactions:f13 90. model.shopify_source.stg_shopify__transaction:f13->25. model.shopify.shopify__transactions:f14 90. model.shopify_source.stg_shopify__transaction:f14->25. model.shopify.shopify__transactions:f15 90. model.shopify_source.stg_shopify__transaction:f15->25. model.shopify.shopify__transactions:f16 90. model.shopify_source.stg_shopify__transaction:f16->25. model.shopify.shopify__transactions:f17 90. model.shopify_source.stg_shopify__transaction:f17->25. model.shopify.shopify__transactions:f18 90. model.shopify_source.stg_shopify__transaction:f18->25. model.shopify.shopify__transactions:f19 90. model.shopify_source.stg_shopify__transaction:f19->25. model.shopify.shopify__transactions:f20 90. model.shopify_source.stg_shopify__transaction:f19->25. model.shopify.shopify__transactions:f36 90. model.shopify_source.stg_shopify__transaction:f20->25. model.shopify.shopify__transactions:f31 90. model.shopify_source.stg_shopify__transaction:f20->25. model.shopify.shopify__transactions:f32 90. model.shopify_source.stg_shopify__transaction:f21->25. model.shopify.shopify__transactions:f22 90. model.shopify_source.stg_shopify__transaction:f22->25. model.shopify.shopify__transactions:f23 90. model.shopify_source.stg_shopify__transaction:f23->25. model.shopify.shopify__transactions:f24 90. model.shopify_source.stg_shopify__transaction:f24->25. model.shopify.shopify__transactions:f25 90. model.shopify_source.stg_shopify__transaction:f25->25. model.shopify.shopify__transactions:f26 90. model.shopify_source.stg_shopify__transaction:f26->25. model.shopify.shopify__transactions:f27 90. model.shopify_source.stg_shopify__transaction:f27->25. model.shopify.shopify__transactions:f28 90. model.shopify_source.stg_shopify__transaction:f28->25. model.shopify.shopify__transactions:f29 90. model.shopify_source.stg_shopify__transaction:f29->25. model.shopify.shopify__transactions:f30 90. model.shopify_source.stg_shopify__transaction:f30->25. model.shopify.shopify__transactions:f33 90. model.shopify_source.stg_shopify__transaction:f30->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f31->25. model.shopify.shopify__transactions:f39
Name Type Comment
transactions_unique_id None Unique key representing a transaction. Hashed on 'transaction_id' and 'source_relation'.
transaction_id None The ID for the transaction.
order_id None The ID for the order that the transaction is associated with.
refund_id None The ID associated with a refund in the refund table.
amount None The amount of money included in the transaction in shop currency.
authorization None The authorization code associated with the transaction.
created_timestamp None The date and time when the transaction was created.
processed_timestamp None The date and time when a transaction was processed.
device_id None The ID for the device.
gateway None The name of the gateway the transaction was issued through.
source_name None The origin of the transaction.
message None A string generated by the payment provider with additional information about why the transaction succeeded or failed.
currency None The three-letter code (ISO 4217 format) for the currency used for the payment.
location_id None The ID of the physical location where the transaction was processed.
parent_id None The ID of an associated transaction.
payment_avs_result_code None The response code from the address verification system.
payment_credit_card_bin None The issuer identification number (IIN), formerly known as bank identification number (BIN) of the customer's credit card.
payment_cvv_result_code None The response code from the credit card company indicating whether the customer entered the card security code, or card verification value, correctly.
payment_credit_card_number None The customer's credit card number, with most of the leading digits redacted.
payment_credit_card_company None The name of the company that issued the customer's credit card.
kind None The transaction's type.
receipt None A transaction receipt attached to the transaction by the gateway.
currency_exchange_id None The ID of the adjustment.
currency_exchange_adjustment None The difference between the amounts on the associated transaction and the parent transaction.
currency_exchange_original_amount None The amount of the parent transaction in the shop currency.
currency_exchange_final_amount None The amount of the associated transaction in the shop currency.
currency_exchange_currency None The shop currency.
error_code None A standardized error code, independent of the payment provider.
status None The status of the transaction.
user_id None The ID for the user who was logged into the Shopify POS device when the order was processed, if applicable.
_fivetran_synced None Timestamp of the date the record was synced by Fivetran.
exchange_rate None The exchange rate between the home currency and the currency of sale at the time of the transaction.
currency_exchange_calculated_amount None The total amount of the transaction with the currency exchange rate applied.
source_relation None The schema or database this record came from, if you are unioning multiple connectors. Null if not.
payment_method None Method of payment.
parent_created_timestamp None Created on timestamp of the parent transaction.
parent_kind None Kind of the parent transaction.
parent_amount None Amount of the parent transaction.
parent_status None Status of the parent transaction.
authorization_expires_at None Timestamp when the authorization expires.
authorization_code None The authorization code associated with the transaction.
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction source_relation transaction_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions source_relation transaction_id transactions_unique_id 90. model.shopify_source.stg_shopify__transaction:f1->25. model.shopify.shopify__transactions:f1 90. model.shopify_source.stg_shopify__transaction:f1->25. model.shopify.shopify__transactions:f2 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f2
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[transaction_id]
    • Direct The column is directly copied without transformation
    • Integration Used as a key to join with tender_transactions and parent_transactions
    • Other Used to create the transactions_unique_id
    • Output Columns:
      • transaction_id: Directly copied
      • transactions_unique_id: Part of the MD5 hash
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[source_relation]
    • Direct This column is directly copied to the output without any transformation
    • Integration This column is used as a key to join the transactions table with tender_transactions and parent_transactions
    • Other This column is used in creating the transactions_unique_id
    • Output Columns:
      • source_relation: Directly copied to the output
      • transactions_unique_id: Used in the MD5 hash function to create this unique identifier
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction transaction_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions transaction_id transactions_unique_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[transaction_id]
    • Direct The column is directly copied without transformation
    • Integration Used as a key to join with tender_transactions and parent_transactions
    • Other Used to create the transactions_unique_id
    • Output Columns:
      • transaction_id: Directly copied
      • transactions_unique_id: Part of the MD5 hash
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction order_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions order_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[order_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • order_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction refund_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions refund_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[refund_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • refund_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction amount 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions amount currency_exchange_calculated_amount 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[amount]
    • Direct The column is directly copied without transformation
    • Other Used in currency exchange calculations
    • Output Columns:
      • amount: Directly copied
      • currency_exchange_calculated_amount: Used in calculation with exchange_rate
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction created_timestamp 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions created_timestamp 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[created_timestamp]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction processed_timestamp 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions processed_timestamp 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[processed_timestamp]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • processed_timestamp: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction device_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions device_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[device_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • device_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction gateway 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions gateway 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[gateway]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • gateway: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction source_name 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions source_name 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[source_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source_name: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction message 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions message 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[message]
    • Direct The message column is directly copied without any transformation
    • Output Columns:
      • message: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency]
    • Direct The currency column is directly copied without any transformation
    • Output Columns:
      • currency: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction location_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions location_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[location_id]
    • Direct The location_id column is directly copied without any transformation
    • Output Columns:
      • location_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction parent_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions parent_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[parent_id]
    • Integration The parent_id is used to join with the parent transactions table
    • Output Columns:
      • parent_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_avs_result_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_avs_result_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_avs_result_code]
    • Direct The payment_avs_result_code column is directly copied without any transformation
    • Output Columns:
      • payment_avs_result_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_credit_card_bin 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_credit_card_bin 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_credit_card_bin]
    • Direct The payment_credit_card_bin column is directly copied without any transformation
    • Output Columns:
      • payment_credit_card_bin: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_cvv_result_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_cvv_result_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_cvv_result_code]
    • Direct The payment_cvv_result_code column is directly copied without any transformation
    • Output Columns:
      • payment_cvv_result_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_credit_card_number 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_credit_card_number 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_credit_card_number]
    • Direct The payment_credit_card_number column is directly copied without any transformation
    • Output Columns:
      • payment_credit_card_number: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_credit_card_company 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_credit_card_company 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_credit_card_company]
    • Direct The payment_credit_card_company column is directly copied without any transformation
    • Output Columns:
      • payment_credit_card_company: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction kind 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions kind parent_kind 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[kind]
    • Direct The kind column is directly copied without any transformation
    • Integration The kind column is also used in the join with parent transactions
    • Output Columns:
      • kind: Directly copied
      • parent_kind: Used to populate the parent_kind column for child transactions
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_adjustment 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_adjustment 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_adjustment]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_adjustment: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_original_amount 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_original_amount 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_original_amount]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_original_amount: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_final_amount 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_final_amount 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_final_amount]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_final_amount: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_currency 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_currency 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_currency]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_currency: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction error_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions error_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[error_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • error_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction status 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions status 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[status]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • status: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction user_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions user_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[user_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_id: Directly copied
Column Lineage
%3 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction _fivetran_synced 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions _fivetran_synced 88. model.shopify_source.stg_shopify__tender_transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction _fivetran_synced 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 88. model.shopify_source.stg_shopify__tender_transaction[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[_fivetran_synced]
    • Direct This column is directly copied to the output without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction receipt 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_calculated_amount exchange_rate 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[receipt]
    • Featurization The exchange rate is extracted from the JSON data in this column
    • Cleaning The extracted data is cast to DECIMAL(28, 6) and null values are handled
    • Output Columns:
      • exchange_rate: Extracted and cleaned exchange rate value
      • currency_exchange_calculated_amount: Used in calculation with 'amount' column
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction amount receipt 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions amount currency_exchange_calculated_amount exchange_rate 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1 90. model.shopify_source.stg_shopify__transaction:f1->25. model.shopify.shopify__transactions:f2 90. model.shopify_source.stg_shopify__transaction:f1->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[amount]
    • Direct The column is directly copied without transformation
    • Other Used in currency exchange calculations
    • Output Columns:
      • amount: Directly copied
      • currency_exchange_calculated_amount: Used in calculation with exchange_rate
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[receipt]
    • Featurization The exchange rate is extracted from the JSON data in this column
    • Cleaning The extracted data is cast to DECIMAL(28, 6) and null values are handled
    • Output Columns:
      • exchange_rate: Extracted and cleaned exchange rate value
      • currency_exchange_calculated_amount: Used in calculation with 'amount' column
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction source_relation 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions source_relation transactions_unique_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[source_relation]
    • Direct This column is directly copied to the output without any transformation
    • Integration This column is used as a key to join the transactions table with tender_transactions and parent_transactions
    • Other This column is used in creating the transactions_unique_id
    • Output Columns:
      • source_relation: Directly copied to the output
      • transactions_unique_id: Used in the MD5 hash function to create this unique identifier
Column Lineage
%3 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction payment_method 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_method 88. model.shopify_source.stg_shopify__tender_transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 88. model.shopify_source.stg_shopify__tender_transaction[payment_method]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • payment_method: Directly copied to the output
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction kind 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions kind parent_kind 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[kind]
    • Direct The kind column is directly copied without any transformation
    • Integration The kind column is also used in the join with parent transactions
    • Output Columns:
      • kind: Directly copied
      • parent_kind: Used to populate the parent_kind column for child transactions
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction authorization_expires_at 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions authorization_expires_at 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[authorization_expires_at]
    • Direct This column is directly copied to the output without any transformation
    • Output Columns:
      • authorization_expires_at: Directly copied to the output
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction authorization_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions authorization_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[authorization_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • authorization_code: Directly copied
26. model.shopify_source.stg_shopify__abandoned_checkout

This SQL query performs a series of data transformations on the 'stg_shopify__abandoned_checkout_tmp' table. It starts by creating a base CTE that selects all columns from the source table. Then, it defines a 'fields' CTE that casts all columns to specific data types, including several NULL casts. Finally, in the 'final' CTE, it renames some columns, converts timestamps to UTC, and applies some semantic changes (like renaming '_fivetran_deleted' to 'is_deleted'). The query doesn't filter or aggregate data, but primarily focuses on data type casting and column renaming/reformatting.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS abandoned_checkout_url,
    CAST(NULL AS TEXT) AS billing_address_address_1,
    CAST(NULL AS TEXT) AS billing_address_address_2,
    CAST(NULL AS TEXT) AS billing_address_city,
    CAST(NULL AS TEXT) AS billing_address_company,
    CAST(NULL AS TEXT) AS billing_address_country,
    CAST(NULL AS TEXT) AS billing_address_country_code,
    CAST(NULL AS TEXT) AS billing_address_first_name,
    CAST(NULL AS TEXT) AS billing_address_last_name,
    CAST(NULL AS TEXT) AS billing_address_latitude,
    CAST(NULL AS TEXT) AS billing_address_longitude,
    CAST(NULL AS TEXT) AS billing_address_name,
    CAST(NULL AS TEXT) AS billing_address_phone,
    CAST(NULL AS TEXT) AS billing_address_province,
    CAST(NULL AS TEXT) AS billing_address_province_code,
    CAST(NULL AS TEXT) AS billing_address_zip,
    CAST(NULL AS BOOLEAN) AS buyer_accepts_marketing,
    CAST(NULL AS TEXT) AS cart_token,
    CAST(NULL AS TIMESTAMP) AS closed_at,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS currency,
    CAST(NULL AS INT) AS customer_id,
    CAST(NULL AS TEXT) AS customer_locale,
    CAST(NULL AS INT) AS device_id,
    CAST(NULL AS TEXT) AS email,
    CAST(NULL AS TEXT) AS gateway,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS landing_site_base_url,
    CAST(NULL AS INT) AS location_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS note,
    CAST(NULL AS TEXT) AS phone,
    CAST(NULL AS TEXT) AS presentment_currency,
    CAST(NULL AS TEXT) AS referring_site,
    CAST(NULL AS TEXT) AS shipping_address_address_1,
    CAST(NULL AS TEXT) AS shipping_address_address_2,
    CAST(NULL AS TEXT) AS shipping_address_city,
    CAST(NULL AS TEXT) AS shipping_address_company,
    CAST(NULL AS TEXT) AS shipping_address_country,
    CAST(NULL AS TEXT) AS shipping_address_country_code,
    CAST(NULL AS TEXT) AS shipping_address_first_name,
    CAST(NULL AS TEXT) AS shipping_address_last_name,
    CAST(NULL AS TEXT) AS shipping_address_latitude,
    CAST(NULL AS TEXT) AS shipping_address_longitude,
    CAST(NULL AS TEXT) AS shipping_address_name,
    CAST(NULL AS TEXT) AS shipping_address_phone,
    CAST(NULL AS TEXT) AS shipping_address_province,
    CAST(NULL AS TEXT) AS shipping_address_province_code,
    CAST(NULL AS TEXT) AS shipping_address_zip,
    CAST(NULL AS TEXT) AS source_name,
    CAST(NULL AS FLOAT) AS subtotal_price,
    CAST(NULL AS BOOLEAN) AS taxes_included,
    CAST(NULL AS TEXT) AS token,
    CAST(NULL AS FLOAT) AS total_discounts,
    CAST(NULL AS TEXT) AS total_duties,
    CAST(NULL AS FLOAT) AS total_line_items_price,
    CAST(NULL AS FLOAT) AS total_price,
    CAST(NULL AS FLOAT) AS total_tax,
    CAST(NULL AS INT) AS total_weight,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS INT) AS user_id,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    _fivetran_deleted AS is_deleted,
    abandoned_checkout_url,
    billing_address_address_1,
    billing_address_address_2,
    billing_address_city,
    billing_address_company,
    billing_address_country,
    billing_address_country_code,
    billing_address_first_name,
    billing_address_last_name,
    billing_address_latitude,
    billing_address_longitude,
    billing_address_name,
    billing_address_phone,
    billing_address_province,
    billing_address_province_code,
    billing_address_zip,
    buyer_accepts_marketing AS has_buyer_accepted_marketing,
    cart_token,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(closed_at AS TIMESTAMP) AS TIMESTAMP)) AS closed_at,
    currency AS shop_currency,
    customer_id,
    customer_locale,
    device_id,
    email,
    gateway,
    id AS checkout_id,
    landing_site_base_url,
    location_id,
    name,
    note,
    phone,
    presentment_currency,
    referring_site,
    shipping_address_address_1,
    shipping_address_address_2,
    shipping_address_city,
    shipping_address_company,
    shipping_address_country,
    shipping_address_country_code,
    shipping_address_first_name,
    shipping_address_last_name,
    shipping_address_latitude,
    shipping_address_longitude,
    shipping_address_name,
    shipping_address_phone,
    shipping_address_province,
    shipping_address_province_code,
    shipping_address_zip,
    source_name,
    subtotal_price,
    taxes_included AS has_taxes_included,
    token,
    total_discounts,
    total_duties,
    total_line_items_price,
    total_price,
    total_tax,
    total_weight,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    user_id,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout is_deleted _fivetran_synced abandoned_checkout_url billing_address_address_1 billing_address_address_2 billing_address_city billing_address_company billing_address_country billing_address_country_code billing_address_first_name billing_address_last_name billing_address_latitude billing_address_longitude billing_address_name billing_address_phone billing_address_province billing_address_province_code billing_address_zip has_buyer_accepted_marketing cart_token closed_at created_at shop_currency customer_id customer_locale device_id email gateway checkout_id landing_site_base_url location_id name note phone presentment_currency referring_site shipping_address_address_1 shipping_address_address_2 shipping_address_city shipping_address_company shipping_address_country shipping_address_country_code shipping_address_first_name shipping_address_last_name shipping_address_latitude shipping_address_longitude shipping_address_name shipping_address_phone shipping_address_province shipping_address_province_code shipping_address_zip source_name subtotal_price has_taxes_included token total_discounts total_duties total_line_items_price total_price total_tax total_weight updated_at user_id source_relation 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp
Name Type Comment
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
_fivetran_synced None The time when a record was last updated by Fivetran.
abandoned_checkout_url None The recovery URL that's sent to a customer so they can recover their checkout.
billing_address_address_1 None The street address of the billing address.
billing_address_address_2 None An optional additional field for the street address of the billing address.
billing_address_city None The city of the billing address.
billing_address_company None The company of the person associated with the billing address.
billing_address_country None The name of the country of the billing address.
billing_address_country_code None The two-letter code (ISO 3166-1 alpha-2 format) for the country of the billing address.
billing_address_first_name None The first name of the person associated with the payment method.
billing_address_last_name None The last name of the person associated with the payment method.
billing_address_latitude None The latitude of the billing address.
billing_address_longitude None The longitude of the billing address.
billing_address_name None The full name of the person associated with the payment method.
billing_address_phone None The phone number at the billing address.
billing_address_province None The name of the state or province of the billing address.
billing_address_province_code None The two-letter abbreviation of the state or province of the billing address.
billing_address_zip None The zip or postal code of the billing address.
has_buyer_accepted_marketing None Whether the customer would like to receive email updates from the shop. This is set by the 'I want to receive occasional emails about new products, promotions and other news' checkbox during checkout.
cart_token None The ID for the cart that's attached to the checkout.
closed_at None The date and time (ISO 8601 format) when the checkout was closed. If the checkout was not closed, then this value is null.
created_at None The date and time (ISO 8601 format) when the checkout was created.
shop_currency None The three-letter code (ISO 4217 format) of the shop's default currency at the time of checkout. For the currency that the customer used at checkout, see `presentment_currency`.
customer_id None ID of the customer with the abandoned checkout.
customer_locale None The two or three-letter language code, optionally followed by a region modifier. Example values - en, en-CA.
device_id None The ID of the Shopify POS device that created the checkout.
email None The customer's email address.
gateway None The payment gateway used by the checkout.
checkout_id None The ID for the checkout.
landing_site_base_url None The URL for the page where the customer entered the shop.
location_id None The ID of the physical location where the checkout was processed.
name None Checkout order number.
note None The text of an optional note that a shop owner can attach to the order.
phone None The customer's phone number for receiving SMS notifications.
presentment_currency None The three-letter code (ISO 4217 format) of the currency that the customer used at checkout. For the shop's default currency, see `currency`.
referring_site None The website that referred the customer to the shop.
shipping_address_address_1 None The street address of the shipping address.
shipping_address_address_2 None An optional additional field for the street address of the shipping address.
shipping_address_city None The city of the shipping address.
shipping_address_company None The company of the person associated with the shipping address.
shipping_address_country None The name of the country of the shipping address.
shipping_address_country_code None The two-letter code (ISO 3166-1 alpha-2 format) for the country of the shipping address.
shipping_address_first_name None The first name of the person associated with the shipping address.
shipping_address_last_name None The last name of the person associated with the shipping address.
shipping_address_latitude None The latitude of the shipping address.
shipping_address_longitude None The longitude of the shipping address.
shipping_address_name None The full name of the person associated with the shipping address.
shipping_address_phone None The phone number at the shipping address.
shipping_address_province None The name of the state or province of the shipping address.
shipping_address_province_code None The two-letter abbreviation of the state or province of the shipping address.
shipping_address_zip None The zip or postal code of the shipping address.
source_name None Where the checkout originated. Valid values include `web`, `pos`, `iphone`, `android`.
subtotal_price None The price of the checkout in _presentment_ (customer) currency before shipping and taxes.
has_taxes_included None Boolean representing whether taxes are included in the price.
token None A unique ID for a checkout.
total_discounts None The total amount of discounts to be applied in presentment currency.
total_duties None The total duties of the checkout in presentment currency.
total_line_items_price None The sum of the prices of all line items in the checkout in _presentment_ (customer) currency.
total_price None The sum of line item prices, all discounts, shipping costs, and taxes for the checkout in _presentment_ (customer) currency.
total_tax None The sum of all the taxes applied to the checkout in _presentment_ (customer) currency.
total_weight None The sum of all the weights in grams of the line items in the checkout.
updated_at None The date and time (ISO 8601 format) when the checkout was last modified.
user_id None The ID of the user who created the checkout.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout customer_id 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers lifetime_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[customer_id]
    • Integration Used as a key to join with other tables
    • Aggregation Used in GROUP BY clause to aggregate abandoned checkouts per customer
    • Output Columns:
      • lifetime_abandoned_checkouts: Aggregated count of abandoned checkouts per customer
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout email 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails email 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts customer_cohort_id email 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f1 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[email]
    • Cleaning The email is converted to lowercase
    • Aggregation The email is used in GROUP BY clause
    • Output Columns:
      • email: The lowercase email is directly mapped to the output 'email' column
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the orders table
    • Deduplication Used in window functions to partition data
    • Other Used in the MD5 hash to create the customer_cohort_id
    • Output Columns:
      • email: Directly copied
      • customer_cohort_id: Part of the MD5 hash
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout checkout_id 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails lifetime_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers lifetime_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[checkout_id]
    • Aggregation The checkout_id is used in COUNT(DISTINCT checkout_id)
    • Output Columns:
      • lifetime_abandoned_checkouts: The count of distinct checkout_id is mapped to this output column
15. model.shopify.shopify__customers
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[checkout_id]
    • Aggregation Used in COUNT(DISTINCT checkout_id) to calculate the number of abandoned checkouts
    • Output Columns:
      • lifetime_abandoned_checkouts: Aggregated count of distinct checkout_id per customer
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout token 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails lifetime_abandoned_checkouts 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[token]
    • Aggregation Used as part of the COUNT(DISTINCT checkout_id) aggregation
    • Output Columns:
      • lifetime_abandoned_checkouts: Contributes to the count of distinct checkout IDs
Column Lineage
%3 26. model.shopify_source.stg_shopify__abandoned_checkout 26. model.shopify_source.stg_shopify__abandoned_checkout source_relation 14. model.shopify.shopify__customer_emails 14. model.shopify.shopify__customer_emails source_relation 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->14. model.shopify.shopify__customer_emails:f0 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers source_relation 26. model.shopify_source.stg_shopify__abandoned_checkout:f0->15. model.shopify.shopify__customers:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts source_relation 14. model.shopify.shopify__customer_emails:f0->13. model.shopify.shopify__customer_email_cohorts:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
14. model.shopify.shopify__customer_emails
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[source_relation]
    • Integration The column is used as a key to join with other tables and ensure data is combined correctly across different sources.
    • Aggregation The column is used in the GROUP BY clause when aggregating abandoned checkout data.
    • Output Columns:
      • source_relation: This column is directly copied to the output 'source_relation' column.
15. model.shopify.shopify__customers
  • Input Column: 26. model.shopify_source.stg_shopify__abandoned_checkout[source_relation]
    • Integration This column is used as a key to join with other tables in the query
    • Aggregation It's part of the GROUP BY clause in the abandoned checkouts subquery
    • Output Columns:
      • source_relation: It's directly copied to the output 'source_relation' column
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used to join with the orders table
    • Output Columns:
      • source_relation: Directly copied
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 14. model.shopify.shopify__customer_emails[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with the orders table
    • Output Columns:
      • source_relation: Directly copied to the output
27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code

This SQL query performs several operations on the 'stg_shopify__abandoned_checkout_discount_code' data. It starts by casting fields to specific data types, then applies data cleaning and standardization. The query converts timestamps to UTC, uppercases the 'code' field, and creates a unique index for each row. Finally, it deduplicates the data by keeping only the row with index 1 for each combination of checkout_id, code, and source_relation.

CleaningDeduplicationFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_discount_code_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS FLOAT) AS amount,
    CAST(NULL AS INT) AS checkout_id,
    CAST(NULL AS TEXT) AS code,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS INT) AS discount_id,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS TEXT) AS type,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    checkout_id,
    UPPER(code) AS code,
    discount_id,
    amount,
    type,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation,
    CASE
      WHEN checkout_id IS NULL AND code IS NULL AND index IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation)
      ELSE ROW_NUMBER() OVER (PARTITION BY checkout_id, UPPER(code), source_relation ORDER BY index DESC)
    END AS index
  FROM fields
)
SELECT
  *
FROM final
WHERE
  index = 1
%3 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code 27. model.shopify_source.stg_shopify__abandoned_checkout_discount_code _fivetran_synced amount checkout_id code created_at discount_id type updated_at source_relation 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
amount None The amount of the discount in presentment currency.
checkout_id None ID of the checkout.
code None The discount code.
created_at None When the checkout discount application was created.
discount_id None ID of the discount. Deprecated, use `code` instead.
type None The type of discount. Valid values - percentage, shipping, fixed_amount. (default - fixed_amount)
updated_at None When the checkout's discount was last updated
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The LIMIT 0 clause ensures no rows are returned. This query appears to be a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify abandoned checkout discount codes.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp 28. model.shopify_source.stg_shopify__abandoned_checkout_discount_code_tmp 93. source.shopify_source.shopify.abandoned_checkout_discount_code 93. source.shopify_source.shopify.abandoned_checkout_discount_code
Name Type Comment
29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line

This SQL query performs a data transformation on the 'stg_shopify__abandoned_checkout_shipping_line_tmp' table. It casts various columns to specific data types, renames some columns, and adds a new column 'source_relation'. The query also converts the '_fivetran_synced' timestamp to UTC timezone. The purpose seems to be standardizing and cleaning the data for further use.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__abandoned_checkout_shipping_line_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS carrier_identifier,
    CAST(NULL AS INT) AS checkout_id,
    CAST(NULL AS TEXT) AS code,
    CAST(NULL AS TEXT) AS delivery_category,
    CAST(NULL AS TEXT) AS delivery_expectation_range,
    CAST(NULL AS INT) AS delivery_expectation_range_max,
    CAST(NULL AS INT) AS delivery_expectation_range_min,
    CAST(NULL AS TEXT) AS delivery_expectation_type,
    CAST(NULL AS FLOAT) AS discounted_price,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS TEXT) AS phone,
    CAST(NULL AS FLOAT) AS price,
    CAST(NULL AS TEXT) AS requested_fulfillment_service_id,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS title,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS abandoned_checkout_shipping_line_id,
    checkout_id,
    index,
    carrier_identifier,
    code AS shipping_code,
    delivery_category,
    delivery_expectation_range,
    delivery_expectation_range_max,
    delivery_expectation_range_min,
    delivery_expectation_type,
    discounted_price,
    phone,
    price,
    requested_fulfillment_service_id,
    source,
    title,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line 29. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line _fivetran_synced carrier_identifier checkout_id shipping_code delivery_category delivery_expectation_range delivery_expectation_range_max delivery_expectation_range_min delivery_expectation_type discounted_price abandoned_checkout_shipping_line_id index phone price requested_fulfillment_service_id source title source_relation 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
carrier_identifier None A reference to the carrier service that provided the rate. Present when the rate was computed by a third-party carrier service.
checkout_id None ID of the checkout that was abandoned.
shipping_code None A reference to the shipping method.
delivery_category None The general classification of the delivery method.
delivery_expectation_range None Expected delivery date range.
delivery_expectation_range_max None Latest expected delivery date.
delivery_expectation_range_min None Earliest possible expected delivery date.
delivery_expectation_type None Type of expected delivery.
discounted_price None The pre-tax shipping price with discounts applied in _presentment_ (customer) currency.
abandoned_checkout_shipping_line_id None Unique ID of the abandoned checkout shipping line.
index None Index of the line amongst shipping lines for this checkout.
phone None The phone number at the shipping address.
price None The price of the shipping method in presentment currency.
requested_fulfillment_service_id None The fulfillment service requested for the shipping method. Present if the shipping method requires processing by a third party fulfillment service.
source None The channel where the checkout originated. Example value - shopify.
title None The title of the shipping method. Example value - International Shipping.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query is limited to 0 rows, effectively creating a template or schema for the 'stg_shopify__abandoned_checkout_shipping_line_tmp' model without actually returning any data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp 30. model.shopify_source.stg_shopify__abandoned_checkout_shipping_line_tmp 94. source.shopify_source.shopify.abandoned_checkout_shipping_line 94. source.shopify_source.shopify.abandoned_checkout_shipping_line
Name Type Comment
31. model.shopify_source.stg_shopify__abandoned_checkout_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, initialized to NULL. It's likely used as a placeholder or template for further development or testing purposes.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp 31. model.shopify_source.stg_shopify__abandoned_checkout_tmp 92. source.shopify_source.shopify.abandoned_checkout 92. source.shopify_source.shopify.abandoned_checkout
Name Type Comment
32. model.shopify_source.stg_shopify__collection

This SQL query performs data cleaning and transformation on a Shopify collection dataset. It casts various fields to appropriate data types, renames some columns, and applies specific transformations such as converting the 'disjunctive' boolean field into a text field with 'disjunctive' or 'conjunctive' values. It also converts timestamp fields to UTC timezone. The query doesn't filter, deduplicate, or aggregate data, but focuses on standardizing and cleaning the existing data.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__collection_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS disjunctive,
    CAST(NULL AS TEXT) AS handle,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TIMESTAMP) AS published_at,
    CAST(NULL AS TEXT) AS published_scope,
    CAST(NULL AS TEXT) AS rules,
    CAST(NULL AS TEXT) AS sort_order,
    CAST(NULL AS TEXT) AS title,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS collection_id,
    _fivetran_deleted AS is_deleted,
    CASE
      WHEN disjunctive IS NULL
      THEN NULL
      WHEN disjunctive
      THEN 'disjunctive'
      ELSE 'conjunctive'
    END AS rule_logic,
    handle,
    published_scope,
    rules,
    sort_order,
    title,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(published_at AS TIMESTAMP) AS TIMESTAMP)) AS published_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 32. model.shopify_source.stg_shopify__collection 32. model.shopify_source.stg_shopify__collection is_deleted _fivetran_synced rule_logic handle collection_id published_at published_scope rules sort_order title updated_at source_relation 35. model.shopify_source.stg_shopify__collection_tmp 35. model.shopify_source.stg_shopify__collection_tmp
Name Type Comment
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
_fivetran_synced None The time when a record was last updated by Fivetran.
rule_logic None Whether the `rules` are disjunctive (logical `OR`) or conjunctive (logical `AND`)
handle None A unique, human-readable string for the collection automatically generated from its title. This is used in themes by the Liquid templating language to refer to the collection.
collection_id None The ID for the collection.
published_at None The time and date (ISO 8601 format) when the collection was made visible. Returns null for a hidden collection.
published_scope None Whether the collection is published to the Point of Sale channel. Valid values `web` (the collection is published to the Online Store channel but not published to the Point of Sale channel) and `global` (the collection is published to both the Online Store channel and the Point of Sale channel).
rules None An array of rules that define what products go into the smart collection. Each rule (`column` -- `relation` --> `condition`) has these properties: - `column`: the property of a product being used to populate the smart collection. Ex: 'tag', 'type', 'vendor', 'variant_price', etc. - `relation`: The comparative relationship between the column choice, and the condition ('equals', 'contains', 'greater_than', etc.) - condition: Select products for a smart collection using a condition. Values are either strings or numbers, depending on the relation value. See the [Shopify docs](https://shopify.dev/api/admin-rest/2022-10/resources/smartcollection#resource-object) for more.
sort_order None The order of the products in the collection. Valid values incline - `alpha-asc`: The products are sorted alphabetically from A to Z. - `alpha-des`: The products are sorted alphabetically from Z to A. - `best-selling`: The products are sorted by number of sales. - `created`: The products are sorted by the date they were created, from oldest to newest. - `created-desc`: The products are sorted by the date they were created, from newest to oldest. - `manual`: The products are manually sorted by the shop owner. - `price-asc`: The products are sorted by price from lowest to highest. - `price-desc`: The products are sorted by price from highest to lowest.
title None The name of the collection
updated_at None The date and time (ISO 8601 format) when the collection was last modified.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
33. model.shopify_source.stg_shopify__collection_product

This SQL query creates a staging table for Shopify collection product data. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a fields CTE that casts specific columns to desired data types, including setting some to NULL or empty string. Finally, it creates a final CTE that selects and formats these fields, particularly converting the _fivetran_synced timestamp to UTC. The query then selects all columns from this final CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__collection_product_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS collection_id,
    CAST(NULL AS INT) AS product_id,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    collection_id,
    product_id,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 33. model.shopify_source.stg_shopify__collection_product 33. model.shopify_source.stg_shopify__collection_product _fivetran_synced collection_id product_id source_relation 34. model.shopify_source.stg_shopify__collection_product_tmp 34. model.shopify_source.stg_shopify__collection_product_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
collection_id None ID referencing the `collection` the product belongs to.
product_id None ID referencing the `product`.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
34. model.shopify_source.stg_shopify__collection_product_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query limits the result to 0 rows, effectively creating a template or structure for the table without any actual data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 34. model.shopify_source.stg_shopify__collection_product_tmp 34. model.shopify_source.stg_shopify__collection_product_tmp 96. source.shopify_source.shopify.collection_product 96. source.shopify_source.shopify.collection_product
Name Type Comment
35. model.shopify_source.stg_shopify__collection_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify collection data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 35. model.shopify_source.stg_shopify__collection_tmp 35. model.shopify_source.stg_shopify__collection_tmp 95. source.shopify_source.shopify.collection 95. source.shopify_source.shopify.collection
Name Type Comment
36. model.shopify_source.stg_shopify__customer

This SQL query transforms and cleans data from a Shopify customer staging table. It casts various fields to appropriate data types, standardizes email and state fields to lowercase, handles legacy and new marketing consent fields, converts timestamps to UTC, and renames some columns for clarity.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS accepts_marketing,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS DECIMAL(28, 6)) AS default_address_id,
    CAST(NULL AS TEXT) AS email,
    CAST(NULL AS TEXT) AS first_name,
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS TEXT) AS last_name,
    CAST(NULL AS DECIMAL(28, 6)) AS orders_count,
    CAST(NULL AS TEXT) AS phone,
    CAST(NULL AS TEXT) AS state,
    CAST(NULL AS BOOLEAN) AS tax_exempt,
    CAST(NULL AS FLOAT) AS total_spent,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS BOOLEAN) AS verified_email,
    CAST(NULL AS TIMESTAMP) AS email_marketing_consent_consent_updated_at,
    CAST(NULL AS TEXT) AS email_marketing_consent_opt_in_level,
    CAST(NULL AS TEXT) AS email_marketing_consent_state,
    CAST(NULL AS TEXT) AS note,
    CAST(NULL AS TIMESTAMP) AS accepts_marketing_updated_at,
    CAST(NULL AS TEXT) AS marketing_opt_in_level,
    CAST(NULL AS TEXT) AS currency,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS customer_id,
    LOWER(email) AS email,
    first_name,
    last_name,
    orders_count,
    default_address_id,
    phone,
    LOWER(state) AS account_state,
    tax_exempt AS is_tax_exempt,
    total_spent,
    verified_email AS is_verified_email,
    note,
    currency,
    CASE
      WHEN email_marketing_consent_state IS NULL
      THEN CASE
        WHEN accepts_marketing IS NULL
        THEN NULL
        WHEN accepts_marketing
        THEN 'subscribed (legacy)'
        ELSE 'not_subscribed (legacy)'
      END
      ELSE LOWER(email_marketing_consent_state)
    END AS marketing_consent_state,
    LOWER(COALESCE(email_marketing_consent_opt_in_level, marketing_opt_in_level)) AS marketing_opt_in_level,
    CONVERT_TIMEZONE(
      'UTC',
      'UTC',
      CAST(CAST(COALESCE(accepts_marketing_updated_at, email_marketing_consent_consent_updated_at) AS TIMESTAMP) AS TIMESTAMP)
    ) AS marketing_consent_updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer _fivetran_synced marketing_consent_state marketing_opt_in_level marketing_consent_updated_at created_timestamp default_address_id email first_name customer_id last_name orders_count phone account_state is_tax_exempt total_spent updated_timestamp is_verified_email currency source_relation note 39. model.shopify_source.stg_shopify__customer_tmp 39. model.shopify_source.stg_shopify__customer_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
marketing_consent_state None Field indicating if the customer has consented to receive marketing material via email. Coalescing of the new `email_marketing_consent_state` field and the deprecated `accepts_marketing` field. Records with the old field will be marked with '(legacy)'.
marketing_opt_in_level None The marketing subscription opt-in level, as described in the M3AAWG Sender Best Common Practices, that the customer gave when they consented to receive marketing material by email.
marketing_consent_updated_at None The date and time when the customer consented to receive marketing material by email. If no date is provided, then the date and time when the consent information was sent is used.
created_timestamp None The date and time when the customer was created.
default_address_id None The default address for the customer.
email None The unique email address of the customer. Attempting to assign the same email address to multiple customers returns an error.
first_name None The customer's first name.
customer_id None A unique identifier for the customer.
last_name None The customer's last name.
orders_count None The number of orders associated with this customer.
phone None The unique phone number (E.164 format) for this customer. Attempting to assign the same phone number to multiple customers returns an error.
account_state None The state of the customer's account with a shop.
is_tax_exempt None Whether the customer is exempt from paying taxes on their order. If true, then taxes won't be applied to an order at checkout. If false, then taxes will be applied at checkout.
total_spent None The total amount of money that the customer has spent across their order history.
updated_timestamp None The date and time when the customer information was last updated.
is_verified_email None Whether the customer has verified their email address.
currency None The three-letter code (ISO 4217 format) for the currency that the customer used when they paid for their last order. Defaults to the shop currency. Returns the shop currency for test orders.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
note None A note about the customer.
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer _fivetran_synced 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers _fivetran_synced 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer marketing_opt_in_level 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers marketing_opt_in_level 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[marketing_opt_in_level]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • marketing_opt_in_level: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer created_timestamp 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers created_timestamp 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer default_address_id 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers default_address_id 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[default_address_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • default_address_id: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer email 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers email 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer first_name 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers first_name 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[first_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer customer_id 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers customer_id 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts customer_id 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[customer_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as a key to join with other tables
    • Output Columns:
      • customer_id: Directly copied to the output
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[customer_id]
    • Integration Used as a key to join the customers table with the orders table
    • Deduplication Used in window functions to partition data by customer
    • Output Columns:
      • customer_id: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer last_name 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers last_name 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[last_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied to the output
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer phone 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers phone 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[phone]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • phone: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer account_state 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers account_state 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[account_state]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_state: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer is_tax_exempt 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers is_tax_exempt 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[is_tax_exempt]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_tax_exempt: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer updated_timestamp 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers updated_timestamp 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[updated_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • updated_timestamp: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer is_verified_email 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers is_verified_email 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[is_verified_email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_verified_email: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer currency 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers currency 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[currency]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • currency: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer source_relation 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers source_relation 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 15. model.shopify.shopify__customers:f0->12. model.shopify.shopify__customer_cohorts:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • source_relation: Directly copied and used in joins
12. model.shopify.shopify__customer_cohorts
  • Input Column: 15. model.shopify.shopify__customers[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used to join with the orders table
    • Output Columns:
      • source_relation: Directly copied
Column Lineage
%3 36. model.shopify_source.stg_shopify__customer 36. model.shopify_source.stg_shopify__customer note 15. model.shopify.shopify__customers 15. model.shopify.shopify__customers note 36. model.shopify_source.stg_shopify__customer:f0->15. model.shopify.shopify__customers:f0
15. model.shopify.shopify__customers
  • Input Column: 36. model.shopify_source.stg_shopify__customer[note]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: Directly copied
37. model.shopify_source.stg_shopify__customer_tag

This SQL query creates a staging table for Shopify customer tags. It starts with a base table, then defines the structure of the fields with null or empty values. Finally, it selects these fields, converting the '_fivetran_synced' timestamp to UTC. The query appears to be setting up a standardized structure for customer tag data, possibly as part of an ETL process.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__customer_tag_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS INT) AS customer_id,
    CAST(NULL AS TEXT) AS value,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    customer_id,
    index,
    value,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 37. model.shopify_source.stg_shopify__customer_tag 37. model.shopify_source.stg_shopify__customer_tag _fivetran_synced index customer_id value source_relation 38. model.shopify_source.stg_shopify__customer_tag_tmp 38. model.shopify_source.stg_shopify__customer_tag_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
index None Index (starting from 1) representing when the tag was placed on the customer.
customer_id None ID of the customer being tagged.
value None Value of the tag.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
38. model.shopify_source.stg_shopify__customer_tag_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify customer tag data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 38. model.shopify_source.stg_shopify__customer_tag_tmp 38. model.shopify_source.stg_shopify__customer_tag_tmp 98. source.shopify_source.shopify.customer_tag 98. source.shopify_source.shopify.customer_tag
Name Type Comment
39. model.shopify_source.stg_shopify__customer_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The LIMIT 0 clause ensures no rows are returned. This type of query is often used as a placeholder or to create a template for a table structure without populating it with data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 39. model.shopify_source.stg_shopify__customer_tmp 39. model.shopify_source.stg_shopify__customer_tmp 97. source.shopify_source.shopify.customer 97. source.shopify_source.shopify.customer
Name Type Comment
40. model.shopify_source.stg_shopify__discount_code

This SQL query creates a staging table for Shopify discount codes. It starts with a base table, then defines a structure with NULL or empty values for all fields. The final step formats and transforms these fields, including converting timestamps to UTC, uppercasing the discount code, and renaming the ID field. The query is designed to prepare a consistent structure for discount code data, even when no actual data exists yet.

CleaningOther
SQL Query
/* this model will be all NULL until you create a discount code in Shopify */
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__discount_code_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS code,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS price_rule_id,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS FLOAT) AS usage_count,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS discount_code_id,
    UPPER(code) AS code,
    price_rule_id,
    usage_count,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code _fivetran_synced code created_at discount_code_id price_rule_id updated_at usage_count source_relation 41. model.shopify_source.stg_shopify__discount_code_tmp 41. model.shopify_source.stg_shopify__discount_code_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
code None The case-insensitive discount code that customers use at checkout. Shopify recommends this map onto the associated `price_rule.title`.
created_at None The date and time (ISO 8601 format) when the discount code was created.
discount_code_id None The ID for the discount code.
price_rule_id None The ID for the price rule that this discount code belongs to.
updated_at None The date and time (ISO 8601 format) when the discount code was updated.
usage_count None The number of times that the discount code has been redeemed.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code _fivetran_synced 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts _fivetran_synced 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code code 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts code 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[code]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables (orders_aggregated and abandoned_checkouts_aggregated)
    • Output Columns:
      • code: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code created_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts created_at 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[created_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_at: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code discount_code_id 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts discount_code_id discounts_unique_key 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f1
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[discount_code_id]
    • Direct The column is directly copied without any transformation
    • Other Used to create the discounts_unique_key
    • Output Columns:
      • discount_code_id: Directly copied to the output
      • discounts_unique_key: Part of the MD5 hash to create this unique key
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code price_rule_id 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts price_rule_id 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[price_rule_id]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with the price_rule table
    • Output Columns:
      • price_rule_id: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code updated_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts updated_at 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • updated_at: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code usage_count 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts usage_count 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[usage_count]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • usage_count: Directly copied to the output
Column Lineage
%3 40. model.shopify_source.stg_shopify__discount_code 40. model.shopify_source.stg_shopify__discount_code source_relation 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts discounts_unique_key source_relation 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f1 40. model.shopify_source.stg_shopify__discount_code:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 40. model.shopify_source.stg_shopify__discount_code[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join conditions with other tables
    • Other Used to create the discounts_unique_key
    • Output Columns:
      • source_relation: Directly copied to the output
      • discounts_unique_key: Part of the MD5 hash to create this unique key
41. model.shopify_source.stg_shopify__discount_code_tmp

This SQL query creates an empty dataset with a single column named '_dbt_source_relation' of type TEXT. The query is designed to return no rows (LIMIT 0) and is intended as a placeholder until actual discount code data is created in Shopify.

Other
SQL Query
/* this model will be all NULL until you create a discount code in Shopify */
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 41. model.shopify_source.stg_shopify__discount_code_tmp 41. model.shopify_source.stg_shopify__discount_code_tmp 99. source.shopify_source.shopify.discount_code 99. source.shopify_source.shopify.discount_code
Name Type Comment
42. model.shopify_source.stg_shopify__fulfillment

This SQL query stages data from a Shopify fulfillment source table. It casts columns to specific data types, renames some columns, converts timestamps to UTC, and standardizes the status field to lowercase. The query also adds a source_relation column, though its value is set to an empty string in this case.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__fulfillment_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS location_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS service,
    CAST(NULL AS TEXT) AS shipment_status,
    CAST(NULL AS TEXT) AS status,
    CAST(NULL AS TEXT) AS tracking_company,
    CAST(NULL AS TEXT) AS tracking_number,
    CAST(NULL AS TEXT) AS tracking_numbers,
    CAST(NULL AS TEXT) AS tracking_urls,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS fulfillment_id,
    location_id,
    order_id,
    name,
    service,
    shipment_status,
    LOWER(status) AS status,
    tracking_company,
    tracking_number,
    tracking_numbers,
    tracking_urls,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment _fivetran_synced created_at fulfillment_id location_id name order_id service shipment_status status tracking_company tracking_number tracking_numbers tracking_urls updated_at source_relation 43. model.shopify_source.stg_shopify__fulfillment_tmp 43. model.shopify_source.stg_shopify__fulfillment_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
created_at None The date and time when the fulfillment was created. The API returns this value in ISO 8601 format.
fulfillment_id None The ID for the fulfillment.
location_id None The unique identifier of the location that the fulfillment was processed at.
name None The uniquely identifying fulfillment name, consisting of two parts separated by a .. The first part represents the order name and the second part represents the fulfillment number. The fulfillment number automatically increments depending on how many fulfillments are in an order (e.g. #1001.1, #1001.2).
order_id None The unique numeric identifier for the order.
service None The fulfillment service associated with the fulfillment.
shipment_status None The current shipment status of the fulfillment. Valid values include: - label_printed: A label for the shipment was purchased and printed. - label_purchased: A label for the shipment was purchased, but not printed. - attempted_delivery: Delivery of the shipment was attempted, but unable to be completed. - ready_for_pickup: The shipment is ready for pickup at a shipping depot. - confirmed: The carrier is aware of the shipment, but hasn't received it yet. - in_transit: The shipment is being transported between shipping facilities on the way to its destination. - out_for_delivery: The shipment is being delivered to its final destination. - delivered: The shipment was successfully delivered. - failure: Something went wrong when pulling tracking information for the shipment, such as the tracking number was invalid or the shipment was canceled.
status None The status of the fulfillment. Valid values include: - pending: Shopify has created the fulfillment and is waiting for the third-party fulfillment service to transition it to 'open' or 'success'. - open: The fulfillment has been acknowledged by the service and is in processing. - success: The fulfillment was successful. - cancelled: The fulfillment was cancelled. - error: There was an error with the fulfillment request. - failure: The fulfillment request failed.
tracking_company None The name of the tracking company.
tracking_number None Primary tracking number for the order.
tracking_numbers None A list of tracking numbers, provided by the shipping company.
tracking_urls None The URLs of tracking pages for the fulfillment.
updated_at None The date and time (ISO 8601 format) when the fulfillment was last modified.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment fulfillment_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders number_of_fulfillments 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[fulfillment_id]
    • Aggregation Used in COUNT to determine the number of fulfillments
    • Output Columns:
      • number_of_fulfillments: Aggregated count of distinct fulfillment_id
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment service 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fulfillment_services 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[service]
    • Aggregation Used in LISTAGG to create a list of distinct fulfillment services
    • Output Columns:
      • fulfillment_services: Aggregated list of distinct service values
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment tracking_company 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders tracking_companies 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[tracking_company]
    • Aggregation Used in LISTAGG to create a list of distinct tracking companies
    • Output Columns:
      • tracking_companies: Aggregated list of distinct tracking_company values
Column Lineage
%3 42. model.shopify_source.stg_shopify__fulfillment 42. model.shopify_source.stg_shopify__fulfillment tracking_number 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders tracking_numbers 42. model.shopify_source.stg_shopify__fulfillment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 42. model.shopify_source.stg_shopify__fulfillment[tracking_number]
    • Aggregation The tracking_number is aggregated using LISTAGG to create a list of distinct tracking numbers for each order.
    • Output Columns:
      • tracking_numbers: Aggregated into a comma-separated list of distinct tracking numbers.
43. model.shopify_source.stg_shopify__fulfillment_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The LIMIT 0 clause ensures no rows are returned. This query is likely used as a placeholder or template for generating a schema without actual data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 43. model.shopify_source.stg_shopify__fulfillment_tmp 43. model.shopify_source.stg_shopify__fulfillment_tmp 100. source.shopify_source.shopify.fulfillment 100. source.shopify_source.shopify.fulfillment
Name Type Comment
44. model.shopify_source.stg_shopify__inventory_item

This SQL query performs data transformation and cleaning on the Shopify inventory item data. It starts by selecting all columns from a temporary table, then casts them to specific data types. The query renames some columns, converts timestamps to UTC, and restructures the data for further use. It also adds a source_relation column, though it's set to an empty string in this case.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__inventory_item_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS FLOAT) AS cost,
    CAST(NULL AS TEXT) AS country_code_of_origin,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS province_code_of_origin,
    CAST(NULL AS BOOLEAN) AS requires_shipping,
    CAST(NULL AS TEXT) AS sku,
    CAST(NULL AS BOOLEAN) AS tracked,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS inventory_item_id,
    sku,
    _fivetran_deleted AS is_deleted, /* won't filter out for now */
    cost,
    country_code_of_origin,
    province_code_of_origin,
    requires_shipping AS is_shipping_required,
    tracked AS is_inventory_quantity_tracked,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_deleted _fivetran_synced cost country_code_of_origin created_at inventory_item_id province_code_of_origin is_shipping_required sku is_inventory_quantity_tracked updated_at source_relation 45. model.shopify_source.stg_shopify__inventory_item_tmp 45. model.shopify_source.stg_shopify__inventory_item_tmp
Name Type Comment
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
_fivetran_synced None The time when a record was last updated by Fivetran.
cost None The unit cost of the inventory item. The shop's default currency is used.
country_code_of_origin None The country code (ISO 3166-1 alpha-2) of where the item came from.
created_at None The date and time (ISO 8601 format) when the inventory item was created.
inventory_item_id None The ID of the inventory item.
province_code_of_origin None The province code (ISO 3166-2 alpha-2) of where the item came from. The province code is only used if the shipping provider for the inventory item is Canada Post.
is_shipping_required None Boolean representing whether a customer needs to provide a shipping address when placing an order containing the inventory item.
sku None The unique SKU (stock keeping unit) of the inventory item.
is_inventory_quantity_tracked None Boolean representing whether inventory levels are tracked for the item. If true, then the inventory quantity changes are tracked by Shopify.
updated_at None The date and time (ISO 8601 format) when the inventory item was last modified.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_deleted 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_inventory_item_deleted 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[is_deleted]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_inventory_item_deleted: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item _fivetran_synced 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item cost 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels cost 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[cost]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • cost: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item country_code_of_origin 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels country_code_of_origin 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[country_code_of_origin]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • country_code_of_origin: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item created_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels inventory_item_created_at 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[created_at]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • inventory_item_created_at: Directly copied with a renamed column
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item inventory_item_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels inventory_item_id 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[inventory_item_id]
    • Integration Used as a key to join with other tables
    • Output Columns:
      • inventory_item_id: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item province_code_of_origin 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels province_code_of_origin 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[province_code_of_origin]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • province_code_of_origin: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_shipping_required 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_shipping_required 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[is_shipping_required]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_shipping_required: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item sku 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels sku 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[sku]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sku: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item is_inventory_quantity_tracked 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_inventory_quantity_tracked 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[is_inventory_quantity_tracked]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_inventory_quantity_tracked: Directly copied
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item updated_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels inventory_item_updated_at 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • inventory_item_updated_at: This column is directly mapped to inventory_item_updated_at in the output
Column Lineage
%3 44. model.shopify_source.stg_shopify__inventory_item 44. model.shopify_source.stg_shopify__inventory_item source_relation 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels source_relation 44. model.shopify_source.stg_shopify__inventory_item:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 44. model.shopify_source.stg_shopify__inventory_item[source_relation]
    • Integration The column is used as a key to join tables
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • source_relation: This column is directly copied to the output source_relation column
45. model.shopify_source.stg_shopify__inventory_item_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for further development or testing purposes in a dbt (data build tool) project.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 45. model.shopify_source.stg_shopify__inventory_item_tmp 45. model.shopify_source.stg_shopify__inventory_item_tmp 101. source.shopify_source.shopify.inventory_item 101. source.shopify_source.shopify.inventory_item
Name Type Comment
46. model.shopify_source.stg_shopify__inventory_level

This SQL query stages data from a temporary Shopify inventory level table. It casts columns to specific data types, renames the 'available' column to 'available_quantity', and converts 'updated_at' and '_fivetran_synced' timestamps to UTC. The query prepares the data for further processing or analysis by standardizing the format and structure of the inventory level information.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__inventory_level_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS available,
    CAST(NULL AS INT) AS inventory_item_id,
    CAST(NULL AS INT) AS location_id,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    inventory_item_id,
    location_id,
    available AS available_quantity,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level _fivetran_synced available_quantity inventory_item_id location_id updated_at source_relation 47. model.shopify_source.stg_shopify__inventory_level_tmp 47. model.shopify_source.stg_shopify__inventory_level_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
available_quantity None The available quantity of an inventory item at the inventory level's associated location. Returns null if the inventory item is not tracked.
inventory_item_id None The ID of the inventory item associated with the inventory level.
location_id None The ID of the location that the inventory level belongs to.
updated_at None The date and time (ISO 8601 format) when the inventory level was last modified.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level _fivetran_synced 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level available_quantity 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels available_quantity 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[available_quantity]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • available_quantity: Directly copied to the output
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level location_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_id 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[location_id]
    • Integration This column is used as a key to join with the location table
    • Aggregation This column is used in grouping for aggregations
    • Output Columns:
      • location_id: Directly copied to the output and used in aggregations
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level updated_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels updated_at 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[updated_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • updated_at: Directly copied to the output
Column Lineage
%3 46. model.shopify_source.stg_shopify__inventory_level 46. model.shopify_source.stg_shopify__inventory_level source_relation 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels source_relation 46. model.shopify_source.stg_shopify__inventory_level:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 46. model.shopify_source.stg_shopify__inventory_level[source_relation]
    • Integration This column is used as a key to join with other tables
    • Aggregation This column is used in grouping for aggregations
    • Output Columns:
      • source_relation: Directly copied to the output and used in joins and aggregations
47. model.shopify_source.stg_shopify__inventory_level_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type, which is set to NULL. The query is limited to 0 rows, effectively creating a template or placeholder for the structure of the 'stg_shopify__inventory_level_tmp' model without containing any actual data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 47. model.shopify_source.stg_shopify__inventory_level_tmp 47. model.shopify_source.stg_shopify__inventory_level_tmp 102. source.shopify_source.shopify.inventory_level 102. source.shopify_source.shopify.inventory_level
Name Type Comment
48. model.shopify_source.stg_shopify__location

This SQL query performs a staging operation for Shopify location data. It starts by selecting all columns from a temporary table, then casts all fields to specific data types (creating null values in the process). The query then renames and reorganizes some columns, converts timezone for timestamp fields, and adds a source_relation column. This appears to be a data cleaning and standardization step in an ETL process.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__location_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS active,
    CAST(NULL AS TEXT) AS address_1,
    CAST(NULL AS TEXT) AS address_2,
    CAST(NULL AS TEXT) AS city,
    CAST(NULL AS TEXT) AS country,
    CAST(NULL AS TEXT) AS country_code,
    CAST(NULL AS TEXT) AS country_name,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS BOOLEAN) AS legacy,
    CAST(NULL AS TEXT) AS localized_country_name,
    CAST(NULL AS TEXT) AS localized_province_name,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS phone,
    CAST(NULL AS TEXT) AS province,
    CAST(NULL AS TEXT) AS province_code,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS TEXT) AS zip,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS location_id,
    name,
    _fivetran_deleted AS is_deleted,
    active AS is_active,
    address_1,
    address_2,
    city,
    country,
    country_code,
    country_name,
    legacy AS is_legacy,
    localized_country_name,
    localized_province_name,
    phone,
    province,
    province_code,
    zip,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_deleted _fivetran_synced is_active address_1 address_2 city country country_code country_name created_at location_id is_legacy localized_country_name localized_province_name name phone province province_code updated_at zip source_relation 49. model.shopify_source.stg_shopify__location_tmp 49. model.shopify_source.stg_shopify__location_tmp
Name Type Comment
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
_fivetran_synced None The time when a record was last updated by Fivetran.
is_active None Boolean representing whether the location is active. If true, then the location can be used to sell products, stock inventory, and fulfill orders.
address_1 None The location's street address.
address_2 None The optional second line of the location's street address.
city None The city the location is in.
country None The country the location is in (two-letter code).
country_code None The two-letter code (ISO 3166-1 alpha-2 format) corresponding to country the location is in.
country_name None Full name of the location's country.
created_at None The date and time (ISO 8601 format) when the location was created.
location_id None The ID of the location.
is_legacy None Boolean representing whether this is a fulfillment service location. If true, then the location is a fulfillment service location. If false, then the location was created by the merchant and isn't tied to a fulfillment service.
localized_country_name None The localized name of the location's country.
localized_province_name None The localized name of the location's region. Typically a province, state, or district.
name None The name of the location.
phone None The phone number of the location. This value can contain special characters, such as - or +.
province None The province, state, or district of the location.
province_code None The province, state, or district code (ISO 3166-2 alpha-2 format) of the location.
updated_at None The date and time (ISO 8601 format) when the location was last updated.
zip None The zip or postal code.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_deleted 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_location_deleted 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[is_deleted]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_location_deleted: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location _fivetran_synced 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_active 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_location_active 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[is_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_location_active: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location address_1 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels address_1 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[address_1]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • address_1: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location address_2 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels address_2 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[address_2]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • address_2: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location city 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels city 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[city]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • city: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location country 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels country 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[country]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • country: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location country_code 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels country_code 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[country_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location created_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_created_at 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[created_at]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • location_created_at: Directly copied
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location location_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_id 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[location_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables
    • Output Columns:
      • location_id: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location is_legacy 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_legacy_location 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[is_legacy]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_legacy_location: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location name 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_name 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • location_name: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location phone 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels phone 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[phone]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • phone: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location province 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels province 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[province]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • province: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location province_code 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels province_code 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[province_code]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • province_code: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location updated_at 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels location_updated_at 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • location_updated_at: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location zip 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels zip 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[zip]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • zip: Directly copied to the output
Column Lineage
%3 48. model.shopify_source.stg_shopify__location 48. model.shopify_source.stg_shopify__location source_relation 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels source_relation 48. model.shopify_source.stg_shopify__location:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 48. model.shopify_source.stg_shopify__location[source_relation]
    • Integration This column is used as part of the join condition to combine data from different tables
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • source_relation: Directly copied to the output column with the same name
49. model.shopify_source.stg_shopify__location_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify location data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 49. model.shopify_source.stg_shopify__location_tmp 49. model.shopify_source.stg_shopify__location_tmp 103. source.shopify_source.shopify.location 103. source.shopify_source.shopify.location
Name Type Comment
50. model.shopify_source.stg_shopify__metafield

This SQL query processes data from a staging table for Shopify metafields. It performs several operations including casting data types, cleaning and standardizing column values, creating new features, and deduplicating records. The query also converts timestamps to UTC and creates a flag for the most recent record for each metafield.

CleaningFeaturizationDeduplication
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__metafield_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS description,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS key,
    CAST(NULL AS TEXT) AS namespace,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS TEXT) AS owner_resource,
    CAST(NULL AS TEXT) AS type,
    CAST(NULL AS TEXT) AS value_type,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS TEXT) AS value,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS metafield_id,
    description,
    namespace,
    key,
    value,
    LOWER(COALESCE(type, value_type)) AS value_type,
    owner_id AS owner_resource_id,
    LOWER(owner_resource) AS owner_resource,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    LOWER(namespace || '_' || key) AS metafield_reference,
    CASE
      WHEN id IS NULL AND updated_at IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation) = 1
      ELSE ROW_NUMBER() OVER (PARTITION BY id, source_relation ORDER BY updated_at DESC) = 1
    END AS is_most_recent_record,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 50. model.shopify_source.stg_shopify__metafield 50. model.shopify_source.stg_shopify__metafield _fivetran_synced created_at description metafield_id key namespace owner_resource_id owner_resource value_type updated_at value metafield_reference is_most_recent_record source_relation 51. model.shopify_source.stg_shopify__metafield_tmp 51. model.shopify_source.stg_shopify__metafield_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
created_at None The date and time (ISO 8601 format) when the metafield was created.
description None A description of the information that the metafield contains.
metafield_id None The unique ID of the metafield.
key None The key of the metafield. Keys can be up to 64 characters long and can contain alphanumeric characters, hyphens, underscores, and periods.
namespace None A container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with other metafields with the same key name. Must have between 3-255 characters.
owner_resource_id None The unique ID of the resource that the metafield is attached to.
owner_resource None The type of resource (table) that the metafield is attached to.
value_type None The type of data that the metafield stores in the `value` field. Refer to the [list](https://shopify.dev/apps/metafields/types) of supported types. Coalescing of type and value_type
updated_at None The date and time (ISO 8601 format) when the metafield was last updated.
value None The data to store in the metafield. The value is always stored as a string, regardless of the metafield's type.
metafield_reference None Combination of the namespace and key columns. This field is key for metafield mapping in downstream models.
is_most_recent_record None Boolean indicating the most up to date record identified by the most recent updated_at field.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
51. model.shopify_source.stg_shopify__metafield_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query limits the result to 0 rows, effectively returning no data. This type of query is often used as a placeholder or template in data modeling processes, particularly in dbt (data build tool) projects.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 51. model.shopify_source.stg_shopify__metafield_tmp 51. model.shopify_source.stg_shopify__metafield_tmp 104. source.shopify_source.shopify.metafield 104. source.shopify_source.shopify.metafield
Name Type Comment
52. model.shopify_source.stg_shopify__order

This SQL query stages and transforms data from a Shopify orders table. It casts various fields to appropriate data types, renames some columns, converts timestamps to UTC, and applies some basic transformations like lowercasing email addresses. The query also filters out test orders and deleted records.

CleaningFilteringFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_tmp
), fields AS (
  SELECT
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS TIMESTAMP) AS processed_at,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS DECIMAL(28, 6)) AS user_id,
    CAST(NULL AS FLOAT) AS total_discounts,
    CAST(NULL AS TEXT) AS total_discounts_set,
    CAST(NULL AS FLOAT) AS total_line_items_price,
    CAST(NULL AS TEXT) AS total_line_items_price_set,
    CAST(NULL AS FLOAT) AS total_price,
    CAST(NULL AS TEXT) AS total_price_set,
    CAST(NULL AS TEXT) AS total_tax_set,
    CAST(NULL AS FLOAT) AS total_tax,
    CAST(NULL AS TEXT) AS source_name,
    CAST(NULL AS FLOAT) AS subtotal_price,
    CAST(NULL AS BOOLEAN) AS taxes_included,
    CAST(NULL AS DECIMAL(28, 6)) AS total_weight,
    CAST(NULL AS FLOAT) AS total_tip_received,
    CAST(NULL AS TEXT) AS landing_site_base_url,
    CAST(NULL AS DECIMAL(28, 6)) AS location_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS note,
    CAST(NULL AS DECIMAL(28, 6)) AS number,
    CAST(NULL AS DECIMAL(28, 6)) AS order_number,
    CAST(NULL AS TEXT) AS cancel_reason,
    CAST(NULL AS TIMESTAMP) AS cancelled_at,
    CAST(NULL AS TEXT) AS cart_token,
    CAST(NULL AS TEXT) AS checkout_token,
    CAST(NULL AS TIMESTAMP) AS closed_at,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS currency,
    CAST(NULL AS DECIMAL(28, 6)) AS customer_id,
    CAST(NULL AS TEXT) AS email,
    CAST(NULL AS TEXT) AS financial_status,
    CAST(NULL AS TEXT) AS fulfillment_status,
    CAST(NULL AS TEXT) AS referring_site,
    CAST(NULL AS TEXT) AS billing_address_address_1,
    CAST(NULL AS TEXT) AS billing_address_address_2,
    CAST(NULL AS TEXT) AS billing_address_city,
    CAST(NULL AS TEXT) AS billing_address_company,
    CAST(NULL AS TEXT) AS billing_address_country,
    CAST(NULL AS TEXT) AS billing_address_country_code,
    CAST(NULL AS TEXT) AS billing_address_first_name,
    CAST(NULL AS TEXT) AS billing_address_last_name,
    CAST(NULL AS TEXT) AS billing_address_latitude,
    CAST(NULL AS TEXT) AS billing_address_longitude,
    CAST(NULL AS TEXT) AS billing_address_name,
    CAST(NULL AS TEXT) AS billing_address_phone,
    CAST(NULL AS TEXT) AS billing_address_province,
    CAST(NULL AS TEXT) AS billing_address_province_code,
    CAST(NULL AS TEXT) AS billing_address_zip,
    CAST(NULL AS TEXT) AS browser_ip,
    CAST(NULL AS BOOLEAN) AS buyer_accepts_marketing,
    CAST(NULL AS TEXT) AS total_shipping_price_set,
    CAST(NULL AS TEXT) AS shipping_address_address_1,
    CAST(NULL AS TEXT) AS shipping_address_address_2,
    CAST(NULL AS TEXT) AS shipping_address_city,
    CAST(NULL AS TEXT) AS shipping_address_company,
    CAST(NULL AS TEXT) AS shipping_address_country,
    CAST(NULL AS TEXT) AS shipping_address_country_code,
    CAST(NULL AS TEXT) AS shipping_address_first_name,
    CAST(NULL AS TEXT) AS shipping_address_last_name,
    CAST(NULL AS TEXT) AS shipping_address_latitude,
    CAST(NULL AS TEXT) AS shipping_address_longitude,
    CAST(NULL AS TEXT) AS shipping_address_name,
    CAST(NULL AS TEXT) AS shipping_address_phone,
    CAST(NULL AS TEXT) AS shipping_address_province,
    CAST(NULL AS TEXT) AS shipping_address_province_code,
    CAST(NULL AS TEXT) AS shipping_address_zip,
    CAST(NULL AS BOOLEAN) AS test,
    CAST(NULL AS TEXT) AS token,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS INT) AS app_id,
    CAST(NULL AS INT) AS checkout_id,
    CAST(NULL AS TEXT) AS client_details_user_agent,
    CAST(NULL AS TEXT) AS customer_locale,
    CAST(NULL AS TEXT) AS order_status_url,
    CAST(NULL AS TEXT) AS presentment_currency,
    CAST(NULL AS BOOLEAN) AS confirmed,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS order_id,
    user_id,
    total_discounts,
    total_discounts_set,
    total_line_items_price,
    total_line_items_price_set,
    total_price,
    total_price_set,
    total_tax_set,
    total_tax,
    source_name,
    subtotal_price,
    taxes_included AS has_taxes_included,
    total_weight,
    total_tip_received,
    landing_site_base_url,
    location_id,
    name,
    note,
    number,
    order_number,
    cancel_reason,
    cart_token,
    checkout_token,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(cancelled_at AS TIMESTAMP) AS TIMESTAMP)) AS cancelled_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(closed_at AS TIMESTAMP) AS TIMESTAMP)) AS closed_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(processed_at AS TIMESTAMP) AS TIMESTAMP)) AS processed_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_timestamp,
    currency,
    customer_id,
    LOWER(email) AS email,
    financial_status,
    fulfillment_status,
    referring_site,
    billing_address_address_1,
    billing_address_address_2,
    billing_address_city,
    billing_address_company,
    billing_address_country,
    billing_address_country_code,
    billing_address_first_name,
    billing_address_last_name,
    billing_address_latitude,
    billing_address_longitude,
    billing_address_name,
    billing_address_phone,
    billing_address_province,
    billing_address_province_code,
    billing_address_zip,
    browser_ip,
    total_shipping_price_set,
    shipping_address_address_1,
    shipping_address_address_2,
    shipping_address_city,
    shipping_address_company,
    shipping_address_country,
    shipping_address_country_code,
    shipping_address_first_name,
    shipping_address_last_name,
    shipping_address_latitude,
    shipping_address_longitude,
    shipping_address_name,
    shipping_address_phone,
    shipping_address_province,
    shipping_address_province_code,
    shipping_address_zip,
    token,
    app_id,
    checkout_id,
    client_details_user_agent,
    customer_locale,
    order_status_url,
    presentment_currency,
    test AS is_test_order,
    _fivetran_deleted AS is_deleted,
    buyer_accepts_marketing AS has_buyer_accepted_marketing,
    confirmed AS is_confirmed,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
WHERE
  NOT COALESCE(is_test_order, FALSE) AND NOT COALESCE(is_deleted, FALSE)
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order _fivetran_synced app_id checkout_id order_status_url billing_address_address_1 billing_address_address_2 billing_address_city billing_address_company billing_address_country billing_address_country_code billing_address_first_name billing_address_last_name billing_address_latitude billing_address_longitude billing_address_name billing_address_phone billing_address_province billing_address_province_code billing_address_zip browser_ip has_buyer_accepted_marketing cancel_reason cancelled_timestamp cart_token closed_timestamp created_timestamp currency customer_id email financial_status fulfillment_status order_id landing_site_base_url location_id name note number order_number processed_timestamp referring_site shipping_address_address_1 shipping_address_address_2 shipping_address_city shipping_address_company shipping_address_country shipping_address_country_code shipping_address_first_name shipping_address_last_name shipping_address_latitude shipping_address_longitude shipping_address_name shipping_address_phone shipping_address_province shipping_address_province_code shipping_address_zip source_name subtotal_price has_taxes_included is_test_order token total_discounts total_line_items_price total_price total_tax total_weight updated_timestamp user_id total_shipping_price_set checkout_token customer_locale is_deleted total_tip_received client_details_user_agent total_tax_set total_discounts_set presentment_currency source_relation total_line_items_price_set total_price_set is_confirmed 69. model.shopify_source.stg_shopify__order_tmp 69. model.shopify_source.stg_shopify__order_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
app_id None The ID of the app that created the order.
checkout_id None ID of the order's checkout.
order_status_url None The URL pointing to the order status web page, if applicable.
billing_address_address_1 None The street address of the billing address.
billing_address_address_2 None An optional additional field for the street address of the billing address.
billing_address_city None The city, town, or village of the billing address.
billing_address_company None The company of the person associated with the billing address.
billing_address_country None The name of the country of the billing address.
billing_address_country_code None The two-letter code (ISO 3166-1 format) for the country of the billing address.
billing_address_first_name None The first name of the person associated with the payment method.
billing_address_last_name None The last name of the person associated with the payment method.
billing_address_latitude None The latitude of the billing address.
billing_address_longitude None The longitude of the billing address.
billing_address_name None The full name of the person associated with the payment method.
billing_address_phone None The phone number at the billing address.
billing_address_province None The name of the region (province, state, prefecture, …) of the billing address.
billing_address_province_code None The two-letter abbreviation of the region of the billing address.
billing_address_zip None The postal code (zip, postcode, Eircode, …) of the billing address.
browser_ip None The IP address of the browser used by the customer when they placed the order.
has_buyer_accepted_marketing None Whether the customer consented to receive email updates from the shop.
cancel_reason None The reason why the order was canceled.
cancelled_timestamp None The date and time when the order was canceled.
cart_token None The ID of the cart that's associated with the order.
closed_timestamp None The date and time when the order was closed (archived).
created_timestamp None The autogenerated date and time when the order was created in Shopify.
currency None The three-letter code for the shop currency.
customer_id None The ID of the order's customer.
email None The customer's email address.
financial_status None The status of payments associated with the order. Can only be set when the order is created
fulfillment_status None The order's status in terms of fulfilled line items.
order_id None The ID of the order, used for API purposes. This is different from the order_number property, which is the ID used by the shop owner and customer.
landing_site_base_url None The URL for the page where the buyer landed when they entered the shop.
location_id None The ID of the physical location where the order was processed.
name None The order name, generated by combining the order_number property with the order prefix and suffix that are set in the merchant's general settings.
note None An optional note that a shop owner can attach to the order.
number None The order's position in the shop's count of orders. Numbers are sequential and start at 1.
order_number None The order 's position in the shop's count of orders starting at 1001. Order numbers are sequential and start at 1001.
processed_timestamp None The date and time when an order was processed. This value is the date that appears on your orders and that's used in the analytic reports.
referring_site None The website where the customer clicked a link to the shop.
shipping_address_address_1 None The street address of the shipping address.
shipping_address_address_2 None An optional additional field for the street address of the shipping address.
shipping_address_city None The city, town, or village of the shipping address.
shipping_address_company None The company of the person associated with the shipping address.
shipping_address_country None The name of the country of the shipping address.
shipping_address_country_code None The two-letter code (ISO 3166-1 format) for the country of the shipping address.
shipping_address_first_name None The first name of the person associated with the shipping address.
shipping_address_last_name None The last name of the person associated with the shipping address.
shipping_address_latitude None The latitude of the shipping address.
shipping_address_longitude None The longitude of the shipping address.
shipping_address_name None The full name of the person associated with the payment method.
shipping_address_phone None The phone number at the shipping address.
shipping_address_province None The name of the region (province, state, prefecture, …) of the shipping address.
shipping_address_province_code None The two-letter abbreviation of the region of the shipping address.
shipping_address_zip None The postal code (zip, postcode, Eircode, …) of the shipping address.
source_name None Where the order originated. Can be set only during order creation, and is not writeable afterwards.
subtotal_price None The price of the order in the shop currency after discounts but before shipping, taxes, and tips.
has_taxes_included None Whether taxes are included in the order subtotal.
is_test_order None Whether this is a test order.
token None A unique token for the order.
total_discounts None The total discounts applied to the price of the order in the shop currency.
total_line_items_price None The sum of all line item prices in the shop currency.
total_price None The sum of all line item prices, discounts, shipping, taxes, and tips in the shop currency. Must be positive.
total_tax None The sum of all the taxes applied to the order in th shop currency. Must be positive).
total_weight None The sum of all line item weights in grams.
updated_timestamp None The date and time (ISO 8601 format) when the order was last modified.
user_id None The ID of the user logged into Shopify POS who processed the order, if applicable.
total_shipping_price_set None The total shipping price of the order, excluding discounts and returns, in shop and presentment currencies. If taxes_included is set to true, then total_shipping_price_set includes taxes.
checkout_token None A unique value when referencing the checkout that's associated with the order.
customer_locale None A two-letter or three-letter language code, optionally followed by a region modifier.
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
total_tip_received None The sum of all the tips in the order in the shop currency.
client_details_user_agent None Details of the browsing client, including software and operating versions.
total_tax_set None The total tax applied to the order in shop and presentment currencies.
total_discounts_set None The total discounts applied to the price of the order in shop and presentment currencies.
presentment_currency None The presentment currency that was used to display prices to the customer.
source_relation None The ID of the order placed on the originating platform. This value doesn't correspond to the Shopify ID that's generated from a completed draft.
total_line_items_price_set None The total of all line item prices in shop and presentment currencies.
total_price_set None The total price of the order in shop and presentment currencies.
is_confirmed None Whether the order is confirmed.
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order _fivetran_synced 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders _fivetran_synced 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order app_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders app_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[app_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_id: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order checkout_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders checkout_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[checkout_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • checkout_id: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_status_url 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_status_url 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_status_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • order_status_url: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_address_1 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_address_1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_address_1]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_address_1: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_address_2 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_address_2 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_address_2]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_address_2: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_city 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_city 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_city]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_city: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_company 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_company 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_company]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_company: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_country 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_country 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_country]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_country: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_country_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_country_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_country_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_country_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_first_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_first_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_first_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_first_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_last_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_last_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_last_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_last_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_latitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_latitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_latitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_latitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_longitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_longitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_longitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_longitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_phone 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_phone 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_phone]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_phone: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_province 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_province 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_province]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_province: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_province_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_province_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_province_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_province_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order billing_address_zip 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders billing_address_zip 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[billing_address_zip]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • billing_address_zip: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order browser_ip 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders browser_ip 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[browser_ip]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser_ip: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order has_buyer_accepted_marketing 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders has_buyer_accepted_marketing 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[has_buyer_accepted_marketing]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • has_buyer_accepted_marketing: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order cancel_reason 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders cancel_reason 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[cancel_reason]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cancel_reason: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order cancelled_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders cancelled_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[cancelled_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cancelled_timestamp: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order cart_token 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders cart_token 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[cart_token]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cart_token: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order closed_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders closed_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[closed_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • closed_timestamp: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order created_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders created_timestamp customer_order_seq_number 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number
    • Output Columns:
      • created_timestamp: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order currency 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders currency 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[currency]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • currency: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order customer_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_id customer_order_seq_number new_vs_repeat 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f2 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts customer_id 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_id]
    • Direct This column is directly copied without any transformation
    • Featurization Used to determine the customer order sequence number and new vs repeat customer status
    • Output Columns:
      • customer_id: Directly copied to the output
      • customer_order_seq_number: Used in window function to determine order sequence
      • new_vs_repeat: Used to determine if the order is from a new or repeat customer
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[customer_id]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in window functions to partition data
    • Output Columns:
      • customer_id: Directly copied to output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order email 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders email 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts email 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[email]
    • Integration Used to join orders with customer_calendar
    • Deduplication Part of the PARTITION BY clause in window functions
    • Output Columns:
      • email: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order financial_status 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders financial_status 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[financial_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • financial_status: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order fulfillment_status 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fulfillment_status 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[fulfillment_status]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • fulfillment_status: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_id orders_unique_key 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts order_count_in_month order_count_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_id]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for the order
    • Output Columns:
      • order_id: Directly copied
      • orders_unique_key: Used in combination with source_relation to create a unique key
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation The column is counted distinctly in the GROUP BY clause
    • Output Columns:
      • order_count_in_month: Distinct count for each month
      • order_count_lifetime: Cumulative distinct count using window function
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_id]
    • Aggregation Used in COUNT(DISTINCT orders.order_id) to calculate order_count_in_month
    • Output Columns:
      • order_count_in_month: Aggregated as count of distinct order_id
      • order_count_lifetime: Indirectly mapped through window function on order_count_in_month
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order landing_site_base_url 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders landing_site_base_url 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[landing_site_base_url]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • landing_site_base_url: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order location_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders location_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[location_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • location_id: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[name]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • name: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order note 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders note 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[note]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • note: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order number 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders number 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[number]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • number: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order order_number 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_number 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[order_number]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • order_number: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order processed_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders processed_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[processed_timestamp]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • processed_timestamp: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order referring_site 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders referring_site 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[referring_site]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • referring_site: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_address_1 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_address_1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_address_1]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_address_1: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_address_2 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_address_2 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_address_2]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_address_2: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_city 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_city 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_city]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_city: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_company 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_company 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_company]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_company: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_country 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_country 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_country]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_country: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_country_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_country_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_country_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_country_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_first_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_first_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_first_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_first_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_last_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_last_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_last_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_last_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_latitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_latitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_latitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_latitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_longitude 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_longitude 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_longitude]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_longitude: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_phone 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_phone 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_phone]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_phone: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_province 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_province 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_province]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_province: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_province_code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_province_code 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_province_code]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_province_code: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order shipping_address_zip 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_address_zip 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[shipping_address_zip]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • shipping_address_zip: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order source_name 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders source_name 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • source_name: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order subtotal_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders subtotal_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[subtotal_price]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • subtotal_price: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order has_taxes_included 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders has_taxes_included 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[has_taxes_included]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • has_taxes_included: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order is_test_order 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders is_test_order 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[is_test_order]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_test_order: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order token 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders token 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[token]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • token: Directly copied to the output
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_discounts 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_discounts 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_discounts]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_discounts: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_line_items_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_line_items_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_line_items_price]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_line_items_price: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjusted_total total_price 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f1 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f1 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts total_price_in_month total_price_lifetime 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f1
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price]
    • Direct This column is directly used in the output
    • Other Used in calculation of order_adjusted_total
    • Output Columns:
      • total_price: Directly mapped to the output column
      • order_adjusted_total: Used in calculation
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: Aggregated as the sum of order_adjusted_total for each month
      • total_price_lifetime: Further aggregated as a cumulative sum over time
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[total_price]
    • Aggregation This column is summed to calculate the total price in a month and lifetime
    • Output Columns:
      • total_price_in_month: Summed for each month
      • total_price_lifetime: Cumulative sum over time
  • Input Column: 21. model.shopify.shopify__orders[order_adjusted_total]
    • Aggregation This column is summed up in the orders_joined CTE
    • Output Columns:
      • total_price_in_month: The sum of order_adjusted_total for each month
      • total_price_lifetime: The cumulative sum of total_price_in_month
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_tax 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_tax 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_tax]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_tax: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_weight 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_weight 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_weight]
    • Direct This column is directly used in the output
    • Output Columns:
      • total_weight: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order updated_timestamp 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders updated_timestamp 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[updated_timestamp]
    • Direct This column is directly used in the output
    • Output Columns:
      • updated_timestamp: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order user_id 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders user_id 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[user_id]
    • Direct This column is directly used in the output
    • Output Columns:
      • user_id: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_shipping_price_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders shipping_cost 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_shipping_price_set]
    • Cleaning The JSON is parsed and the 'shop_money' 'amount' is extracted and cast to FLOAT
    • Output Columns:
      • shipping_cost: Transformed from total_shipping_price_set
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order checkout_token 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders checkout_token 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[checkout_token]
    • Direct This column is directly used in the output
    • Output Columns:
      • checkout_token: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order customer_locale 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders customer_locale 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[customer_locale]
    • Direct This column is directly used in the output
    • Output Columns:
      • customer_locale: Directly mapped to the output column
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order is_deleted 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders is_deleted 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[is_deleted]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • is_deleted: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_tip_received 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_tip_received 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_tip_received]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_tip_received: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order client_details_user_agent 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders client_details_user_agent 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[client_details_user_agent]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • client_details_user_agent: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_tax_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_tax_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_tax_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_tax_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_discounts_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_discounts_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_discounts_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_discounts_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order presentment_currency 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders presentment_currency 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[presentment_currency]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • presentment_currency: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order source_relation 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders orders_unique_key source_relation 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f1 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts source_relation 21. model.shopify.shopify__orders:f1->13. model.shopify.shopify__customer_email_cohorts:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 21. model.shopify.shopify__orders:f1->12. model.shopify.shopify__customer_cohorts:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used as a key to join with other tables
    • Featurization Used to create a unique key for orders
    • Output Columns:
      • source_relation: Directly copied
      • orders_unique_key: Part of the MD5 hash to create a unique key
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in creating the customer_cohort_id
    • Output Columns:
      • source_relation: Directly copied to output
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join the orders table with the customer_calendar CTE
    • Direct Directly copied to the output
    • Output Columns:
      • source_relation: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_line_items_price_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_line_items_price_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_line_items_price_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_line_items_price_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order total_price_set 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders total_price_set 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[total_price_set]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • total_price_set: Directly copied
Column Lineage
%3 52. model.shopify_source.stg_shopify__order 52. model.shopify_source.stg_shopify__order is_confirmed 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders is_confirmed 52. model.shopify_source.stg_shopify__order:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 52. model.shopify_source.stg_shopify__order[is_confirmed]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • is_confirmed: Directly copied
53. model.shopify_source.stg_shopify__order_adjustment

This SQL query creates a staging table for Shopify order adjustments. It starts with a base table that is currently empty, then defines a structure with null or empty values for all fields. The query then renames some fields, converts the _fivetran_synced timestamp to UTC, and selects all columns from the final CTE. This appears to be a placeholder structure that will be populated with actual data once order adjustments are made in Shopify.

CleaningOther
SQL Query
/* this model will be all NULL until you have made an order adjustment in Shopify */
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_adjustment_tmp
), fields AS (
  SELECT
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS DECIMAL(28, 6)) AS order_id,
    CAST(NULL AS DECIMAL(28, 6)) AS refund_id,
    CAST(NULL AS FLOAT) AS amount,
    CAST(NULL AS TEXT) AS amount_set,
    CAST(NULL AS FLOAT) AS tax_amount,
    CAST(NULL AS TEXT) AS tax_amount_set,
    CAST(NULL AS TEXT) AS kind,
    CAST(NULL AS TEXT) AS reason,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS order_adjustment_id,
    order_id,
    refund_id,
    amount,
    amount_set,
    tax_amount,
    tax_amount_set,
    kind,
    reason,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment order_adjustment_id order_id refund_id amount tax_amount kind reason amount_set tax_amount_set _fivetran_synced source_relation 54. model.shopify_source.stg_shopify__order_adjustment_tmp 54. model.shopify_source.stg_shopify__order_adjustment_tmp
Name Type Comment
order_adjustment_id None The unique numeric identifier for the order adjustment.
order_id None Reference to the order which the adjustment is associated.
refund_id None Reference to the refund which the adjustment is associated.
amount None Amount of the adjustment.
tax_amount None Tax amount applied to the order adjustment in the shop currency.
kind None The kind of order adjustment (eg. refund, restock, etc.).
reason None The reason for the order adjustment.
amount_set None Amount set towards the order adjustment in presentment and shop currencies.
tax_amount_set None Tax amount set towards the order adjustment in the shop and presentment currencies.
_fivetran_synced None The time when a record was last updated by Fivetran.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjustment_amount 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[amount]
    • Aggregation Summed up to calculate total order adjustment amount
    • Output Columns:
      • order_adjustment_amount: Aggregated sum of this column
Column Lineage
%3 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment tax_amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_adjustment_tax_amount 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[tax_amount]
    • Aggregation Summed up to calculate total order adjustment tax amount
    • Output Columns:
      • order_adjustment_tax_amount: Aggregated sum of this column
Column Lineage
%3 53. model.shopify_source.stg_shopify__order_adjustment 53. model.shopify_source.stg_shopify__order_adjustment source_relation 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders source_relation 53. model.shopify_source.stg_shopify__order_adjustment:f0->21. model.shopify.shopify__orders:f0 13. model.shopify.shopify__customer_email_cohorts 13. model.shopify.shopify__customer_email_cohorts source_relation 21. model.shopify.shopify__orders:f0->13. model.shopify.shopify__customer_email_cohorts:f0 12. model.shopify.shopify__customer_cohorts 12. model.shopify.shopify__customer_cohorts source_relation 21. model.shopify.shopify__orders:f0->12. model.shopify.shopify__customer_cohorts:f0
21. model.shopify.shopify__orders
  • Input Column: 53. model.shopify_source.stg_shopify__order_adjustment[source_relation]
    • Integration This column is used as a key to join the order_adjustments table with other tables in the query, ensuring that adjustments are correctly associated with their corresponding orders.
    • Aggregation The column is used in the GROUP BY clause of the order_adjustments_aggregates CTE, allowing for aggregation of adjustment amounts per order and source.
    • Output Columns:
      • source_relation: This column is directly copied to the output, maintaining the information about the source of each order and its associated data.
12. model.shopify.shopify__customer_cohorts
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join with customer_calendar
    • Featurization Used in creating the customer_cohort_id
    • Output Columns:
      • source_relation: Directly copied to output
13. model.shopify.shopify__customer_email_cohorts
  • Input Column: 21. model.shopify.shopify__orders[source_relation]
    • Integration Used as a key to join the orders table with the customer_calendar CTE
    • Direct Directly copied to the output
    • Output Columns:
      • source_relation: Directly copied
54. model.shopify_source.stg_shopify__order_adjustment_tmp

This SQL query creates an empty temporary staging table for Shopify order adjustments. It selects a single NULL column named '_dbt_source_relation' with a TEXT data type and limits the result to 0 rows. The comment indicates that this model will remain empty until an order adjustment is made in Shopify.

Other
SQL Query
/* this model will be all NULL until you have made an order adjustment in Shopify */
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 54. model.shopify_source.stg_shopify__order_adjustment_tmp 54. model.shopify_source.stg_shopify__order_adjustment_tmp 106. source.shopify_source.shopify.order_adjustment 106. source.shopify_source.shopify.order_adjustment
Name Type Comment
55. model.shopify_source.stg_shopify__order_discount_code

This SQL query performs data cleaning and standardization on the 'stg_shopify__order_discount_code' model. It casts various fields to specific data types, converts the '_fivetran_synced' timestamp to UTC, and uppercases the 'code' field. The query also adds a 'source_relation' field, which is set to an empty string.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_discount_code_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS FLOAT) AS amount,
    CAST(NULL AS TEXT) AS code,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS type,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    order_id,
    index,
    UPPER(code) AS code,
    type,
    amount,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code _fivetran_synced amount code order_id type source_relation index 56. model.shopify_source.stg_shopify__order_discount_code_tmp 56. model.shopify_source.stg_shopify__order_discount_code_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
amount None The amount that's deducted from the order total.
code None This property returns the discount code that was entered at checkout. Otherwise this property returns the title of the discount that was applied.
order_id None Associated order ID.
type None The type of discount - `fixed_amount`, `percentage`, or `shipping`.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
index None Pairs with `order_id` to provide unique identifier for order discount code.
Column Lineage
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code amount 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders fixed_amount_discount_amount percentage_calc_discount_amount shipping_discount_amount 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f2 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f1 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 55. model.shopify_source.stg_shopify__order_discount_code[amount]
    • Aggregation The amount is summed up based on the discount type
    • Output Columns:
      • shipping_discount_amount: Summed when type is 'shipping'
      • percentage_calc_discount_amount: Summed when type is 'percentage'
      • fixed_amount_discount_amount: Summed when type is 'fixed_amount'
Column Lineage
%3 55. model.shopify_source.stg_shopify__order_discount_code 55. model.shopify_source.stg_shopify__order_discount_code code 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders count_discount_codes_applied 55. model.shopify_source.stg_shopify__order_discount_code:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 55. model.shopify_source.stg_shopify__order_discount_code[code]
    • Aggregation Distinct codes are counted
    • Output Columns:
      • count_discount_codes_applied: Count of distinct discount codes
56. model.shopify_source.stg_shopify__order_discount_code_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It doesn't retrieve any actual data and is likely used as a placeholder or template for further development.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 56. model.shopify_source.stg_shopify__order_discount_code_tmp 56. model.shopify_source.stg_shopify__order_discount_code_tmp 107. source.shopify_source.shopify.order_discount_code 107. source.shopify_source.shopify.order_discount_code
Name Type Comment
57. model.shopify_source.stg_shopify__order_line

This SQL query performs a staging operation for Shopify order line data. It starts by selecting all columns from a temporary table, then casts them to specific data types in the 'fields' CTE. The 'final' CTE renames some columns, applies minor transformations (like converting boolean fields to 'is_' prefixed columns), and converts the '_fivetran_synced' timestamp to UTC. The query ultimately selects all columns from the 'final' CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS DECIMAL(28, 6)) AS fulfillable_quantity,
    CAST(NULL AS TEXT) AS fulfillment_status,
    CAST(NULL AS BOOLEAN) AS gift_card,
    CAST(NULL AS DECIMAL(28, 6)) AS grams,
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS DECIMAL(28, 6)) AS index,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS DECIMAL(28, 6)) AS order_id,
    CAST(NULL AS FLOAT) AS pre_tax_price,
    CAST(NULL AS TEXT) AS pre_tax_price_set,
    CAST(NULL AS FLOAT) AS price,
    CAST(NULL AS TEXT) AS price_set,
    CAST(NULL AS DECIMAL(28, 6)) AS product_id,
    CAST(NULL AS DECIMAL(28, 6)) AS quantity,
    CAST(NULL AS BOOLEAN) AS requires_shipping,
    CAST(NULL AS TEXT) AS sku,
    CAST(NULL AS BOOLEAN) AS taxable,
    CAST(NULL AS TEXT) AS tax_code,
    CAST(NULL AS TEXT) AS title,
    CAST(NULL AS FLOAT) AS total_discount,
    CAST(NULL AS TEXT) AS total_discount_set,
    CAST(NULL AS DECIMAL(28, 6)) AS variant_id,
    CAST(NULL AS TEXT) AS variant_title,
    CAST(NULL AS TEXT) AS variant_inventory_management,
    CAST(NULL AS TEXT) AS vendor,
    CAST(NULL AS TEXT) AS properties,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS order_line_id,
    index,
    name,
    order_id,
    fulfillable_quantity,
    fulfillment_status,
    gift_card AS is_gift_card,
    grams,
    pre_tax_price,
    pre_tax_price_set,
    price,
    price_set,
    product_id,
    quantity,
    requires_shipping AS is_shipping_required,
    sku,
    taxable AS is_taxable,
    tax_code,
    title,
    total_discount,
    total_discount_set,
    variant_id,
    variant_title,
    variant_inventory_management,
    vendor,
    properties,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line _fivetran_synced fulfillable_quantity fulfillment_status is_gift_card grams order_line_id name order_id price product_id quantity is_shipping_required sku is_taxable title total_discount variant_id vendor source_relation index pre_tax_price pre_tax_price_set price_set tax_code total_discount_set variant_title variant_inventory_management properties 60. model.shopify_source.stg_shopify__order_line_tmp 60. model.shopify_source.stg_shopify__order_line_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
fulfillable_quantity None The amount available to fulfill, calculated as follows: quantity - max(refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity - open_fulfilled_quantity
fulfillment_status None How far along an order is in terms line items fulfilled.
is_gift_card None Whether the item is a gift card. If true, then the item is not taxed or considered for shipping charges.
grams None The weight of the item in grams.
order_line_id None The ID of the line item.
name None The name of the product variant.
order_id None The ID of the related order.
price None The price of the item before discounts have been applied in the shop currency.
product_id None The ID of the product that the line item belongs to. Can be null if the original product associated with the order is deleted at a later date.
quantity None The number of items that were purchased.
is_shipping_required None Whether the item requires shipping.
sku None The item's SKU (stock keeping unit).
is_taxable None Whether the item was taxable.
title None The title of the product.
total_discount None The total amount of the discount allocated to the line item in the shop currency.
variant_id None The ID of the product variant.
vendor None The name of the item's supplier.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
index None Index of the order line.
pre_tax_price None The pre tax price of the line item in shop currency.
pre_tax_price_set None The pre tax price of the line item in shop currency and presentment currency.
price_set None The price of the line item in shop and presentment currencies.
tax_code None Tax code applied to the line item. As multiple taxes can apply to a line item, we recommend referring to `stg_shopify__tax_line`.
total_discount_set None The total amount allocated to the line item in the presentment currency.
variant_title None The title of the product variant.
variant_inventory_management None The fulfillment service that tracks the number of items in stock for the product variant.
properties None Line item properties.
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line _fivetran_synced 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines _fivetran_synced 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line fulfillable_quantity 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines fulfillable_quantity 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[fulfillable_quantity]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • fulfillable_quantity: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line fulfillment_status 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines fulfillment_status 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[fulfillment_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • fulfillment_status: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line is_gift_card 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines is_gift_card 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[is_gift_card]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_gift_card: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line grams 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines grams 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[grams]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • grams: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line order_line_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_line_id order_lines_unique_key 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[order_line_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as a key to join with other tables (refunds_aggregated, tax_lines_aggregated)
    • Featurization Used to create a unique key for the order line
    • Output Columns:
      • order_line_id: Directly copied to the output
      • order_lines_unique_key: Part of the MD5 hash to create a unique key
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line name 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines name 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • name: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line order_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_id 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[order_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • order_id: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines price 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[price]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • price: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line product_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines product_id 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[product_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • product_id: Directly copied to the output
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line quantity 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines quantity quantity_net_refunds 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[quantity]
    • Direct This column is directly copied to the output
    • Other It's used in calculations for 'quantity_net_refunds'
    • Output Columns:
      • quantity: Directly copied
      • quantity_net_refunds: Used in calculation (quantity - COALESCE(refunds_aggregated.quantity, 0))
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line is_shipping_required 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines is_shipping_required 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[is_shipping_required]
    • Direct This column is directly copied to the output
    • Output Columns:
      • is_shipping_required: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line sku 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines sku 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[sku]
    • Direct This column is directly copied to the output
    • Output Columns:
      • sku: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line is_taxable 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines is_taxable 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[is_taxable]
    • Direct This column is directly copied to the output
    • Output Columns:
      • is_taxable: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line title 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines title 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[title]
    • Direct This column is directly copied to the output
    • Output Columns:
      • title: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line total_discount 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines total_discount 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[total_discount]
    • Direct This column is directly copied to the output
    • Output Columns:
      • total_discount: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line variant_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_id 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[variant_id]
    • Direct This column is directly copied to the output
    • Integration Used to join with product_variants table
    • Output Columns:
      • variant_id: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line vendor 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines vendor 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[vendor]
    • Direct This column is directly copied to the output
    • Output Columns:
      • vendor: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line source_relation 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_lines_unique_key source_relation 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[source_relation]
    • Direct This column is directly copied to the output
    • Integration Used in joins with refunds_aggregated, product_variants, and tax_lines_aggregated
    • Other Used in creating the unique key 'order_lines_unique_key'
    • Output Columns:
      • source_relation: Directly copied
      • order_lines_unique_key: Used in MD5 hash calculation
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line index 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines index 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[index]
    • Direct This column is directly copied to the output
    • Output Columns:
      • index: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line pre_tax_price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines pre_tax_price subtotal_net_refunds 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f1
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[pre_tax_price]
    • Direct The column is directly used in calculations
    • Other Used in calculating 'subtotal_net_refunds'
    • Output Columns:
      • pre_tax_price: Directly copied
      • subtotal_net_refunds: Used in calculation (pre_tax_price - COALESCE(refunds_aggregated.subtotal, 0))
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line pre_tax_price_set 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines pre_tax_price_set 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[pre_tax_price_set]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • pre_tax_price_set: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line price_set 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines price_set 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[price_set]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • price_set: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line tax_code 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines tax_code 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[tax_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • tax_code: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line total_discount_set 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines total_discount_set 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[total_discount_set]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • total_discount_set: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line variant_title 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_title 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[variant_title]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_title: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line variant_inventory_management 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_inventory_management 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[variant_inventory_management]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_inventory_management: Directly copied
Column Lineage
%3 57. model.shopify_source.stg_shopify__order_line 57. model.shopify_source.stg_shopify__order_line properties 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines properties 57. model.shopify_source.stg_shopify__order_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 57. model.shopify_source.stg_shopify__order_line[properties]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • properties: Directly copied
58. model.shopify_source.stg_shopify__order_line_refund

This SQL query creates a staging table for Shopify order line refunds. It starts with a base table, then defines a fields CTE that casts all columns to specific data types with NULL values. The final CTE renames some columns and converts the _fivetran_synced timestamp to UTC. The query is designed to create a structure for order line refund data, even when no actual refunds have been made yet in Shopify.

CleaningOther
SQL Query
/* this model will be all NULL until you have made an order line refund in Shopify */
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_line_refund_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS DECIMAL(28, 6)) AS location_id,
    CAST(NULL AS DECIMAL(28, 6)) AS order_line_id,
    CAST(NULL AS DECIMAL(28, 6)) AS subtotal,
    CAST(NULL AS TEXT) AS subtotal_set,
    CAST(NULL AS DECIMAL(28, 6)) AS total_tax,
    CAST(NULL AS TEXT) AS total_tax_set,
    CAST(NULL AS FLOAT) AS quantity,
    CAST(NULL AS DECIMAL(28, 6)) AS refund_id,
    CAST(NULL AS TEXT) AS restock_type,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS order_line_refund_id,
    location_id,
    order_line_id,
    subtotal,
    subtotal_set,
    total_tax,
    total_tax_set,
    quantity,
    refund_id,
    restock_type,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 58. model.shopify_source.stg_shopify__order_line_refund 58. model.shopify_source.stg_shopify__order_line_refund _fivetran_synced order_line_refund_id location_id order_line_id quantity refund_id restock_type subtotal total_tax source_relation subtotal_set total_tax_set 59. model.shopify_source.stg_shopify__order_line_refund_tmp 59. model.shopify_source.stg_shopify__order_line_refund_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
order_line_refund_id None The unique identifier of the line item in the refund.
location_id None TThe unique identifier of the location where the items will be restockedBD
order_line_id None The ID of the related line item in the order.
quantity None The quantity of the associated line item that was returned.
refund_id None The ID of the related refund.
restock_type None How this refund line item affects inventory levels.
subtotal None Subtotal amount of the order line refund in shop currency.
total_tax None The total tax applied to the refund in the shop currency.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
subtotal_set None The subtotal of the refund line item in shop and presentment currencies.
total_tax_set None The total tax of the line item in shop and presentment currencies.
59. model.shopify_source.stg_shopify__order_line_refund_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. The query is designed to return no rows (LIMIT 0) and is likely used as a placeholder or template for future data when order line refunds are made in Shopify.

Other
SQL Query
/* this model will be all NULL until you have made an order line refund in Shopify */
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 59. model.shopify_source.stg_shopify__order_line_refund_tmp 59. model.shopify_source.stg_shopify__order_line_refund_tmp 109. source.shopify_source.shopify.order_line_refund 109. source.shopify_source.shopify.order_line_refund
Name Type Comment
60. model.shopify_source.stg_shopify__order_line_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) project, specifically for staging Shopify order line data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 60. model.shopify_source.stg_shopify__order_line_tmp 60. model.shopify_source.stg_shopify__order_line_tmp 108. source.shopify_source.shopify.order_line 108. source.shopify_source.shopify.order_line
Name Type Comment
61. model.shopify_source.stg_shopify__order_note_attribute

This SQL query creates a staging table for Shopify order note attributes. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a fields CTE that casts specific columns to desired data types and adds a source_relation column. Finally, it creates a final CTE that selects and formats the columns, including converting the _fivetran_synced timestamp to UTC. The query then selects all columns from the final CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_note_attribute_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS value,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    order_id,
    name,
    value,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 61. model.shopify_source.stg_shopify__order_note_attribute 61. model.shopify_source.stg_shopify__order_note_attribute _fivetran_synced name order_id value source_relation 62. model.shopify_source.stg_shopify__order_note_attribute_tmp 62. model.shopify_source.stg_shopify__order_note_attribute_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
name None Name of the attribute.
order_id None ID referencing the order the note attribute belongs to.
value None Value of the attribute.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
62. model.shopify_source.stg_shopify__order_note_attribute_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The LIMIT 0 ensures no rows are returned. This is likely used as a placeholder or template for a staging table in a dbt (data build tool) project.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 62. model.shopify_source.stg_shopify__order_note_attribute_tmp 62. model.shopify_source.stg_shopify__order_note_attribute_tmp 110. source.shopify_source.shopify.order_note_attribute 110. source.shopify_source.shopify.order_note_attribute
Name Type Comment
63. model.shopify_source.stg_shopify__order_shipping_line

This SQL query performs a staged transformation of Shopify order shipping line data. It starts by selecting all columns from a temporary staging table, then casts these columns to specific data types in the 'fields' CTE. The 'final' CTE renames some columns, creates a boolean field 'is_third_party_required' based on the 'requested_fulfillment_service_id' column, and converts the '_fivetran_synced' timestamp to UTC. The query primarily focuses on cleaning and structuring the data for further use.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_shipping_line_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS carrier_identifier,
    CAST(NULL AS TEXT) AS code,
    CAST(NULL AS TEXT) AS delivery_category,
    CAST(NULL AS FLOAT) AS discounted_price,
    CAST(NULL AS TEXT) AS discounted_price_set,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS phone,
    CAST(NULL AS FLOAT) AS price,
    CAST(NULL AS TEXT) AS price_set,
    CAST(NULL AS TEXT) AS requested_fulfillment_service_id,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS title,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS order_shipping_line_id,
    order_id,
    carrier_identifier,
    code,
    delivery_category,
    discounted_price,
    discounted_price_set,
    phone,
    price,
    price_set,
    NOT requested_fulfillment_service_id IS NULL AS is_third_party_required,
    source,
    title,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 63. model.shopify_source.stg_shopify__order_shipping_line 63. model.shopify_source.stg_shopify__order_shipping_line _fivetran_synced carrier_identifier code delivery_category discounted_price discounted_price_set order_shipping_line_id order_id phone price price_set is_third_party_required source title source_relation 64. model.shopify_source.stg_shopify__order_shipping_line_tmp 64. model.shopify_source.stg_shopify__order_shipping_line_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
carrier_identifier None A reference to the carrier service that provided the rate. Present when the rate was computed by a third-party carrier service.
code None A reference to the shipping method.
delivery_category None The general classification of the delivery method.
discounted_price None The pre-tax shipping price with discounts applied in shop currency.
discounted_price_set None The pre-tax shipping price with discounts applied (JSON) in presentment and shop currencies.
order_shipping_line_id None A globally-unique identifier.
order_id None ID of the associated order.
phone None The phone number at the shipping address.
price None Returns the price of the shipping line in shop currency.
price_set None Returns the price of the shipping line (JSON) in shop and presentment currencies.
is_third_party_required None The fulfillment service requested for the shipping method. Present if the shipping method requires processing by a third party fulfillment service.
source None Returns the rate source for the shipping line.
title None Returns the title of the shipping line.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
64. model.shopify_source.stg_shopify__order_shipping_line_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query is limited to 0 rows, effectively creating a template or placeholder for the structure of the 'stg_shopify__order_shipping_line_tmp' model without actually returning any data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 64. model.shopify_source.stg_shopify__order_shipping_line_tmp 64. model.shopify_source.stg_shopify__order_shipping_line_tmp 111. source.shopify_source.shopify.order_shipping_line 111. source.shopify_source.shopify.order_shipping_line
Name Type Comment
65. model.shopify_source.stg_shopify__order_shipping_tax_line

This SQL query creates a staging table for Shopify order shipping tax line data. It starts with a base table, then defines a fields CTE that sets up the structure with NULL or empty values for each column. The final CTE selects these fields, converting the _fivetran_synced timestamp to UTC. The main purpose appears to be setting up a consistent structure for this data, possibly as part of a larger ETL process.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_shipping_tax_line_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS INT) AS order_shipping_line_id,
    CAST(NULL AS FLOAT) AS price,
    CAST(NULL AS TEXT) AS price_set,
    CAST(NULL AS FLOAT) AS rate,
    CAST(NULL AS TEXT) AS title,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    order_shipping_line_id,
    index,
    price,
    price_set,
    rate,
    title,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 65. model.shopify_source.stg_shopify__order_shipping_tax_line 65. model.shopify_source.stg_shopify__order_shipping_tax_line _fivetran_synced index order_shipping_line_id price price_set rate title source_relation 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
index None Index (from 1) representing the order of shipping lines per order.
order_shipping_line_id None ID of the order shipping line this record is associated with.
price None The amount of tax, in shop currency, after discounts and before returns.
price_set None The amount of tax, in shop and presentment currencies, after discounts and before returns (JSON).
rate None The proportion of the line item price that the tax represents as a decimal.
title None The name of the tax.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify order shipping tax line data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp 66. model.shopify_source.stg_shopify__order_shipping_tax_line_tmp 112. source.shopify_source.shopify.order_shipping_tax_line 112. source.shopify_source.shopify.order_shipping_tax_line
Name Type Comment
67. model.shopify_source.stg_shopify__order_tag

This SQL query creates a staging table for Shopify order tags. It starts with a base table, then defines the structure of the fields with appropriate data types. The final step converts the _fivetran_synced timestamp to UTC. The query doesn't perform any filtering, deduplication, or aggregation, but it does some basic data type casting and timezone conversion.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_tag_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS value,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    order_id,
    index,
    value,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 67. model.shopify_source.stg_shopify__order_tag 67. model.shopify_source.stg_shopify__order_tag _fivetran_synced index order_id value source_relation 68. model.shopify_source.stg_shopify__order_tag_tmp 68. model.shopify_source.stg_shopify__order_tag_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
index None Index (starting from 1) representing when the tag was placed on the order.
order_id None ID of the order being tagged.
value None Value of the tag.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 67. model.shopify_source.stg_shopify__order_tag 67. model.shopify_source.stg_shopify__order_tag value 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_tags 67. model.shopify_source.stg_shopify__order_tag:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 67. model.shopify_source.stg_shopify__order_tag[value]
    • Aggregation Used in the LISTAGG function to concatenate all distinct tag values
    • Output Columns:
      • order_tags: Transformed and aggregated into this output column
68. model.shopify_source.stg_shopify__order_tag_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify order tag data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 68. model.shopify_source.stg_shopify__order_tag_tmp 68. model.shopify_source.stg_shopify__order_tag_tmp 113. source.shopify_source.shopify.order_tag 113. source.shopify_source.shopify.order_tag
Name Type Comment
69. model.shopify_source.stg_shopify__order_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) project, specifically for a staging model related to Shopify orders.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 69. model.shopify_source.stg_shopify__order_tmp 69. model.shopify_source.stg_shopify__order_tmp 105. source.shopify_source.shopify.order 105. source.shopify_source.shopify.order
Name Type Comment
70. model.shopify_source.stg_shopify__order_url_tag

This SQL query creates a staging table for Shopify order URL tags. It starts with a base table, then defines a fields structure with specific data types for each column. The final step converts the '_fivetran_synced' timestamp to UTC timezone. The query primarily focuses on data type casting and minimal transformation.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__order_url_tag_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS key,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS value,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    order_id,
    key,
    value,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 70. model.shopify_source.stg_shopify__order_url_tag 70. model.shopify_source.stg_shopify__order_url_tag _fivetran_synced key order_id value source_relation 71. model.shopify_source.stg_shopify__order_url_tag_tmp 71. model.shopify_source.stg_shopify__order_url_tag_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
key None Key of the tag pair.
order_id None ID of the order url being tagged.
value None Value of the tag.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 70. model.shopify_source.stg_shopify__order_url_tag 70. model.shopify_source.stg_shopify__order_url_tag value 21. model.shopify.shopify__orders 21. model.shopify.shopify__orders order_url_tags 70. model.shopify_source.stg_shopify__order_url_tag:f0->21. model.shopify.shopify__orders:f0
21. model.shopify.shopify__orders
  • Input Column: 70. model.shopify_source.stg_shopify__order_url_tag[value]
    • Aggregation Used in LISTAGG function to concatenate distinct values
    • Output Columns:
      • order_url_tags: Aggregated into this output column
71. model.shopify_source.stg_shopify__order_url_tag_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further development or as a temporary staging table in a data pipeline.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 71. model.shopify_source.stg_shopify__order_url_tag_tmp 71. model.shopify_source.stg_shopify__order_url_tag_tmp 114. source.shopify_source.shopify.order_url_tag 114. source.shopify_source.shopify.order_url_tag
Name Type Comment
72. model.shopify_source.stg_shopify__price_rule

This SQL query stages data from a Shopify price rule source table. It casts fields to appropriate data types, renames some columns for clarity, and converts timestamp fields to UTC. The query also adds a source_relation field and selects all columns from the transformed data.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__price_rule_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS allocation_limit,
    CAST(NULL AS TEXT) AS allocation_method,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS customer_selection,
    CAST(NULL AS TIMESTAMP) AS ends_at,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS BOOLEAN) AS once_per_customer,
    CAST(NULL AS FLOAT) AS prerequisite_quantity_range,
    CAST(NULL AS FLOAT) AS prerequisite_shipping_price_range,
    CAST(NULL AS FLOAT) AS prerequisite_subtotal_range,
    CAST(NULL AS FLOAT) AS prerequisite_to_entitlement_purchase_prerequisite_amount,
    CAST(NULL AS INT) AS quantity_ratio_entitled_quantity,
    CAST(NULL AS INT) AS quantity_ratio_prerequisite_quantity,
    CAST(NULL AS TIMESTAMP) AS starts_at,
    CAST(NULL AS TEXT) AS target_selection,
    CAST(NULL AS TEXT) AS target_type,
    CAST(NULL AS TEXT) AS title,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS INT) AS usage_limit,
    CAST(NULL AS FLOAT) AS value,
    CAST(NULL AS TEXT) AS value_type,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS price_rule_id,
    allocation_limit,
    allocation_method,
    customer_selection,
    once_per_customer AS is_once_per_customer,
    prerequisite_quantity_range AS prereq_min_quantity,
    prerequisite_shipping_price_range AS prereq_max_shipping_price,
    prerequisite_subtotal_range AS prereq_min_subtotal,
    prerequisite_to_entitlement_purchase_prerequisite_amount AS prereq_min_purchase_quantity_for_entitlement,
    quantity_ratio_entitled_quantity AS prereq_buy_x_get_this,
    quantity_ratio_prerequisite_quantity AS prereq_buy_this_get_y,
    target_selection,
    target_type,
    title,
    usage_limit,
    value,
    value_type,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(starts_at AS TIMESTAMP) AS TIMESTAMP)) AS starts_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(ends_at AS TIMESTAMP) AS TIMESTAMP)) AS ends_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule _fivetran_synced allocation_limit allocation_method created_at customer_selection ends_at price_rule_id is_once_per_customer prereq_min_quantity prereq_max_shipping_price prereq_min_subtotal prereq_min_purchase_quantity_for_entitlement prereq_buy_x_get_this prereq_buy_this_get_y starts_at target_selection target_type title updated_at usage_limit value value_type source_relation 73. model.shopify_source.stg_shopify__price_rule_tmp 73. model.shopify_source.stg_shopify__price_rule_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
allocation_limit None The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the allocation_limit is 3. Empty (null) allocation_limit means unlimited number of allocations.
allocation_method None The allocation method of the price rule. Valid values include `each` (the discount is applied to each of the entitled items. For example, for a price rule that takes $15 off, each entitled line item in a checkout will be discounted by $15) and `across` (the calculated discount amount will be applied across the entitled items. For example, for a price rule that takes $15 off, the discount will be applied across all the entitled items).
created_at None The date and time (ISO 8601 format) when the price rule was created.
customer_selection None The customer selection for the price rule. Valid values include `all` (the price rule is valid for all customers) and `prerequisite` (the customer must either belong to one of the customer segments specified by customer_segment_prerequisite_ids, or be one of the customers specified by prerequisite_customer_ids).
ends_at None The date and time (ISO 8601 format) when the price rule ends. Must be after starts_at.
price_rule_id None The ID for the price rule.
is_once_per_customer None Boolean representing whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID.
prereq_min_quantity None If `customer_selection` is `prerequisite`, the minimum number of items for the price rule to be applicable. The quantity of an entitled cart item must be greater than or equal to this value.
prereq_max_shipping_price None If `customer_selection` is `prerequisite`, the maximum shipping price for the price rule to be applicable. The shipping price must be less than or equal to this value
prereq_min_subtotal None If `customer_selection` is `prerequisite`, the minimum subtotal for the price rule to be applicable. The subtotal of the entitled cart items must be greater than or equal to this value for the discount to apply.
prereq_min_purchase_quantity_for_entitlement None If `customer_selection` is `prerequisite`, the prerequisite purchase for a Buy X Get Y discount. The minimum purchase amount required to be entitled to the discount.
prereq_buy_x_get_this None If `customer_selection` is `prerequisite`, in a Buy/Get ratio for a Buy X Get Y discount, this is the offered 'get' quantity.
prereq_buy_this_get_y None If `customer_selection` is `prerequisite`, in a Buy/Get ratio for a Buy X Get Y discount, this defines the necessary 'buy' quantity.
starts_at None The date and time (ISO 8601 format) when the price rule starts.
target_selection None The target selection method of the price rule. Valid values include `all` (the price rule applies the discount to all line items in the checkout) and `entitled` (the price rule applies the discount to selected entitlements only).
target_type None The target type that the price rule applies to. Valid values include `line_item` (the price rule applies to the cart's line items) and `shipping_line` (the price rule applies to the cart's shipping lines).
title None The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. Shopify recommends that this map onto the associated `discount_code.code`.
updated_at None The date and time (ISO 8601 format) when the price rule was updated.
usage_limit None The maximum number of times the price rule can be used, per discount code.
value None The value of the price rule. If if the value of `target_type` is `shipping_line`, then only -100 is accepted. The value must be negative.
value_type None The value type of the price rule. Valid values include `fixed_amount` (applies a discount of value as a unit of the store's currency. For example, if value is -30 and the store's currency is USD, then $30 USD is deducted when the discount is applied) and `percentage` (applies a percentage discount of value. For example, if value is -30, then 30% will be deducted when the discount is applied). If `target_type` is `shipping_line`, then only `percentage` is accepted.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule allocation_limit 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts allocation_limit 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[allocation_limit]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • allocation_limit: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule allocation_method 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts allocation_method 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[allocation_method]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • allocation_method: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule created_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts price_rule_created_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[created_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • price_rule_created_at: Directly copied to the output with a renamed column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule customer_selection 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts customer_selection 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[customer_selection]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • customer_selection: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule ends_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts ends_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[ends_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • ends_at: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule is_once_per_customer 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts is_once_per_customer 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[is_once_per_customer]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_once_per_customer: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_min_quantity 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_min_quantity 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_min_quantity]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • prereq_min_quantity: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_max_shipping_price 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_max_shipping_price 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_max_shipping_price]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • prereq_max_shipping_price: Directly copied to the output
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_min_subtotal 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_min_subtotal 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_min_subtotal]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_min_subtotal: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_min_purchase_quantity_for_entitlement 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_min_purchase_quantity_for_entitlement 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_min_purchase_quantity_for_entitlement]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_min_purchase_quantity_for_entitlement: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_buy_x_get_this 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_buy_x_get_this 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_buy_x_get_this]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_buy_x_get_this: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule prereq_buy_this_get_y 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts prereq_buy_this_get_y 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[prereq_buy_this_get_y]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • prereq_buy_this_get_y: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule starts_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts starts_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[starts_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • starts_at: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule target_selection 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts target_selection 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[target_selection]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • target_selection: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule target_type 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts target_type 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[target_type]
    • Direct This column is directly copied without any transformation
    • Other Used in a CASE statement to determine the discount type for joining with aggregated data
    • Output Columns:
      • target_type: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule title 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts title 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[title]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • title: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule updated_at 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts price_rule_updated_at 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[updated_at]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is renamed to 'price_rule_updated_at' for clarity
    • Output Columns:
      • price_rule_updated_at: Mapped after being renamed
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule usage_limit 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts usage_limit 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[usage_limit]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • usage_limit: Directly mapped to the output column
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule value 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts value 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • value: It is directly mapped to the output column 'value'
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule value_type 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts value_type 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[value_type]
    • Direct The column is directly copied without any transformation
    • Other Used in a CASE statement to determine the type of discount for joining with aggregated data
    • Output Columns:
      • value_type: It is directly mapped to the output column 'value_type'
Column Lineage
%3 72. model.shopify_source.stg_shopify__price_rule 72. model.shopify_source.stg_shopify__price_rule source_relation 18. model.shopify.shopify__discounts 18. model.shopify.shopify__discounts source_relation 72. model.shopify_source.stg_shopify__price_rule:f0->18. model.shopify.shopify__discounts:f0
18. model.shopify.shopify__discounts
  • Input Column: 72. model.shopify_source.stg_shopify__price_rule[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join tables and ensure data from the same source is combined
    • Output Columns:
      • source_relation: It is directly mapped to the output column 'source_relation'
73. model.shopify_source.stg_shopify__price_rule_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type, initialized as NULL. The LIMIT 0 clause ensures no rows are returned. This query appears to be a placeholder or template, possibly used for schema definition or testing purposes in a dbt (data build tool) project.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 73. model.shopify_source.stg_shopify__price_rule_tmp 73. model.shopify_source.stg_shopify__price_rule_tmp 115. source.shopify_source.shopify.price_rule 115. source.shopify_source.shopify.price_rule
Name Type Comment
74. model.shopify_source.stg_shopify__product

This SQL query performs data transformation and cleaning on a Shopify product staging table. It casts various fields to specific data types, renames some columns, and converts timestamp fields to UTC timezone. The query also adds a 'source_relation' field and an 'is_deleted' flag based on the '_fivetran_deleted' column.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS handle,
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS TEXT) AS product_type,
    CAST(NULL AS TIMESTAMP) AS published_at,
    CAST(NULL AS TEXT) AS published_scope,
    CAST(NULL AS TEXT) AS title,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS TEXT) AS vendor,
    CAST(NULL AS TEXT) AS status,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS product_id,
    handle,
    product_type,
    published_scope,
    title,
    vendor,
    status,
    _fivetran_deleted AS is_deleted,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(published_at AS TIMESTAMP) AS TIMESTAMP)) AS published_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product is_deleted _fivetran_synced created_timestamp handle product_id product_type published_timestamp published_scope title updated_timestamp vendor source_relation status 79. model.shopify_source.stg_shopify__product_tmp 79. model.shopify_source.stg_shopify__product_tmp
Name Type Comment
is_deleted None Whether the record has been deleted in the source system.
_fivetran_synced None The time when a record was last updated by Fivetran.
created_timestamp None The date and time when the product was created.
handle None A unique human-friendly string for the product. Automatically generated from the product's title.
product_id None An unsigned 64-bit integer that's used as a unique identifier for the product. Each id is unique across the Shopify system. No two products will have the same id, even if they're from different shops.
product_type None A categorization for the product used for filtering and searching products.
published_timestamp None The date and time (ISO 8601 format) when the product was published. Can be set to null to unpublish the product from the Online Store channel.
published_scope None Whether the product is published to the Point of Sale channel.
title None The name of the product.
updated_timestamp None The date and time when the product was last modified.
vendor None The name of the product's vendor.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
status None The status of the product. Valid values: - active: The product is ready to sell and is available to customers on the online store, sales channels, and apps. By default, existing products are set to active. - archived: The product is no longer being sold and isn't available to customers on sales channels and apps. - draft: The product isn't ready to sell and is unavailable to customers on sales channels and apps. By default, duplicated and unarchived products are set to draft.
Column Lineage
%3 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product _fivetran_synced 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 74. model.shopify_source.stg_shopify__product[_fivetran_synced]
    • Direct This column is likely directly copied to the output for tracking the last sync time
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product product_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels product_id 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 74. model.shopify_source.stg_shopify__product[product_id]
    • Integration This column is used to join with other tables, particularly the product_variant table
    • Output Columns:
      • product_id: Directly copied
Column Lineage
%3 74. model.shopify_source.stg_shopify__product 74. model.shopify_source.stg_shopify__product source_relation 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels source_relation 74. model.shopify_source.stg_shopify__product:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 74. model.shopify_source.stg_shopify__product[source_relation]
    • Integration This column is used as a key to join tables and ensure data from the same source is combined correctly.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • source_relation: Directly copied to the output
75. model.shopify_source.stg_shopify__product_image

This SQL query processes data from a staging table for Shopify product images. It casts various fields to specific data types, renames some columns, converts timestamp fields to UTC, and filters out deleted records. The query also adds a source_relation field and restructures the data for further use.

CleaningFiltering
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_image_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS INT) AS height,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS position,
    CAST(NULL AS INT) AS product_id,
    CAST(NULL AS TEXT) AS src,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS TEXT) AS variant_ids,
    CAST(NULL AS INT) AS width,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS product_image_id,
    product_id,
    height,
    position,
    src,
    variant_ids,
    width,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
  WHERE
    NOT COALESCE(_fivetran_deleted, FALSE)
)
SELECT
  *
FROM final
%3 75. model.shopify_source.stg_shopify__product_image 75. model.shopify_source.stg_shopify__product_image _fivetran_synced created_at height product_image_id position product_id src updated_at variant_ids width source_relation 76. model.shopify_source.stg_shopify__product_image_tmp 76. model.shopify_source.stg_shopify__product_image_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
created_at None The date and time when the product image was created. The API returns this value in ISO 8601 format.
height None Height dimension of the image which is determined on upload.
product_image_id None Unique numeric identifier of the product image.
position None The order of the product image in the list. The first product image is at position 1 and is the "main" image for the product.
product_id None The id of the product associated with the image.
src None Specifies the location of the product image. This parameter supports URL filters that you can use to retrieve modified copies of the image.
updated_at None The date and time when the product image was last modified. The API returns this value in ISO 8601 format.
variant_ids None An array of variant ids associated with the image.
width None Width dimension of the image which is determined on upload.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
76. model.shopify_source.stg_shopify__product_image_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, initialized to NULL. The LIMIT 0 clause ensures no rows are returned. This is likely used as a template or placeholder for a staging table in a dbt (data build tool) project.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 76. model.shopify_source.stg_shopify__product_image_tmp 76. model.shopify_source.stg_shopify__product_image_tmp 117. source.shopify_source.shopify.product_image 117. source.shopify_source.shopify.product_image
Name Type Comment
77. model.shopify_source.stg_shopify__product_tag

This SQL query performs a basic transformation on data from a staging table. It casts several columns to specific data types, including setting some to NULL or empty string. The query also converts the '_fivetran_synced' timestamp to UTC timezone. The purpose seems to be standardizing the data structure and preparing it for further use.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_tag_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS INT) AS product_id,
    CAST(NULL AS TEXT) AS value,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    product_id,
    index,
    value,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 77. model.shopify_source.stg_shopify__product_tag 77. model.shopify_source.stg_shopify__product_tag _fivetran_synced index product_id value source_relation 78. model.shopify_source.stg_shopify__product_tag_tmp 78. model.shopify_source.stg_shopify__product_tag_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
index None Index (starting from 1) representing when the tag was placed on the product.
product_id None ID of the product being tagged.
value None Value of the tag.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
78. model.shopify_source.stg_shopify__product_tag_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type, initially set to NULL. The query is limited to 0 rows, effectively creating a template or skeleton for the 'stg_shopify__product_tag_tmp' model without any actual data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 78. model.shopify_source.stg_shopify__product_tag_tmp 78. model.shopify_source.stg_shopify__product_tag_tmp 118. source.shopify_source.shopify.product_tag 118. source.shopify_source.shopify.product_tag
Name Type Comment
79. model.shopify_source.stg_shopify__product_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) model.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 79. model.shopify_source.stg_shopify__product_tmp 79. model.shopify_source.stg_shopify__product_tmp 116. source.shopify_source.shopify.product 116. source.shopify_source.shopify.product
Name Type Comment
80. model.shopify_source.stg_shopify__product_variant

This SQL query performs data cleaning and transformation on a Shopify product variant dataset. It starts by casting columns to specific data types, renames some columns, and performs time zone conversions for timestamp fields. The query also coalesces inventory quantity fields and adjusts the boolean representation of the 'taxable' field.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__product_variant_tmp
), fields AS (
  SELECT
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS DECIMAL(28, 6)) AS product_id,
    CAST(NULL AS DECIMAL(28, 6)) AS inventory_item_id,
    CAST(NULL AS DECIMAL(28, 6)) AS image_id,
    CAST(NULL AS TEXT) AS title,
    CAST(NULL AS FLOAT) AS price,
    CAST(NULL AS TEXT) AS sku,
    CAST(NULL AS DECIMAL(28, 6)) AS position,
    CAST(NULL AS TEXT) AS inventory_policy,
    CAST(NULL AS FLOAT) AS compare_at_price,
    CAST(NULL AS TEXT) AS fulfillment_service,
    CAST(NULL AS TEXT) AS inventory_management,
    CAST(NULL AS BOOLEAN) AS taxable,
    CAST(NULL AS TEXT) AS barcode,
    CAST(NULL AS FLOAT) AS grams,
    CAST(NULL AS DECIMAL(28, 6)) AS old_inventory_quantity,
    CAST(NULL AS DECIMAL(28, 6)) AS inventory_quantity,
    CAST(NULL AS FLOAT) AS weight,
    CAST(NULL AS TEXT) AS weight_unit,
    CAST(NULL AS TEXT) AS option_1,
    CAST(NULL AS TEXT) AS option_2,
    CAST(NULL AS TEXT) AS option_3,
    CAST(NULL AS TEXT) AS tax_code,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS variant_id,
    product_id,
    inventory_item_id,
    image_id,
    title,
    price,
    sku,
    position,
    inventory_policy,
    compare_at_price,
    fulfillment_service,
    inventory_management,
    taxable AS is_taxable,
    barcode,
    grams,
    COALESCE(inventory_quantity, old_inventory_quantity) AS inventory_quantity,
    weight,
    weight_unit,
    option_1,
    option_2,
    option_3,
    tax_code,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant barcode compare_at_price created_timestamp fulfillment_service grams variant_id image_id inventory_item_id inventory_management inventory_policy inventory_quantity option_1 option_2 option_3 position price product_id sku is_taxable tax_code title updated_timestamp weight weight_unit _fivetran_synced source_relation 81. model.shopify_source.stg_shopify__product_variant_tmp 81. model.shopify_source.stg_shopify__product_variant_tmp
Name Type Comment
barcode None The barcode, UPC, or ISBN number for the product.
compare_at_price None The original price of the item before an adjustment or a sale in shop currency
created_timestamp None The date and time (ISO 8601 format) when the product variant was created.
fulfillment_service None The fulfillment service associated with the product variant.
grams None The weight of the product variant in grams.
variant_id None The unique numeric identifier for the product variant.
image_id None The unique numeric identifier for a product's image. The image must be associated to the same product as the variant.
inventory_item_id None The unique identifier for the inventory item, which is used in the Inventory API to query for inventory information.
inventory_management None The fulfillment service that tracks the number of items in stock for the product variant.
inventory_policy None Whether customers are allowed to place an order for the product variant when it's out of stock.
inventory_quantity None An aggregate of inventory across all locations. To adjust inventory at a specific location, use the InventoryLevel resource.
option_1 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
option_2 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
option_3 None The custom properties that a shop owner uses to define product variants. You can define three options for a product variant: option1, option2, option3.
position None The order of the product variant in the list of product variants. The first position in the list is 1. The position of variants is indicated by the order in which they are listed.
price None The price of the product variant.
product_id None The unique numeric identifier for the product.
sku None A unique identifier for the product variant in the shop. Required in order to connect to a FulfillmentService.
is_taxable None Whether a tax is charged when the product variant is sold.
tax_code None This parameter applies only to the stores that have the Avalara AvaTax app installed. Specifies the Avalara tax code for the product variant.
title None The title of the product variant. The title field is a concatenation of the option1, option2, and option3 fields. You can only update title indirectly using the option fields.
updated_timestamp None The date and time when the product variant was last modified. Gets returned in ISO 8601 format.
weight None The weight of the product variant in the unit system specified with weight_unit.
weight_unit None The unit of measurement that applies to the product variant's weight. If you don't specify a value for weight_unit, then the shop's default unit of measurement is applied. Valid values: g, kg, oz, and lb.
_fivetran_synced None The time when a record was last updated by Fivetran.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant barcode 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_barcode 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_barcode 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[barcode]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_barcode: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[barcode]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_barcode: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant compare_at_price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_compare_at_price 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[compare_at_price]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_compare_at_price: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant created_timestamp 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_created_at 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_created_at 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column may be formatted to ensure consistent ISO 8601 format
    • Output Columns:
      • variant_created_at: Directly copied to this output column, possibly with formatting
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_created_at: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant fulfillment_service 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_fulfillment_service 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_fulfillment_service 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[fulfillment_service]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_fulfillment_service: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[fulfillment_service]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_fulfillment_service: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant grams 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_grams 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_grams 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[grams]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_grams: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[grams]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_grams: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant variant_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_id 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[variant_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables
    • Output Columns:
      • variant_id: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant image_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_image_id 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines image_id 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[image_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_image_id: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[image_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • image_id: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_item_id 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines inventory_item_id 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_item_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • inventory_item_id: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_management 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_inventory_management 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_management]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_inventory_management: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_policy 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_inventory_policy 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_inventory_policy 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_policy]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_inventory_policy: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_policy]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_inventory_policy: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant inventory_quantity 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_inventory_quantity 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_inventory_quantity 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_quantity]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_inventory_quantity: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[inventory_quantity]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_inventory_quantity: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_1 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_option_1 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_option_1 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_1]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_option_1: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_1]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_option_1: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_2 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_option_2 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_option_2 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_2]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_option_2: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_2]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_option_2: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant option_3 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_option_3 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_option_3 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_3]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_option_3: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[option_3]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_option_3: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant position 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_position 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[position]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_position: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant price 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_price 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_price 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[price]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_price: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[price]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_price: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant product_id 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels product_id 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[product_id]
    • Direct This column is directly copied to the output
    • Integration Used to join with other tables
    • Output Columns:
      • product_id: Directly copied without transformation
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant sku 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels sku 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_sku 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[sku]
    • Direct This column is directly copied to the output
    • Output Columns:
      • sku: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[sku]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_sku: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant is_taxable 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels is_variant_taxable 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_is_taxable 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[is_taxable]
    • Direct This column is directly copied to the output
    • Output Columns:
      • is_variant_taxable: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[is_taxable]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_is_taxable: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant tax_code 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_tax_code 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_tax_code 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[tax_code]
    • Direct This column is directly copied to the output
    • Output Columns:
      • variant_tax_code: Directly copied without transformation
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[tax_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • variant_tax_code: Directly mapped
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant title 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_title 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_title 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_title: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_title: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant updated_timestamp 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_updated_at 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_updated_at 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[updated_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column might be cast or formatted to ensure consistent datetime format
    • Output Columns:
      • variant_updated_at: Directly copied to this output column, possibly with formatting
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[updated_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_updated_at: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant weight 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_weight 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_weight 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant weight_unit 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels variant_weight_unit 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines variant_weight_unit 80. model.shopify_source.stg_shopify__product_variant:f0->20. model.shopify.shopify__order_lines:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight_unit]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight_unit: Directly copied to this output column
20. model.shopify.shopify__order_lines
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[weight_unit]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • variant_weight_unit: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant _fivetran_synced 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels _fivetran_synced 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[_fivetran_synced]
    • Direct The column is likely directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to this output column
Column Lineage
%3 80. model.shopify_source.stg_shopify__product_variant 80. model.shopify_source.stg_shopify__product_variant source_relation 19. model.shopify.shopify__inventory_levels 19. model.shopify.shopify__inventory_levels source_relation 80. model.shopify_source.stg_shopify__product_variant:f0->19. model.shopify.shopify__inventory_levels:f0
19. model.shopify.shopify__inventory_levels
  • Input Column: 80. model.shopify_source.stg_shopify__product_variant[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join or union with other tables
    • Output Columns:
      • source_relation: Directly copied to this output column
81. model.shopify_source.stg_shopify__product_variant_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify product variant data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 81. model.shopify_source.stg_shopify__product_variant_tmp 81. model.shopify_source.stg_shopify__product_variant_tmp 119. source.shopify_source.shopify.product_variant 119. source.shopify_source.shopify.product_variant
Name Type Comment
82. model.shopify_source.stg_shopify__refund

This SQL query creates a staging table for Shopify refund data. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a fields CTE that casts all columns to specific data types, initially setting them to NULL or empty strings. Finally, it selects and renames some columns, converts timestamp fields to UTC, and prepares the data for further processing.

CleaningOther
SQL Query
/* this model will be all NULL until you have made a refund in Shopify */
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__refund_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS TEXT) AS note,
    CAST(NULL AS DECIMAL(28, 6)) AS order_id,
    CAST(NULL AS TIMESTAMP) AS processed_at,
    CAST(NULL AS BOOLEAN) AS restock,
    CAST(NULL AS TEXT) AS total_duties_set,
    CAST(NULL AS DECIMAL(28, 6)) AS user_id,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS refund_id,
    note,
    order_id,
    restock,
    total_duties_set,
    user_id,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(processed_at AS TIMESTAMP) AS TIMESTAMP)) AS processed_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 82. model.shopify_source.stg_shopify__refund 82. model.shopify_source.stg_shopify__refund refund_id created_at processed_at note restock user_id _fivetran_synced total_duties_set order_id source_relation 83. model.shopify_source.stg_shopify__refund_tmp 83. model.shopify_source.stg_shopify__refund_tmp
Name Type Comment
refund_id None The unique numeric identifier for the refund.
created_at None Timestamp of the date when the refund was created.
processed_at None Timestamp of the date when the refund was processed.
note None User generated note attached to the refund.
restock None Boolean indicating if the refund is a result of a restock.
user_id None Reference to the user id which generated the refund.
_fivetran_synced None The time when a record was last updated by Fivetran.
total_duties_set None Record representing total duties set for the refund.
order_id None Reference to the order which the refund is associated.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
83. model.shopify_source.stg_shopify__refund_tmp

This SQL query creates a placeholder or dummy table for the 'model.shopify_source.stg_shopify__refund_tmp' model. It selects a single column named '_dbt_source_relation' with a NULL value of TEXT type, but limits the result to 0 rows. This effectively creates an empty table structure that can be used as a template or placeholder until actual refund data is available in Shopify.

Other
SQL Query
/* this model will be all NULL until you create a refund in Shopify */
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 83. model.shopify_source.stg_shopify__refund_tmp 83. model.shopify_source.stg_shopify__refund_tmp 120. source.shopify_source.shopify.refund 120. source.shopify_source.shopify.refund
Name Type Comment
84. model.shopify_source.stg_shopify__shop

This SQL query processes data from a Shopify shop source table. It performs type casting, renames some columns, and applies various transformations to clean and standardize the data. The query also creates new boolean fields from existing data and converts timezone for timestamp fields. It's primarily focused on data cleaning and light featurization.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__shop_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS address_1,
    CAST(NULL AS TEXT) AS address_2,
    CAST(NULL AS BOOLEAN) AS checkout_api_supported,
    CAST(NULL AS TEXT) AS city,
    CAST(NULL AS TEXT) AS cookie_consent_level,
    CAST(NULL AS TEXT) AS country,
    CAST(NULL AS TEXT) AS country_code,
    CAST(NULL AS TEXT) AS country_name,
    CAST(NULL AS BOOLEAN) AS county_taxes,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS currency,
    CAST(NULL AS TEXT) AS customer_email,
    CAST(NULL AS TEXT) AS domain,
    CAST(NULL AS BOOLEAN) AS eligible_for_card_reader_giveaway,
    CAST(NULL AS BOOLEAN) AS eligible_for_payments,
    CAST(NULL AS TEXT) AS email,
    CAST(NULL AS TEXT) AS enabled_presentment_currencies,
    CAST(NULL AS TEXT) AS google_apps_domain,
    CAST(NULL AS BOOLEAN) AS google_apps_login_enabled,
    CAST(NULL AS BOOLEAN) AS has_discounts,
    CAST(NULL AS BOOLEAN) AS has_gift_cards,
    CAST(NULL AS BOOLEAN) AS has_storefront,
    CAST(NULL AS TEXT) AS iana_timezone,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS FLOAT) AS latitude,
    CAST(NULL AS FLOAT) AS longitude,
    CAST(NULL AS TEXT) AS money_format,
    CAST(NULL AS TEXT) AS money_in_emails_format,
    CAST(NULL AS TEXT) AS money_with_currency_format,
    CAST(NULL AS TEXT) AS money_with_currency_in_emails_format,
    CAST(NULL AS TEXT) AS myshopify_domain,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS BOOLEAN) AS password_enabled,
    CAST(NULL AS TEXT) AS phone,
    CAST(NULL AS TEXT) AS plan_display_name,
    CAST(NULL AS TEXT) AS plan_name,
    CAST(NULL AS BOOLEAN) AS pre_launch_enabled,
    CAST(NULL AS TEXT) AS primary_locale,
    CAST(NULL AS TEXT) AS province,
    CAST(NULL AS TEXT) AS province_code,
    CAST(NULL AS BOOLEAN) AS requires_extra_payments_agreement,
    CAST(NULL AS BOOLEAN) AS setup_required,
    CAST(NULL AS TEXT) AS shop_owner,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS BOOLEAN) AS tax_shipping,
    CAST(NULL AS BOOLEAN) AS taxes_included,
    CAST(NULL AS TEXT) AS timezone,
    CAST(NULL AS TIMESTAMP) AS updated_at,
    CAST(NULL AS TEXT) AS weight_unit,
    CAST(NULL AS TEXT) AS zip,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS shop_id,
    name,
    _fivetran_deleted AS is_deleted,
    address_1,
    address_2,
    city,
    province,
    province_code,
    country,
    country_code,
    country_name,
    zip,
    latitude,
    longitude,
    CASE WHEN county_taxes IS NULL THEN FALSE ELSE county_taxes END AS has_county_taxes,
    currency,
    enabled_presentment_currencies,
    customer_email,
    email,
    domain,
    phone,
    timezone,
    iana_timezone,
    primary_locale,
    weight_unit,
    myshopify_domain,
    cookie_consent_level,
    shop_owner,
    source,
    tax_shipping AS has_shipping_taxes,
    CASE WHEN taxes_included IS NULL THEN FALSE ELSE taxes_included END AS has_taxes_included_in_price,
    has_discounts,
    has_gift_cards,
    has_storefront,
    checkout_api_supported AS has_checkout_api_supported,
    eligible_for_card_reader_giveaway AS is_eligible_for_card_reader_giveaway,
    eligible_for_payments AS is_eligible_for_payments,
    google_apps_domain,
    CASE
      WHEN google_apps_login_enabled IS NULL
      THEN FALSE
      ELSE google_apps_login_enabled
    END AS is_google_apps_login_enabled,
    money_format,
    money_in_emails_format,
    money_with_currency_format,
    money_with_currency_in_emails_format,
    plan_display_name,
    plan_name,
    password_enabled AS is_password_enabled,
    pre_launch_enabled AS is_pre_launch_enabled,
    requires_extra_payments_agreement AS is_extra_payments_agreement_required,
    setup_required AS is_setup_required,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(updated_at AS TIMESTAMP) AS TIMESTAMP)) AS updated_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop is_deleted _fivetran_synced address_1 address_2 has_checkout_api_supported city cookie_consent_level country country_code country_name has_county_taxes created_at currency customer_email domain is_eligible_for_card_reader_giveaway is_eligible_for_payments email enabled_presentment_currencies google_apps_domain is_google_apps_login_enabled has_discounts has_gift_cards has_storefront iana_timezone shop_id latitude longitude money_format money_in_emails_format money_with_currency_format money_with_currency_in_emails_format myshopify_domain name is_password_enabled phone plan_display_name plan_name is_pre_launch_enabled primary_locale province province_code is_extra_payments_agreement_required is_setup_required shop_owner source has_shipping_taxes has_taxes_included_in_price timezone updated_at weight_unit zip source_relation 85. model.shopify_source.stg_shopify__shop_tmp 85. model.shopify_source.stg_shopify__shop_tmp
Name Type Comment
is_deleted None Boolean representing whether the record was soft-deleted in Shopify.
_fivetran_synced None The time when a record was last updated by Fivetran.
address_1 None The shop's street address.
address_2 None The optional second line of the shop's street address.
has_checkout_api_supported None Boolean representing whether the shop is capable of accepting payments directly through the Checkout API.
city None The shop's city.
cookie_consent_level None The cookie consent level defined on the shop's online store.
country None The shop's country. In most cases, this value matches the country_code.
country_code None The two-letter country code corresponding to the shop's country.
country_name None The shop's normalized country name.
has_county_taxes None Boolean representing whether the shop is applying taxes on a per-county basis. Only applicable to shops based in the US. Either `true` or `null` (not false, according to Shopify API docs).
created_at None The date and time (ISO 8601) when the shop was created.
currency None The three-letter code (ISO 4217 format) for the shop's default currency.
customer_email None The contact email used for communication between the shop owner and the customer.
domain None The shop's domain.
is_eligible_for_card_reader_giveaway None Boolean representing whether the shop is eligible to receive a free credit card reader from Shopify.
is_eligible_for_payments None Boolean representing whether the shop is eligible to use Shopify Payments.
email None The contact email used for communication between Shopify and the shop owner.
enabled_presentment_currencies None An array of of enabled currencies (ISO 4217 format) that the shop accepts. Merchants can enable currencies from their Shopify Payments settings in the Shopify Admin.
google_apps_domain None The GSuite URL for the store, if applicable.
is_google_apps_login_enabled None Boolean representing whether the GSuite login is enabled. Shops with this feature will be able to log in through the GSuite login page. Valid values are `true` and `null`.
has_discounts None Boolean representing whether any active discounts exist for the shop.
has_gift_cards None Boolean representing whether any active gift cards exist for the shop.
has_storefront None Boolean representing whether this shop has an online store.
iana_timezone None The name of the timezone assigned by the [IANA](https://www.iana.org/time-zones).
shop_id None The ID for the shop. A 64-bit unsigned integer.
latitude None The latitude of the shop's location.
longitude None The longitude of the shop's location.
money_format None A string representing the way currency is formatted when the currency isn't specified.
money_in_emails_format None A string representing the way currency is formatted in email notifications when the currency isn't specified.
money_with_currency_format None A string representing the way currency is formatted when the currency is specified.
money_with_currency_in_emails_format None A string representing the way currency is formatted in email notifications when the currency is specified.
myshopify_domain None The shop's .myshopify.com domain.
name None The name of the shop.
is_password_enabled None Boolean representing whether the password protection page is enabled on the shop's online store.
phone None The contact phone number for the shop.
plan_display_name None The display name of the Shopify plan the shop is on.
plan_name None The name of the Shopify plan the shop is on.
is_pre_launch_enabled None Boolean representing whether the pre-launch page is enabled on the shop's online store.
primary_locale None The shop's primary locale, as configured in the language settings of the shop's theme.
province None The shop's normalized province or state name.
province_code None The two- or three-letter code for the shop's province or state.
is_extra_payments_agreement_required None Boolean representing whether the shop requires an extra Shopify Payments agreement.
is_setup_required None Boolean representing whether the shop has any outstanding setup steps.
shop_owner None The username of the shop owner.
source None The handle of the partner account that referred the merchant to Shopify, if applicable.
has_shipping_taxes None Boolean representing whether taxes are charged for shipping. Valid values are true or false.
has_taxes_included_in_price None Boolean representing whether applicable taxes are included in product prices. Valid values are true or null.
timezone None The name of the timezone the shop is in.
updated_at None The date and time (ISO 8601) when the shop was last updated.
weight_unit None The default unit of weight measurement for the shop.
zip None The shop's zip or postal code.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop is_deleted 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop is_deleted 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[is_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_deleted: Directly copied to the output
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop created_at 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop created_at 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[created_at]
    • Direct The column is directly copied to the output
    • Filtering Used to filter shop records based on creation date
    • Output Columns:
      • created_at: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop currency 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop currency 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[currency]
    • Direct The column is directly copied to the output
    • Output Columns:
      • currency: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop domain 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop domain 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[domain]
    • Direct The column is directly copied to the output
    • Output Columns:
      • domain: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop enabled_presentment_currencies 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop enabled_presentment_currencies 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[enabled_presentment_currencies]
    • Direct The column is directly copied to the output
    • Output Columns:
      • enabled_presentment_currencies: Directly copied
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop iana_timezone 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop iana_timezone 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[iana_timezone]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • iana_timezone: Directly copied to the output
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop shop_id 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop shop_id 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[shop_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with other tables
    • Output Columns:
      • shop_id: Directly copied to the output
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop name 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop name 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • name: Directly mapped to the output 'name' column
Column Lineage
%3 84. model.shopify_source.stg_shopify__shop 84. model.shopify_source.stg_shopify__shop source_relation 17. model.shopify.shopify__daily_shop 17. model.shopify.shopify__daily_shop source_relation 84. model.shopify_source.stg_shopify__shop:f0->17. model.shopify.shopify__daily_shop:f0
17. model.shopify.shopify__daily_shop
  • Input Column: 84. model.shopify_source.stg_shopify__shop[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables in the query
    • Output Columns:
      • source_relation: Directly mapped to the output column of the same name
85. model.shopify_source.stg_shopify__shop_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, initialized to NULL. The LIMIT 0 clause ensures no rows are returned. This is likely used as a template or placeholder for a staging table in a dbt (data build tool) project.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 85. model.shopify_source.stg_shopify__shop_tmp 85. model.shopify_source.stg_shopify__shop_tmp 121. source.shopify_source.shopify.shop 121. source.shopify_source.shopify.shop
Name Type Comment
86. model.shopify_source.stg_shopify__tax_line

This SQL query creates a staging table for tax line data from a Shopify source. It starts with a base table, then defines a fields CTE that casts columns to specific data types, including several NULL casts. The final CTE selects these fields, converts the _fivetran_synced timestamp to UTC, and includes a source_relation column. The main query then selects all columns from the final CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__tax_line_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS index,
    CAST(NULL AS INT) AS order_line_id,
    CAST(NULL AS FLOAT) AS price,
    CAST(NULL AS TEXT) AS price_set,
    CAST(NULL AS FLOAT) AS rate,
    CAST(NULL AS TEXT) AS title,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    index,
    order_line_id,
    price,
    price_set,
    rate,
    title,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
)
SELECT
  *
FROM final
%3 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line _fivetran_synced index order_line_id price price_set rate title 87. model.shopify_source.stg_shopify__tax_line_tmp 87. model.shopify_source.stg_shopify__tax_line_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
index None The index of the tax line.
order_line_id None The order line that this tax line is associated with.
price None The amount of tax, in shop currency, after discounts and before returns.
price_set None The amount of tax, in shop and presentment currencies, after discounts and before returns.
rate None The proportion of the line item price that the tax represents as a decimal.
title None The name of the tax.
Column Lineage
%3 86. model.shopify_source.stg_shopify__tax_line 86. model.shopify_source.stg_shopify__tax_line price 20. model.shopify.shopify__order_lines 20. model.shopify.shopify__order_lines order_line_tax 86. model.shopify_source.stg_shopify__tax_line:f0->20. model.shopify.shopify__order_lines:f0
20. model.shopify.shopify__order_lines
  • Input Column: 86. model.shopify_source.stg_shopify__tax_line[price]
    • Aggregation This column is summed up in the tax_lines_aggregated CTE
    • Output Columns:
      • order_line_tax: The sum of this column becomes the order_line_tax in the final output
87. model.shopify_source.stg_shopify__tax_line_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for a staging table in a dbt (data build tool) project, specifically for Shopify tax line data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 87. model.shopify_source.stg_shopify__tax_line_tmp 87. model.shopify_source.stg_shopify__tax_line_tmp 122. source.shopify_source.shopify.tax_line 122. source.shopify_source.shopify.tax_line
Name Type Comment
88. model.shopify_source.stg_shopify__tender_transaction

This SQL query performs data transformation and cleaning on a Shopify tender transaction dataset. It starts by selecting all columns from a temporary staging table, then defines a set of fields with specific data types. The query then selects and renames certain fields, converts timestamps to UTC, and filters out test transactions. The result is a cleaned and standardized version of the tender transaction data.

CleaningFiltering
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__tender_transaction_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS FLOAT) AS amount,
    CAST(NULL AS TEXT) AS currency,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS order_id,
    CAST(NULL AS TEXT) AS payment_method,
    CAST(NULL AS TIMESTAMP) AS processed_at,
    CAST(NULL AS TEXT) AS remote_reference,
    CAST(NULL AS BOOLEAN) AS test,
    CAST(NULL AS INT) AS user_id,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS transaction_id,
    order_id,
    amount,
    currency,
    payment_method,
    remote_reference,
    user_id,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(processed_at AS TIMESTAMP) AS TIMESTAMP)) AS processed_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
  WHERE
    NOT COALESCE(test, FALSE)
)
SELECT
  *
FROM final
%3 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction _fivetran_synced amount currency transaction_id order_id payment_method processed_at remote_reference user_id source_relation 89. model.shopify_source.stg_shopify__tender_transaction_tmp 89. model.shopify_source.stg_shopify__tender_transaction_tmp
Name Type Comment
_fivetran_synced None The time when a record was last updated by Fivetran.
amount None The amount of the tender transaction in the shop's currency.
currency None The three-letter code (ISO 4217 format) for the currency used for the tender transaction.
transaction_id None The ID of the transaction.
order_id None The ID of the order that the tender transaction belongs to.
payment_method None Information about the payment method used for this transaction. Valid values include: - credit_card - cash - android_pay - apple_pay - google_pay - samsung_pay - shopify_pay - amazon - klarna - paypal - unknown - other
processed_at None The date and time (ISO 8601 format) when the tender transaction was processed.
remote_reference None The remote (gateway) reference associated with the tender.
user_id None The ID of the user logged into the Shopify POS device that processed the tender transaction, if applicable.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
Column Lineage
%3 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction _fivetran_synced 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions _fivetran_synced 88. model.shopify_source.stg_shopify__tender_transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 88. model.shopify_source.stg_shopify__tender_transaction[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 88. model.shopify_source.stg_shopify__tender_transaction 88. model.shopify_source.stg_shopify__tender_transaction payment_method 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_method 88. model.shopify_source.stg_shopify__tender_transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 88. model.shopify_source.stg_shopify__tender_transaction[payment_method]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • payment_method: Directly copied to the output
89. model.shopify_source.stg_shopify__tender_transaction_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) project, specifically for the 'stg_shopify__tender_transaction_tmp' model in the Shopify source.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 89. model.shopify_source.stg_shopify__tender_transaction_tmp 89. model.shopify_source.stg_shopify__tender_transaction_tmp 123. source.shopify_source.shopify.tender_transaction 123. source.shopify_source.shopify.tender_transaction
Name Type Comment
90. model.shopify_source.stg_shopify__transaction

This SQL query stages data from a Shopify transactions source table. It casts various fields to specific data types, renames some columns, converts timezone for timestamp fields to UTC, and filters out test transactions. The query prepares the data for further processing or analysis by standardizing the structure and ensuring data quality.

CleaningFiltering
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_shopify.stg_shopify__transaction_tmp
), fields AS (
  SELECT
    CAST(NULL AS DECIMAL(28, 6)) AS id,
    CAST(NULL AS DECIMAL(28, 6)) AS order_id,
    CAST(NULL AS DECIMAL(28, 6)) AS refund_id,
    CAST(NULL AS DECIMAL(28, 6)) AS amount,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TIMESTAMP) AS processed_at,
    CAST(NULL AS DECIMAL(28, 6)) AS device_id,
    CAST(NULL AS TEXT) AS gateway,
    CAST(NULL AS TEXT) AS source_name,
    CAST(NULL AS TEXT) AS message,
    CAST(NULL AS TEXT) AS currency,
    CAST(NULL AS DECIMAL(28, 6)) AS location_id,
    CAST(NULL AS DECIMAL(28, 6)) AS parent_id,
    CAST(NULL AS TEXT) AS payment_avs_result_code,
    CAST(NULL AS TEXT) AS payment_credit_card_bin,
    CAST(NULL AS TEXT) AS payment_cvv_result_code,
    CAST(NULL AS TEXT) AS payment_credit_card_number,
    CAST(NULL AS TEXT) AS payment_credit_card_company,
    CAST(NULL AS TEXT) AS kind,
    CAST(NULL AS TEXT) AS receipt,
    CAST(NULL AS DECIMAL(28, 6)) AS currency_exchange_id,
    CAST(NULL AS DECIMAL(28, 6)) AS currency_exchange_adjustment,
    CAST(NULL AS DECIMAL(28, 6)) AS currency_exchange_original_amount,
    CAST(NULL AS DECIMAL(28, 6)) AS currency_exchange_final_amount,
    CAST(NULL AS TEXT) AS currency_exchange_currency,
    CAST(NULL AS TEXT) AS error_code,
    CAST(NULL AS TEXT) AS status,
    CAST(NULL AS BOOLEAN) AS test,
    CAST(NULL AS DECIMAL(28, 6)) AS user_id,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS authorization_expires_at,
    CAST(NULL AS TEXT) AS authorization_code,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    id AS transaction_id,
    order_id,
    refund_id,
    amount,
    device_id,
    gateway,
    source_name,
    message,
    currency,
    location_id,
    parent_id,
    payment_avs_result_code,
    payment_credit_card_bin,
    payment_cvv_result_code,
    payment_credit_card_number,
    payment_credit_card_company,
    kind,
    receipt,
    currency_exchange_id,
    currency_exchange_adjustment,
    currency_exchange_original_amount,
    currency_exchange_final_amount,
    currency_exchange_currency,
    error_code,
    status,
    user_id,
    authorization_code,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(created_at AS TIMESTAMP) AS TIMESTAMP)) AS created_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(processed_at AS TIMESTAMP) AS TIMESTAMP)) AS processed_timestamp,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(authorization_expires_at AS TIMESTAMP) AS TIMESTAMP)) AS authorization_expires_at,
    CONVERT_TIMEZONE('UTC', 'UTC', CAST(CAST(_fivetran_synced AS TIMESTAMP) AS TIMESTAMP)) AS _fivetran_synced,
    source_relation
  FROM fields
  WHERE
    NOT COALESCE(test, FALSE)
)
SELECT
  *
FROM final
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction transaction_id order_id refund_id amount authorization_code created_timestamp processed_timestamp device_id gateway source_name message currency location_id parent_id payment_avs_result_code payment_credit_card_bin payment_cvv_result_code payment_credit_card_number payment_credit_card_company kind receipt currency_exchange_id currency_exchange_adjustment currency_exchange_original_amount currency_exchange_final_amount currency_exchange_currency error_code status test user_id _fivetran_synced source_relation authorization_expires_at 91. model.shopify_source.stg_shopify__transaction_tmp 91. model.shopify_source.stg_shopify__transaction_tmp
Name Type Comment
transaction_id None The ID for the transaction.
order_id None The ID for the order that the transaction is associated with.
refund_id None The ID associated with a refund in the refund table.
amount None The amount of money included in the transaction.
authorization_code None The authorization code associated with the transaction.
created_timestamp None The date and time when the transaction was created.
processed_timestamp None The date and time when a transaction was processed.
device_id None The ID for the device.
gateway None The name of the gateway the transaction was issued through.
source_name None The origin of the transaction.
message None A string generated by the payment provider with additional information about why the transaction succeeded or failed.
currency None The three-letter code (ISO 4217 format) for the currency used for the payment.
location_id None The ID of the physical location where the transaction was processed.
parent_id None The ID of an associated transaction.
payment_avs_result_code None The response code from the address verification system.
payment_credit_card_bin None The issuer identification number (IIN), formerly known as bank identification number (BIN) of the customer's credit card.
payment_cvv_result_code None The response code from the credit card company indicating whether the customer entered the card security code, or card verification value, correctly.
payment_credit_card_number None The customer's credit card number, with most of the leading digits redacted.
payment_credit_card_company None The name of the company that issued the customer's credit card.
kind None The transaction's type.
receipt None A transaction receipt attached to the transaction by the gateway.
currency_exchange_id None The ID of the adjustment.
currency_exchange_adjustment None The difference between the amounts on the associated transaction and the parent transaction.
currency_exchange_original_amount None The amount of the parent transaction in the shop currency.
currency_exchange_final_amount None The amount of the associated transaction in the shop currency.
currency_exchange_currency None The shop currency.
error_code None A standardized error code, independent of the payment provider.
status None The status of the transaction.
test None Whether the transaction is a test transaction.
user_id None The ID for the user who was logged into the Shopify POS device when the order was processed, if applicable.
_fivetran_synced None The time when a record was last updated by Fivetran.
source_relation None The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.
authorization_expires_at None The date and time (ISO 8601 format) when the Shopify Payments authorization expires.
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction transaction_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions transaction_id transactions_unique_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[transaction_id]
    • Direct The column is directly copied without transformation
    • Integration Used as a key to join with tender_transactions and parent_transactions
    • Other Used to create the transactions_unique_id
    • Output Columns:
      • transaction_id: Directly copied
      • transactions_unique_id: Part of the MD5 hash
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction order_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions order_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[order_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • order_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction refund_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions refund_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[refund_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • refund_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction amount 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions amount currency_exchange_calculated_amount 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[amount]
    • Direct The column is directly copied without transformation
    • Other Used in currency exchange calculations
    • Output Columns:
      • amount: Directly copied
      • currency_exchange_calculated_amount: Used in calculation with exchange_rate
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction authorization_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions authorization_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[authorization_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • authorization_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction created_timestamp 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions created_timestamp 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[created_timestamp]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction processed_timestamp 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions processed_timestamp 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[processed_timestamp]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • processed_timestamp: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction device_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions device_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[device_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • device_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction gateway 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions gateway 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[gateway]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • gateway: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction source_name 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions source_name 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[source_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source_name: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction message 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions message 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[message]
    • Direct The message column is directly copied without any transformation
    • Output Columns:
      • message: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency]
    • Direct The currency column is directly copied without any transformation
    • Output Columns:
      • currency: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction location_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions location_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[location_id]
    • Direct The location_id column is directly copied without any transformation
    • Output Columns:
      • location_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction parent_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions parent_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[parent_id]
    • Integration The parent_id is used to join with the parent transactions table
    • Output Columns:
      • parent_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_avs_result_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_avs_result_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_avs_result_code]
    • Direct The payment_avs_result_code column is directly copied without any transformation
    • Output Columns:
      • payment_avs_result_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_credit_card_bin 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_credit_card_bin 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_credit_card_bin]
    • Direct The payment_credit_card_bin column is directly copied without any transformation
    • Output Columns:
      • payment_credit_card_bin: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_cvv_result_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_cvv_result_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_cvv_result_code]
    • Direct The payment_cvv_result_code column is directly copied without any transformation
    • Output Columns:
      • payment_cvv_result_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_credit_card_number 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_credit_card_number 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_credit_card_number]
    • Direct The payment_credit_card_number column is directly copied without any transformation
    • Output Columns:
      • payment_credit_card_number: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction payment_credit_card_company 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions payment_credit_card_company 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[payment_credit_card_company]
    • Direct The payment_credit_card_company column is directly copied without any transformation
    • Output Columns:
      • payment_credit_card_company: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction kind 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions kind parent_kind 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[kind]
    • Direct The kind column is directly copied without any transformation
    • Integration The kind column is also used in the join with parent transactions
    • Output Columns:
      • kind: Directly copied
      • parent_kind: Used to populate the parent_kind column for child transactions
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction receipt 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_calculated_amount exchange_rate 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[receipt]
    • Featurization The exchange rate is extracted from the JSON data in this column
    • Cleaning The extracted data is cast to DECIMAL(28, 6) and null values are handled
    • Output Columns:
      • exchange_rate: Extracted and cleaned exchange rate value
      • currency_exchange_calculated_amount: Used in calculation with 'amount' column
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_adjustment 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_adjustment 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_adjustment]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_adjustment: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_original_amount 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_original_amount 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_original_amount]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_original_amount: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_final_amount 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_final_amount 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_final_amount]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_final_amount: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction currency_exchange_currency 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions currency_exchange_currency 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[currency_exchange_currency]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • currency_exchange_currency: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction error_code 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions error_code 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[error_code]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • error_code: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction status 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions status 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[status]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • status: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction user_id 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions user_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[user_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_id: Directly copied
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction _fivetran_synced 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions _fivetran_synced 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[_fivetran_synced]
    • Direct This column is directly copied to the output without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction source_relation 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions source_relation transactions_unique_id 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f1
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[source_relation]
    • Direct This column is directly copied to the output without any transformation
    • Integration This column is used as a key to join the transactions table with tender_transactions and parent_transactions
    • Other This column is used in creating the transactions_unique_id
    • Output Columns:
      • source_relation: Directly copied to the output
      • transactions_unique_id: Used in the MD5 hash function to create this unique identifier
Column Lineage
%3 90. model.shopify_source.stg_shopify__transaction 90. model.shopify_source.stg_shopify__transaction authorization_expires_at 25. model.shopify.shopify__transactions 25. model.shopify.shopify__transactions authorization_expires_at 90. model.shopify_source.stg_shopify__transaction:f0->25. model.shopify.shopify__transactions:f0
25. model.shopify.shopify__transactions
  • Input Column: 90. model.shopify_source.stg_shopify__transaction[authorization_expires_at]
    • Direct This column is directly copied to the output without any transformation
    • Output Columns:
      • authorization_expires_at: Directly copied to the output
91. model.shopify_source.stg_shopify__transaction_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further data manipulation or as a starting point for a more complex query.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 91. model.shopify_source.stg_shopify__transaction_tmp 91. model.shopify_source.stg_shopify__transaction_tmp 124. source.shopify_source.shopify.transaction 124. source.shopify_source.shopify.transaction
Name Type Comment
92. source.shopify_source.shopify.abandoned_checkout
The model details are not provided
93. source.shopify_source.shopify.abandoned_checkout_discount_code
The model details are not provided
94. source.shopify_source.shopify.abandoned_checkout_shipping_line
The model details are not provided
95. source.shopify_source.shopify.collection
The model details are not provided
96. source.shopify_source.shopify.collection_product
The model details are not provided
97. source.shopify_source.shopify.customer
The model details are not provided
98. source.shopify_source.shopify.customer_tag
The model details are not provided
99. source.shopify_source.shopify.discount_code
The model details are not provided
100. source.shopify_source.shopify.fulfillment
The model details are not provided
101. source.shopify_source.shopify.inventory_item
The model details are not provided
102. source.shopify_source.shopify.inventory_level
The model details are not provided
103. source.shopify_source.shopify.location
The model details are not provided
104. source.shopify_source.shopify.metafield
The model details are not provided
105. source.shopify_source.shopify.order
The model details are not provided
106. source.shopify_source.shopify.order_adjustment
The model details are not provided
107. source.shopify_source.shopify.order_discount_code
The model details are not provided
108. source.shopify_source.shopify.order_line
The model details are not provided
109. source.shopify_source.shopify.order_line_refund
The model details are not provided
110. source.shopify_source.shopify.order_note_attribute
The model details are not provided
111. source.shopify_source.shopify.order_shipping_line
The model details are not provided
112. source.shopify_source.shopify.order_shipping_tax_line
The model details are not provided
113. source.shopify_source.shopify.order_tag
The model details are not provided
114. source.shopify_source.shopify.order_url_tag
The model details are not provided
115. source.shopify_source.shopify.price_rule
The model details are not provided
116. source.shopify_source.shopify.product
The model details are not provided
117. source.shopify_source.shopify.product_image
The model details are not provided
118. source.shopify_source.shopify.product_tag
The model details are not provided
119. source.shopify_source.shopify.product_variant
The model details are not provided
120. source.shopify_source.shopify.refund
The model details are not provided
121. source.shopify_source.shopify.shop
The model details are not provided
122. source.shopify_source.shopify.tax_line
The model details are not provided
123. source.shopify_source.shopify.tender_transaction
The model details are not provided
124. source.shopify_source.shopify.transaction
The model details are not provided