dbt-selly/models/generated/airbyte_ctes/unibag/users_statistic_ab3.sql

73 lines
2.2 KiB
MySQL
Raw Permalink Normal View History

2022-05-10 14:30:53 +00:00
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('users_statistic_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_users_hashid',
'cashtotal',
'cashpending',
'cashcashback',
'cashgivegift',
'cashrejected',
'taxtotalcash',
'totalgiftbox',
'totaltickets',
'cashcancelled',
'cashdelivered',
'cashremaining',
'customertotal',
'totalcartitem',
'withdrawtotal',
'cashdelivering',
'taxcashpending',
'withdrawpending',
'withdrawsuccess',
'revenuelastmonth',
'totalsalesuccess',
'transactiontotal',
'withdrawrejected',
'cashwithdrawtotal',
'cashwaitingapprove',
'transactionpending',
'transactionsuccess',
'cashwithdrawpending',
'cashwithdrawsuccess',
'highestmonthlysales',
'transactionrejected',
'cashwithdrawrejected',
'teambonuspendingcash',
'teambonussuccesscash',
'transactiondelivered',
'cashpaymentprocessing',
'transactiondelivering',
'eventrewardpendingcash',
'eventrewardsuccesscash',
'transactioncashpending',
'voucherbonuspendingcash',
'voucherbonussuccesscash',
'eventreferralpendingcash',
'eventreferralsuccesscash',
'promotionbonuspendingcash',
'promotionbonussuccesscash',
'transactionwaitingapprove',
'commissiontransactiontotal',
'membershipbonuspendingcash',
'membershipbonussuccesscash',
'commissiontransactionpending',
'transactionpaymentprocessing',
'commissiontransactioncashback',
'commissiontransactionrejected',
'commissiontransactiondelivered',
'commissiontransactiondelivering',
'revenuethismonth_aibyte_transform',
]) }} as _airbyte_statistic_hashid,
tmp.*
from {{ ref('users_statistic_ab2') }} tmp
-- statistic at users/statistic
where 1 = 1