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

75 lines
2.0 KiB
MySQL
Raw Normal View History

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',
array_to_string('tags'),
adapter.quote('user'),
2022-05-11 04:21:03 +00:00
'price',
2022-03-22 04:03:52 +00:00
boolean_to_string('banned'),
'reason',
adapter.quote('source'),
'status',
2022-05-11 04:21:03 +00:00
'teamid',
'payment',
2022-03-22 04:03:52 +00:00
'remarks',
'customer',
2022-05-11 04:21:03 +00:00
'delivery',
boolean_to_string('iscalled'),
'merchant',
2022-03-22 04:03:52 +00:00
'pickupat',
2022-05-11 04:21:03 +00:00
'supplier',
2022-03-22 04:03:52 +00:00
'createdat',
2022-05-11 04:21:03 +00:00
'inventory',
'invoiceid',
2022-03-22 04:03:52 +00:00
boolean_to_string('isdeleted'),
2022-05-11 04:21:03 +00:00
'promotion',
2022-03-22 04:03:52 +00:00
'requestid',
2022-05-11 04:21:03 +00:00
'restockat',
'sendemail',
2022-03-22 04:03:52 +00:00
'totalitem',
'updatedat',
2022-05-11 04:21:03 +00:00
'useragent',
2022-03-22 04:03:52 +00:00
boolean_to_string('wholesale'),
'approvedat',
'cashbackat',
boolean_to_string('ispreorder'),
2022-05-11 04:21:03 +00:00
boolean_to_string('isreviewed'),
2022-03-22 04:03:52 +00:00
'rejectedat',
'deliveredat',
'deliveringat',
'deliverycode',
'searchstring',
'staffapprove',
2022-05-11 04:21:03 +00:00
'teammemberid',
2022-03-22 04:03:52 +00:00
'processstatus',
'hooktimelastat',
2022-05-11 04:21:03 +00:00
boolean_to_string('isassigncoupon'),
boolean_to_string('isautoapproved'),
'outboundrequest',
2022-03-22 04:03:52 +00:00
'trackingcodeurl',
2022-05-11 04:21:03 +00:00
'trackingcode',
'waitingcancelby',
2022-03-22 04:03:52 +00:00
boolean_to_string('ischangedelivery'),
'estimatecashbackat',
2022-05-11 04:21:03 +00:00
boolean_to_string('fromnewactivebuyer'),
2022-03-22 04:03:52 +00:00
boolean_to_string('iswaitingcancelled'),
boolean_to_string('fromnewactiveseller'),
2022-05-11 04:21:03 +00:00
'waitingcancelreason',
2022-03-22 04:03:52 +00:00
]) }} as _airbyte_orders_hashid,
tmp.*
from {{ ref('orders_ab2') }} tmp
-- orders
where 1 = 1