From 59ac317c58bbc36148d91e56947ab7bfde635e28 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 7 Apr 2022 10:03:41 +0700 Subject: [PATCH] sync promotion --- Makefile | 2 +- models/generated/airbyte_ctes/unibag/promotion_orders_ab1.sql | 2 ++ models/generated/airbyte_ctes/unibag/promotion_orders_ab2.sql | 2 ++ models/generated/airbyte_ctes/unibag/promotion_orders_ab3.sql | 2 ++ models/generated/airbyte_ctes/unibag/promotions_ab1.sql | 1 + models/generated/airbyte_ctes/unibag/promotions_ab2.sql | 1 + models/generated/airbyte_ctes/unibag/promotions_ab3.sql | 1 + models/generated/airbyte_tables/unibag/order_items.sql | 1 + models/generated/airbyte_tables/unibag/promotion_orders.sql | 3 +++ models/generated/airbyte_tables/unibag/promotions.sql | 2 ++ 10 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7dc99fe..9dcb83d 100644 --- a/Makefile +++ b/Makefile @@ -6,5 +6,5 @@ push: run: dbt deps --profiles-dir=. --project-dir=. #dbt run --profiles-dir=. --project-dir=. --full-refresh - dbt run --profiles-dir=. --project-dir=. --full-refresh --select order_deliveries + dbt run --profiles-dir=. --project-dir=. --full-refresh --select order_items diff --git a/models/generated/airbyte_ctes/unibag/promotion_orders_ab1.sql b/models/generated/airbyte_ctes/unibag/promotion_orders_ab1.sql index 54a3c64..b4a9c1d 100644 --- a/models/generated/airbyte_ctes/unibag/promotion_orders_ab1.sql +++ b/models/generated/airbyte_ctes/unibag/promotion_orders_ab1.sql @@ -20,6 +20,8 @@ select {{ json_extract_scalar('_airbyte_data', ['commission'], ['commission']) }} as commission, {{ json_extract_scalar('_airbyte_data', ['isRejected'], ['isRejected']) }} as isrejected, {{ json_extract_scalar('_airbyte_data', ['quantityPromotion'], ['quantityPromotion']) }} as quantitypromotion, + {{ json_extract_scalar('_airbyte_data', ['supplierCommission'], ['supplierCommission']) }} as suppliercommission, + {{ json_extract_scalar('_airbyte_data', ['supplierCommissionTotal'], ['supplierCommissionTotal']) }} as suppliercommissiontotal, _airbyte_ab_id, _airbyte_emitted_at, {{ current_timestamp() }} as _airbyte_normalized_at diff --git a/models/generated/airbyte_ctes/unibag/promotion_orders_ab2.sql b/models/generated/airbyte_ctes/unibag/promotion_orders_ab2.sql index 7005f92..0dff1ec 100644 --- a/models/generated/airbyte_ctes/unibag/promotion_orders_ab2.sql +++ b/models/generated/airbyte_ctes/unibag/promotion_orders_ab2.sql @@ -20,6 +20,8 @@ select cast(commission as {{ dbt_utils.type_float() }}) as commission, {{ cast_to_boolean('isrejected') }} as isrejected, cast(quantitypromotion as {{ dbt_utils.type_float() }}) as quantitypromotion, + cast(supplierCommission as {{ dbt_utils.type_string() }}) as supplierCommission, + cast(supplierCommissionTotal as {{ dbt_utils.type_float() }}) as supplierCommissionTotal, _airbyte_ab_id, _airbyte_emitted_at, {{ current_timestamp() }} as _airbyte_normalized_at diff --git a/models/generated/airbyte_ctes/unibag/promotion_orders_ab3.sql b/models/generated/airbyte_ctes/unibag/promotion_orders_ab3.sql index 759fde9..1f7b933 100644 --- a/models/generated/airbyte_ctes/unibag/promotion_orders_ab3.sql +++ b/models/generated/airbyte_ctes/unibag/promotion_orders_ab3.sql @@ -21,6 +21,8 @@ select 'commission', boolean_to_string('isrejected'), 'quantitypromotion', + 'supplierCommission', + 'supplierCommissionTotal', ]) }} as _airbyte_promotion_orders_hashid, tmp.* from {{ ref('promotion_orders_ab2') }} tmp diff --git a/models/generated/airbyte_ctes/unibag/promotions_ab1.sql b/models/generated/airbyte_ctes/unibag/promotions_ab1.sql index 14f319d..7d95d4e 100644 --- a/models/generated/airbyte_ctes/unibag/promotions_ab1.sql +++ b/models/generated/airbyte_ctes/unibag/promotions_ab1.sql @@ -25,6 +25,7 @@ select {{ json_extract_scalar('_airbyte_data', ['conditionForUser'], ['conditionForUser']) }} as conditionforuser, {{ json_extract_scalar('_airbyte_data', ['isUnlimitedQuantity'], ['isUnlimitedQuantity']) }} as isunlimitedquantity, {{ json_extract_scalar('_airbyte_data', ['isApplyForOrderWholesale'], ['isApplyForOrderWholesale']) }} as isapplyfororderwholesale, + {{ json_extract_scalar('_airbyte_data', ['supplierCommission'], ['supplierCommission']) }} as suppliercommission, _airbyte_ab_id, _airbyte_emitted_at, {{ current_timestamp() }} as _airbyte_normalized_at diff --git a/models/generated/airbyte_ctes/unibag/promotions_ab2.sql b/models/generated/airbyte_ctes/unibag/promotions_ab2.sql index 866c880..16eaeb6 100644 --- a/models/generated/airbyte_ctes/unibag/promotions_ab2.sql +++ b/models/generated/airbyte_ctes/unibag/promotions_ab2.sql @@ -25,6 +25,7 @@ select cast(conditionforuser as {{ dbt_utils.type_string() }}) as conditionforuser, {{ cast_to_boolean('isunlimitedquantity') }} as isunlimitedquantity, {{ cast_to_boolean('isapplyfororderwholesale') }} as isapplyfororderwholesale, + cast(supplierCommission as {{ dbt_utils.type_string() }}) as supplierCommission, _airbyte_ab_id, _airbyte_emitted_at, {{ current_timestamp() }} as _airbyte_normalized_at diff --git a/models/generated/airbyte_ctes/unibag/promotions_ab3.sql b/models/generated/airbyte_ctes/unibag/promotions_ab3.sql index 0a9ff20..068abef 100644 --- a/models/generated/airbyte_ctes/unibag/promotions_ab3.sql +++ b/models/generated/airbyte_ctes/unibag/promotions_ab3.sql @@ -26,6 +26,7 @@ select 'conditionforuser', boolean_to_string('isunlimitedquantity'), boolean_to_string('isapplyfororderwholesale'), + 'supplierCommission', ]) }} as _airbyte_promotions_hashid, tmp.* from {{ ref('promotions_ab2') }} tmp diff --git a/models/generated/airbyte_tables/unibag/order_items.sql b/models/generated/airbyte_tables/unibag/order_items.sql index 5f44174..bd4e192 100644 --- a/models/generated/airbyte_tables/unibag/order_items.sql +++ b/models/generated/airbyte_tables/unibag/order_items.sql @@ -27,6 +27,7 @@ select {{ adapter.quote('user') }} AS seller_id, {{ adapter.quote('order') }} AS order_id, {{ adapter.quote('product') }} AS product_id, + cast({{ adapter.quote('promotions') }} AS jsonb) AS promotions, _airbyte_ab_id, _airbyte_emitted_at, {{ current_timestamp() }} as _airbyte_normalized_at, diff --git a/models/generated/airbyte_tables/unibag/promotion_orders.sql b/models/generated/airbyte_tables/unibag/promotion_orders.sql index ad612e7..775fb9d 100644 --- a/models/generated/airbyte_tables/unibag/promotion_orders.sql +++ b/models/generated/airbyte_tables/unibag/promotion_orders.sql @@ -20,6 +20,9 @@ select -- cast({{ adapter.quote('sharepercent') }}::json->>'selly' AS numeric) AS share_percent_selly, {{ adapter.quote('supplier') }}::json->>'_id' AS supplier_id, {{ adapter.quote('supplier') }}::json->>'name' AS supplier_name, + {{ adapter.quote('suppliercommission') }}::json->>'type' AS supplier_commission_type, + cast({{ adapter.quote('suppliercommission') }}::json->>'value' AS numeric) AS supplier_commission_value, + cast({{ adapter.quote('suppliercommissiontotal') }} AS numeric) AS supplier_commission_total, _airbyte_ab_id, _airbyte_emitted_at, {{ current_timestamp() }} as _airbyte_normalized_at, diff --git a/models/generated/airbyte_tables/unibag/promotions.sql b/models/generated/airbyte_tables/unibag/promotions.sql index e699c01..9aceae2 100644 --- a/models/generated/airbyte_tables/unibag/promotions.sql +++ b/models/generated/airbyte_tables/unibag/promotions.sql @@ -22,6 +22,8 @@ select cast({{ adapter.quote('options') }}::json->'bonus'->>'value' AS numeric) AS options_bonus_value, {{ adapter.quote('conditionforuser') }}::json->>'applyFor' AS condition_for_user_apply_for, {{ adapter.quote('conditionforuser') }}::json->>'gender' AS condition_for_user_gender, + {{ adapter.quote('suppliercommission') }}::json->>'type' AS supplier_commission_type, + cast({{ adapter.quote('suppliercommission') }}::json->>'value' AS numeric) AS supplier_commission_value, articleid AS article_id, isapplyfororderwholesale AS is_apply_for_order_wholesale, createdat::timestamp AS created_at,