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

73 lines
5.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 cast each column to its adequate SQL type converted from the JSON schema type
-- depends_on: {{ ref('users_statistic_ab1') }}
select
_airbyte_users_hashid,
cast(cashtotal as {{ dbt_utils.type_float() }}) as cashtotal,
cast(cashpending as {{ dbt_utils.type_float() }}) as cashpending,
cast(cashcashback as {{ dbt_utils.type_float() }}) as cashcashback,
cast(cashgivegift as {{ dbt_utils.type_float() }}) as cashgivegift,
cast(cashrejected as {{ dbt_utils.type_float() }}) as cashrejected,
cast(taxtotalcash as {{ dbt_utils.type_float() }}) as taxtotalcash,
cast(totalgiftbox as {{ dbt_utils.type_float() }}) as totalgiftbox,
cast(totaltickets as {{ dbt_utils.type_float() }}) as totaltickets,
cast(cashcancelled as {{ dbt_utils.type_float() }}) as cashcancelled,
cast(cashdelivered as {{ dbt_utils.type_float() }}) as cashdelivered,
cast(cashremaining as {{ dbt_utils.type_float() }}) as cashremaining,
cast(customertotal as {{ dbt_utils.type_float() }}) as customertotal,
cast(totalcartitem as {{ dbt_utils.type_float() }}) as totalcartitem,
cast(withdrawtotal as {{ dbt_utils.type_float() }}) as withdrawtotal,
cast(cashdelivering as {{ dbt_utils.type_float() }}) as cashdelivering,
cast(taxcashpending as {{ dbt_utils.type_float() }}) as taxcashpending,
cast(withdrawpending as {{ dbt_utils.type_float() }}) as withdrawpending,
cast(withdrawsuccess as {{ dbt_utils.type_float() }}) as withdrawsuccess,
cast(revenuelastmonth as {{ dbt_utils.type_float() }}) as revenuelastmonth,
cast(totalsalesuccess as {{ dbt_utils.type_float() }}) as totalsalesuccess,
cast(transactiontotal as {{ dbt_utils.type_float() }}) as transactiontotal,
cast(withdrawrejected as {{ dbt_utils.type_float() }}) as withdrawrejected,
cast(cashwithdrawtotal as {{ dbt_utils.type_float() }}) as cashwithdrawtotal,
cast(cashwaitingapprove as {{ dbt_utils.type_float() }}) as cashwaitingapprove,
cast(transactionpending as {{ dbt_utils.type_float() }}) as transactionpending,
cast(transactionsuccess as {{ dbt_utils.type_float() }}) as transactionsuccess,
cast(cashwithdrawpending as {{ dbt_utils.type_float() }}) as cashwithdrawpending,
cast(cashwithdrawsuccess as {{ dbt_utils.type_float() }}) as cashwithdrawsuccess,
cast(highestmonthlysales as {{ dbt_utils.type_float() }}) as highestmonthlysales,
cast(transactionrejected as {{ dbt_utils.type_float() }}) as transactionrejected,
cast(cashwithdrawrejected as {{ dbt_utils.type_float() }}) as cashwithdrawrejected,
cast(teambonuspendingcash as {{ dbt_utils.type_float() }}) as teambonuspendingcash,
cast(teambonussuccesscash as {{ dbt_utils.type_float() }}) as teambonussuccesscash,
cast(transactiondelivered as {{ dbt_utils.type_float() }}) as transactiondelivered,
cast(cashpaymentprocessing as {{ dbt_utils.type_float() }}) as cashpaymentprocessing,
cast(transactiondelivering as {{ dbt_utils.type_float() }}) as transactiondelivering,
cast(eventrewardpendingcash as {{ dbt_utils.type_float() }}) as eventrewardpendingcash,
cast(eventrewardsuccesscash as {{ dbt_utils.type_float() }}) as eventrewardsuccesscash,
cast(transactioncashpending as {{ dbt_utils.type_float() }}) as transactioncashpending,
cast(voucherbonuspendingcash as {{ dbt_utils.type_float() }}) as voucherbonuspendingcash,
cast(voucherbonussuccesscash as {{ dbt_utils.type_float() }}) as voucherbonussuccesscash,
cast(eventreferralpendingcash as {{ dbt_utils.type_float() }}) as eventreferralpendingcash,
cast(eventreferralsuccesscash as {{ dbt_utils.type_float() }}) as eventreferralsuccesscash,
cast(promotionbonuspendingcash as {{ dbt_utils.type_float() }}) as promotionbonuspendingcash,
cast(promotionbonussuccesscash as {{ dbt_utils.type_float() }}) as promotionbonussuccesscash,
cast(transactionwaitingapprove as {{ dbt_utils.type_float() }}) as transactionwaitingapprove,
cast(commissiontransactiontotal as {{ dbt_utils.type_float() }}) as commissiontransactiontotal,
cast(membershipbonuspendingcash as {{ dbt_utils.type_float() }}) as membershipbonuspendingcash,
cast(membershipbonussuccesscash as {{ dbt_utils.type_float() }}) as membershipbonussuccesscash,
cast(commissiontransactionpending as {{ dbt_utils.type_float() }}) as commissiontransactionpending,
cast(transactionpaymentprocessing as {{ dbt_utils.type_float() }}) as transactionpaymentprocessing,
cast(commissiontransactioncashback as {{ dbt_utils.type_float() }}) as commissiontransactioncashback,
cast(commissiontransactionrejected as {{ dbt_utils.type_float() }}) as commissiontransactionrejected,
cast(commissiontransactiondelivered as {{ dbt_utils.type_float() }}) as commissiontransactiondelivered,
cast(commissiontransactiondelivering as {{ dbt_utils.type_float() }}) as commissiontransactiondelivering,
cast(revenuethismonth_aibyte_transform as {{ dbt_utils.type_string() }}) as revenuethismonth_aibyte_transform,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('users_statistic_ab1') }}
-- statistic at users/statistic
where 1 = 1