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

70 lines
1.9 KiB
SQL

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