75 lines
2.0 KiB
MySQL
75 lines
2.0 KiB
MySQL
|
{{ config(
|
||
|
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
|
||
|
unique_key = '_airbyte_ab_id',
|
||
|
schema = "_airbyte_unibag",
|
||
|
tags = [ "top-level-intermediate" ]
|
||
|
) }}
|
||
|
-- SQL model to build a hash column based on the values of this record
|
||
|
-- depends_on: {{ ref('orders_ab2') }}
|
||
|
select
|
||
|
{{ dbt_utils.surrogate_key([
|
||
|
'_id',
|
||
|
'code',
|
||
|
adapter.quote('date'),
|
||
|
adapter.quote('hour'),
|
||
|
'note',
|
||
|
array_to_string('tags'),
|
||
|
adapter.quote('user'),
|
||
|
'price',
|
||
|
boolean_to_string('banned'),
|
||
|
'reason',
|
||
|
adapter.quote('source'),
|
||
|
'status',
|
||
|
'teamid',
|
||
|
'payment',
|
||
|
'remarks',
|
||
|
'customer',
|
||
|
'delivery',
|
||
|
boolean_to_string('iscalled'),
|
||
|
'merchant',
|
||
|
'pickupat',
|
||
|
'supplier',
|
||
|
'createdat',
|
||
|
'inventory',
|
||
|
'invoiceid',
|
||
|
boolean_to_string('isdeleted'),
|
||
|
'promotion',
|
||
|
'requestid',
|
||
|
'restockat',
|
||
|
'sendemail',
|
||
|
'totalitem',
|
||
|
'updatedat',
|
||
|
'useragent',
|
||
|
boolean_to_string('wholesale'),
|
||
|
'approvedat',
|
||
|
'cashbackat',
|
||
|
boolean_to_string('ispreorder'),
|
||
|
boolean_to_string('isreviewed'),
|
||
|
'rejectedat',
|
||
|
'deliveredat',
|
||
|
'deliveringat',
|
||
|
'deliverycode',
|
||
|
'searchstring',
|
||
|
'staffapprove',
|
||
|
'teammemberid',
|
||
|
'processstatus',
|
||
|
'hooktimelastat',
|
||
|
boolean_to_string('isassigncoupon'),
|
||
|
boolean_to_string('isautoapproved'),
|
||
|
'outboundrequest',
|
||
|
'trackingcodeurl',
|
||
|
'trackingcode',
|
||
|
'waitingcancelby',
|
||
|
boolean_to_string('ischangedelivery'),
|
||
|
'estimatecashbackat',
|
||
|
boolean_to_string('fromnewactivebuyer'),
|
||
|
boolean_to_string('iswaitingcancelled'),
|
||
|
boolean_to_string('fromnewactiveseller'),
|
||
|
'waitingcancelreason',
|
||
|
]) }} as _airbyte_orders_hashid,
|
||
|
tmp.*
|
||
|
from {{ ref('orders_ab2') }} tmp
|
||
|
-- orders
|
||
|
where 1 = 1
|
||
|
|