2022-03-22 04:03:52 +00:00
|
|
|
{{ 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',
|
2022-05-10 14:30:53 +00:00
|
|
|
array_to_string('skus'),
|
2022-03-22 04:03:52 +00:00
|
|
|
array_to_string('tags'),
|
|
|
|
adapter.quote('user'),
|
2022-05-10 14:30:53 +00:00
|
|
|
object_to_string('price'),
|
2022-03-22 04:03:52 +00:00
|
|
|
boolean_to_string('banned'),
|
|
|
|
'reason',
|
|
|
|
adapter.quote('source'),
|
|
|
|
'status',
|
2022-05-10 14:30:53 +00:00
|
|
|
adapter.quote('update'),
|
|
|
|
object_to_string('payment'),
|
2022-03-22 04:03:52 +00:00
|
|
|
'remarks',
|
|
|
|
'customer',
|
2022-05-10 14:30:53 +00:00
|
|
|
object_to_string('delivery'),
|
2022-03-22 04:03:52 +00:00
|
|
|
'pickupat',
|
2022-05-10 14:30:53 +00:00
|
|
|
array_to_string('products'),
|
|
|
|
object_to_string('supplier'),
|
|
|
|
'approveat',
|
2022-03-22 04:03:52 +00:00
|
|
|
'createdat',
|
2022-05-10 14:30:53 +00:00
|
|
|
object_to_string('inventory'),
|
2022-03-22 04:03:52 +00:00
|
|
|
boolean_to_string('isdeleted'),
|
2022-05-10 14:30:53 +00:00
|
|
|
object_to_string('promotion'),
|
2022-03-22 04:03:52 +00:00
|
|
|
'requestid',
|
2022-05-10 14:30:53 +00:00
|
|
|
object_to_string('sendemail'),
|
2022-03-22 04:03:52 +00:00
|
|
|
'totalitem',
|
|
|
|
'updatedat',
|
2022-05-10 14:30:53 +00:00
|
|
|
object_to_string('useragent'),
|
2022-03-22 04:03:52 +00:00
|
|
|
boolean_to_string('wholesale'),
|
|
|
|
'approvedat',
|
|
|
|
'cashbackat',
|
2022-05-10 14:30:53 +00:00
|
|
|
'codeosiris',
|
2022-03-22 04:03:52 +00:00
|
|
|
boolean_to_string('ispreorder'),
|
2022-05-10 14:30:53 +00:00
|
|
|
'membership',
|
2022-03-22 04:03:52 +00:00
|
|
|
'rejectedat',
|
|
|
|
'deliveredat',
|
|
|
|
'deliveringat',
|
|
|
|
'deliverycode',
|
|
|
|
'searchstring',
|
|
|
|
'staffapprove',
|
2022-05-10 14:30:53 +00:00
|
|
|
'trackingcode',
|
2022-03-22 04:03:52 +00:00
|
|
|
'processstatus',
|
|
|
|
'hooktimelastat',
|
|
|
|
'trackingcodeurl',
|
2022-05-10 14:30:53 +00:00
|
|
|
'approvepaymentat',
|
2022-03-22 04:03:52 +00:00
|
|
|
boolean_to_string('ischangedelivery'),
|
2022-05-10 14:30:53 +00:00
|
|
|
'trackingordercode',
|
2022-03-22 04:03:52 +00:00
|
|
|
'estimatecashbackat',
|
|
|
|
boolean_to_string('iswaitingcancelled'),
|
|
|
|
boolean_to_string('fromnewactiveseller'),
|
|
|
|
]) }} as _airbyte_orders_hashid,
|
|
|
|
tmp.*
|
|
|
|
from {{ ref('orders_ab2') }} tmp
|
|
|
|
-- orders
|
|
|
|
where 1 = 1
|
|
|
|
|