sync promotion

This commit is contained in:
Ubuntu 2022-04-07 10:03:41 +07:00
parent 8cf7da2c02
commit 59ac317c58
10 changed files with 16 additions and 1 deletions

View File

@ -6,5 +6,5 @@ push:
run: run:
dbt deps --profiles-dir=. --project-dir=. dbt deps --profiles-dir=. --project-dir=.
#dbt run --profiles-dir=. --project-dir=. --full-refresh #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

View File

@ -20,6 +20,8 @@ select
{{ json_extract_scalar('_airbyte_data', ['commission'], ['commission']) }} as commission, {{ json_extract_scalar('_airbyte_data', ['commission'], ['commission']) }} as commission,
{{ json_extract_scalar('_airbyte_data', ['isRejected'], ['isRejected']) }} as isrejected, {{ json_extract_scalar('_airbyte_data', ['isRejected'], ['isRejected']) }} as isrejected,
{{ json_extract_scalar('_airbyte_data', ['quantityPromotion'], ['quantityPromotion']) }} as quantitypromotion, {{ 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_ab_id,
_airbyte_emitted_at, _airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at {{ current_timestamp() }} as _airbyte_normalized_at

View File

@ -20,6 +20,8 @@ select
cast(commission as {{ dbt_utils.type_float() }}) as commission, cast(commission as {{ dbt_utils.type_float() }}) as commission,
{{ cast_to_boolean('isrejected') }} as isrejected, {{ cast_to_boolean('isrejected') }} as isrejected,
cast(quantitypromotion as {{ dbt_utils.type_float() }}) as quantitypromotion, 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_ab_id,
_airbyte_emitted_at, _airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at {{ current_timestamp() }} as _airbyte_normalized_at

View File

@ -21,6 +21,8 @@ select
'commission', 'commission',
boolean_to_string('isrejected'), boolean_to_string('isrejected'),
'quantitypromotion', 'quantitypromotion',
'supplierCommission',
'supplierCommissionTotal',
]) }} as _airbyte_promotion_orders_hashid, ]) }} as _airbyte_promotion_orders_hashid,
tmp.* tmp.*
from {{ ref('promotion_orders_ab2') }} tmp from {{ ref('promotion_orders_ab2') }} tmp

View File

@ -25,6 +25,7 @@ select
{{ json_extract_scalar('_airbyte_data', ['conditionForUser'], ['conditionForUser']) }} as conditionforuser, {{ json_extract_scalar('_airbyte_data', ['conditionForUser'], ['conditionForUser']) }} as conditionforuser,
{{ json_extract_scalar('_airbyte_data', ['isUnlimitedQuantity'], ['isUnlimitedQuantity']) }} as isunlimitedquantity, {{ json_extract_scalar('_airbyte_data', ['isUnlimitedQuantity'], ['isUnlimitedQuantity']) }} as isunlimitedquantity,
{{ json_extract_scalar('_airbyte_data', ['isApplyForOrderWholesale'], ['isApplyForOrderWholesale']) }} as isapplyfororderwholesale, {{ json_extract_scalar('_airbyte_data', ['isApplyForOrderWholesale'], ['isApplyForOrderWholesale']) }} as isapplyfororderwholesale,
{{ json_extract_scalar('_airbyte_data', ['supplierCommission'], ['supplierCommission']) }} as suppliercommission,
_airbyte_ab_id, _airbyte_ab_id,
_airbyte_emitted_at, _airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at {{ current_timestamp() }} as _airbyte_normalized_at

View File

@ -25,6 +25,7 @@ select
cast(conditionforuser as {{ dbt_utils.type_string() }}) as conditionforuser, cast(conditionforuser as {{ dbt_utils.type_string() }}) as conditionforuser,
{{ cast_to_boolean('isunlimitedquantity') }} as isunlimitedquantity, {{ cast_to_boolean('isunlimitedquantity') }} as isunlimitedquantity,
{{ cast_to_boolean('isapplyfororderwholesale') }} as isapplyfororderwholesale, {{ cast_to_boolean('isapplyfororderwholesale') }} as isapplyfororderwholesale,
cast(supplierCommission as {{ dbt_utils.type_string() }}) as supplierCommission,
_airbyte_ab_id, _airbyte_ab_id,
_airbyte_emitted_at, _airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at {{ current_timestamp() }} as _airbyte_normalized_at

View File

@ -26,6 +26,7 @@ select
'conditionforuser', 'conditionforuser',
boolean_to_string('isunlimitedquantity'), boolean_to_string('isunlimitedquantity'),
boolean_to_string('isapplyfororderwholesale'), boolean_to_string('isapplyfororderwholesale'),
'supplierCommission',
]) }} as _airbyte_promotions_hashid, ]) }} as _airbyte_promotions_hashid,
tmp.* tmp.*
from {{ ref('promotions_ab2') }} tmp from {{ ref('promotions_ab2') }} tmp

View File

@ -27,6 +27,7 @@ select
{{ adapter.quote('user') }} AS seller_id, {{ adapter.quote('user') }} AS seller_id,
{{ adapter.quote('order') }} AS order_id, {{ adapter.quote('order') }} AS order_id,
{{ adapter.quote('product') }} AS product_id, {{ adapter.quote('product') }} AS product_id,
cast({{ adapter.quote('promotions') }} AS jsonb) AS promotions,
_airbyte_ab_id, _airbyte_ab_id,
_airbyte_emitted_at, _airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at, {{ current_timestamp() }} as _airbyte_normalized_at,

View File

@ -20,6 +20,9 @@ select
-- cast({{ adapter.quote('sharepercent') }}::json->>'selly' AS numeric) AS share_percent_selly, -- cast({{ adapter.quote('sharepercent') }}::json->>'selly' AS numeric) AS share_percent_selly,
{{ adapter.quote('supplier') }}::json->>'_id' AS supplier_id, {{ adapter.quote('supplier') }}::json->>'_id' AS supplier_id,
{{ adapter.quote('supplier') }}::json->>'name' AS supplier_name, {{ 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_ab_id,
_airbyte_emitted_at, _airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at, {{ current_timestamp() }} as _airbyte_normalized_at,

View File

@ -22,6 +22,8 @@ select
cast({{ adapter.quote('options') }}::json->'bonus'->>'value' AS numeric) AS options_bonus_value, 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->>'applyFor' AS condition_for_user_apply_for,
{{ adapter.quote('conditionforuser') }}::json->>'gender' AS condition_for_user_gender, {{ 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, articleid AS article_id,
isapplyfororderwholesale AS is_apply_for_order_wholesale, isapplyfororderwholesale AS is_apply_for_order_wholesale,
createdat::timestamp AS created_at, createdat::timestamp AS created_at,