This commit is contained in:
Ubuntu 2022-05-11 11:21:03 +07:00
parent eef556e75c
commit a2286f7773
531 changed files with 391 additions and 10174 deletions

View File

@ -12,7 +12,7 @@ select
{{ json_extract_scalar('_airbyte_data', ['user'], ['user']) }} as {{ adapter.quote('user') }},
{{ json_extract_scalar('_airbyte_data', ['value'], ['value']) }} as {{ adapter.quote('value') }},
{{ json_extract_scalar('_airbyte_data', ['action'], ['action']) }} as {{ adapter.quote('action') }},
{{ json_extract('table_alias', '_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
{{ json_extract_scalar('_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
{{ json_extract_scalar('_airbyte_data', ['category'], ['category']) }} as category,
{{ json_extract_scalar('_airbyte_data', ['targetId'], ['targetId']) }} as targetid,
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,

View File

@ -12,7 +12,7 @@ select
cast({{ adapter.quote('user') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('user') }},
cast({{ adapter.quote('value') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('value') }},
cast({{ adapter.quote('action') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('action') }},
cast({{ adapter.quote('options') }} as {{ type_json() }}) as {{ adapter.quote('options') }},
cast({{ adapter.quote('options') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('options') }},
cast(category as {{ dbt_utils.type_string() }}) as category,
cast(targetid as {{ dbt_utils.type_string() }}) as targetid,
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,

View File

@ -13,7 +13,7 @@ select
adapter.quote('user'),
adapter.quote('value'),
adapter.quote('action'),
object_to_string(adapter.quote('options')),
adapter.quote('options'),
'category',
'targetid',
'createdat',

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('cash_flows') }}
select
_airbyte_cash_flows_hashid,
{{ json_extract_scalar(adapter.quote('options'), ['orderId'], ['orderId']) }} as orderid,
{{ json_extract_scalar(adapter.quote('options'), ['orderCode'], ['orderCode']) }} as ordercode,
{{ json_extract_scalar(adapter.quote('options'), ['giveGiftId'], ['giveGiftId']) }} as givegiftid,
{{ json_extract_scalar(adapter.quote('options'), ['giveGiftTitle'], ['giveGiftTitle']) }} as givegifttitle,
{{ json_extract_scalar(adapter.quote('options'), ['userGiveGiftId'], ['userGiveGiftId']) }} as usergivegiftid,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('cash_flows') }} as table_alias
-- options at cash-flows/options
where 1 = 1
and {{ adapter.quote('options') }} is not null

View File

@ -1,21 +0,0 @@
{{ 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('cash_flows_options_ab1') }}
select
_airbyte_cash_flows_hashid,
cast(orderid as {{ dbt_utils.type_string() }}) as orderid,
cast(ordercode as {{ dbt_utils.type_string() }}) as ordercode,
cast(givegiftid as {{ dbt_utils.type_string() }}) as givegiftid,
cast(givegifttitle as {{ dbt_utils.type_string() }}) as givegifttitle,
cast(usergivegiftid as {{ dbt_utils.type_string() }}) as usergivegiftid,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('cash_flows_options_ab1') }}
-- options at cash-flows/options
where 1 = 1

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('cash_flows_options_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_cash_flows_hashid',
'orderid',
'ordercode',
'givegiftid',
'givegifttitle',
'usergivegiftid',
]) }} as _airbyte_options_hashid,
tmp.*
from {{ ref('cash_flows_options_ab2') }} tmp
-- options at cash-flows/options
where 1 = 1

View File

@ -8,15 +8,16 @@
-- depends_on: {{ source('unibag', '_airbyte_raw_customers') }}
select
{{ json_extract_scalar('_airbyte_data', ['_id'], ['_id']) }} as _id,
{{ json_extract('table_alias', '_airbyte_data', ['info'], ['info']) }} as info,
{{ json_extract_scalar('_airbyte_data', ['info'], ['info']) }} as info,
{{ json_extract_scalar('_airbyte_data', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar('_airbyte_data', ['user'], ['user']) }} as {{ adapter.quote('user') }},
{{ json_extract_scalar('_airbyte_data', ['email'], ['email']) }} as email,
{{ json_extract_scalar('_airbyte_data', ['phone'], ['phone']) }} as phone,
{{ json_extract_scalar('_airbyte_data', ['source'], ['source']) }} as {{ adapter.quote('source') }},
{{ json_extract_array('_airbyte_data', ['location'], ['location']) }} as {{ adapter.quote('location') }},
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,
{{ json_extract_scalar('_airbyte_data', ['isDeleted'], ['isDeleted']) }} as isdeleted,
{{ json_extract('table_alias', '_airbyte_data', ['statistic'], ['statistic']) }} as statistic,
{{ json_extract_scalar('_airbyte_data', ['statistic'], ['statistic']) }} as statistic,
{{ json_extract_scalar('_airbyte_data', ['updatedAt'], ['updatedAt']) }} as updatedat,
{{ json_extract_scalar('_airbyte_data', ['searchString'], ['searchString']) }} as searchstring,
_airbyte_ab_id,

View File

@ -8,15 +8,16 @@
-- depends_on: {{ ref('customers_ab1') }}
select
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast(info as {{ type_json() }}) as info,
cast(info as {{ dbt_utils.type_string() }}) as info,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast({{ adapter.quote('user') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('user') }},
cast(email as {{ dbt_utils.type_string() }}) as email,
cast(phone as {{ dbt_utils.type_string() }}) as phone,
cast({{ adapter.quote('source') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('source') }},
{{ adapter.quote('location') }},
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
{{ cast_to_boolean('isdeleted') }} as isdeleted,
cast(statistic as {{ type_json() }}) as statistic,
cast(statistic as {{ dbt_utils.type_string() }}) as statistic,
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
cast(searchstring as {{ dbt_utils.type_string() }}) as searchstring,
_airbyte_ab_id,

View File

@ -9,15 +9,16 @@
select
{{ dbt_utils.surrogate_key([
'_id',
object_to_string('info'),
'info',
adapter.quote('name'),
adapter.quote('user'),
'email',
'phone',
adapter.quote('source'),
array_to_string(adapter.quote('location')),
'createdat',
boolean_to_string('isdeleted'),
object_to_string('statistic'),
'statistic',
'updatedat',
'searchstring',
]) }} as _airbyte_customers_hashid,

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('customers') }}
select
_airbyte_customers_hashid,
{{ json_extract_scalar('info', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar('info', ['email'], ['email']) }} as email,
{{ json_extract_scalar('info', ['address'], ['address']) }} as address,
{{ json_extract_scalar('info', ['companyName'], ['companyName']) }} as companyname,
{{ json_extract_scalar('info', ['taxIdentificationNumber'], ['taxIdentificationNumber']) }} as taxidentificationnumber,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('customers') }} as table_alias
-- info at customers/info
where 1 = 1
and info is not null

View File

@ -1,21 +0,0 @@
{{ 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('customers_info_ab1') }}
select
_airbyte_customers_hashid,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(email as {{ dbt_utils.type_string() }}) as email,
cast(address as {{ dbt_utils.type_string() }}) as address,
cast(companyname as {{ dbt_utils.type_string() }}) as companyname,
cast(taxidentificationnumber as {{ dbt_utils.type_string() }}) as taxidentificationnumber,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('customers_info_ab1') }}
-- info at customers/info
where 1 = 1

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('customers_info_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_customers_hashid',
adapter.quote('name'),
'email',
'address',
'companyname',
'taxidentificationnumber',
]) }} as _airbyte_info_hashid,
tmp.*
from {{ ref('customers_info_ab2') }} tmp
-- info at customers/info
where 1 = 1

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('customers') }}
select
_airbyte_customers_hashid,
{{ json_extract_scalar('statistic', ['expenseTotal'], ['expenseTotal']) }} as expensetotal,
{{ json_extract_scalar('statistic', ['transactionTotal_aibyte_transform'], ['transactionTotal_aibyte_transform']) }} as transactiontotal_aibyte_transform,
{{ json_extract_scalar('statistic', ['transactionPending_aibyte_transform'], ['transactionPending_aibyte_transform']) }} as transactionpending_aibyte_transform,
{{ json_extract_scalar('statistic', ['transactionSuccess_aibyte_transform'], ['transactionSuccess_aibyte_transform']) }} as transactionsuccess_aibyte_transform,
{{ json_extract_scalar('statistic', ['transactionRejected_aibyte_transform'], ['transactionRejected_aibyte_transform']) }} as transactionrejected_aibyte_transform,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('customers') }} as table_alias
-- statistic at customers/statistic
where 1 = 1
and statistic is not null

View File

@ -1,21 +0,0 @@
{{ 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('customers_statistic_ab1') }}
select
_airbyte_customers_hashid,
cast(expensetotal as {{ dbt_utils.type_float() }}) as expensetotal,
cast(transactiontotal_aibyte_transform as {{ dbt_utils.type_string() }}) as transactiontotal_aibyte_transform,
cast(transactionpending_aibyte_transform as {{ dbt_utils.type_string() }}) as transactionpending_aibyte_transform,
cast(transactionsuccess_aibyte_transform as {{ dbt_utils.type_string() }}) as transactionsuccess_aibyte_transform,
cast(transactionrejected_aibyte_transform as {{ dbt_utils.type_string() }}) as transactionrejected_aibyte_transform,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('customers_statistic_ab1') }}
-- statistic at customers/statistic
where 1 = 1

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('customers_statistic_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_customers_hashid',
'expensetotal',
'transactiontotal_aibyte_transform',
'transactionpending_aibyte_transform',
'transactionsuccess_aibyte_transform',
'transactionrejected_aibyte_transform',
]) }} as _airbyte_statistic_hashid,
tmp.*
from {{ ref('customers_statistic_ab2') }} tmp
-- statistic at customers/statistic
where 1 = 1

View File

@ -13,7 +13,7 @@ select
{{ json_extract_scalar('_airbyte_data', ['user'], ['user']) }} as {{ adapter.quote('user') }},
{{ json_extract_scalar('_airbyte_data', ['event'], ['event']) }} as {{ adapter.quote('event') }},
{{ json_extract_scalar('_airbyte_data', ['status'], ['status']) }} as status,
{{ json_extract('table_alias', '_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
{{ json_extract_scalar('_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,
{{ json_extract_scalar('_airbyte_data', ['updatedat'], ['updatedat']) }} as updatedat,
_airbyte_ab_id,

View File

@ -13,7 +13,7 @@ select
cast({{ adapter.quote('user') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('user') }},
cast({{ adapter.quote('event') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('event') }},
cast(status as {{ dbt_utils.type_string() }}) as status,
cast({{ adapter.quote('options') }} as {{ type_json() }}) as {{ adapter.quote('options') }},
cast({{ adapter.quote('options') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('options') }},
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
_airbyte_ab_id,

View File

@ -14,7 +14,7 @@ select
adapter.quote('user'),
adapter.quote('event'),
'status',
object_to_string(adapter.quote('options')),
adapter.quote('options'),
'createdat',
'updatedat',
]) }} as _airbyte_event_rewards_hashid,

View File

@ -1,23 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('event_rewards') }}
select
_airbyte_event_rewards_hashid,
{{ json_extract_scalar(adapter.quote('options'), ['order'], ['order']) }} as {{ adapter.quote('order') }},
{{ json_extract_scalar(adapter.quote('options'), ['invitee'], ['invitee']) }} as invitee,
{{ json_extract_scalar(adapter.quote('options'), ['percent'], ['percent']) }} as {{ adapter.quote('percent') }},
{{ json_extract_scalar(adapter.quote('options'), ['referral'], ['referral']) }} as referral,
{{ json_extract_scalar(adapter.quote('options'), ['minOrderValue'], ['minOrderValue']) }} as minordervalue,
{{ json_extract_scalar(adapter.quote('options'), ['minOrderToClaim'], ['minOrderToClaim']) }} as minordertoclaim,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('event_rewards') }} as table_alias
-- options at event-rewards/options
where 1 = 1
and {{ adapter.quote('options') }} is not null

View File

@ -1,22 +0,0 @@
{{ 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('event_rewards_options_ab1') }}
select
_airbyte_event_rewards_hashid,
cast({{ adapter.quote('order') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('order') }},
cast(invitee as {{ dbt_utils.type_string() }}) as invitee,
cast({{ adapter.quote('percent') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('percent') }},
cast(referral as {{ dbt_utils.type_string() }}) as referral,
cast(minordervalue as {{ dbt_utils.type_float() }}) as minordervalue,
cast(minordertoclaim as {{ dbt_utils.type_float() }}) as minordertoclaim,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('event_rewards_options_ab1') }}
-- options at event-rewards/options
where 1 = 1

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('event_rewards_options_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_event_rewards_hashid',
adapter.quote('order'),
'invitee',
adapter.quote('percent'),
'referral',
'minordervalue',
'minordertoclaim',
]) }} as _airbyte_options_hashid,
tmp.*
from {{ ref('event_rewards_options_ab2') }} tmp
-- options at event-rewards/options
where 1 = 1

View File

@ -8,20 +8,21 @@
-- depends_on: {{ source('unibag', '_airbyte_raw_events') }}
select
{{ json_extract_scalar('_airbyte_data', ['_id'], ['_id']) }} as _id,
{{ json_extract_scalar('_airbyte_data', ['code'], ['code']) }} as code,
{{ json_extract_scalar('_airbyte_data', ['desc'], ['desc']) }} as {{ adapter.quote('desc') }},
{{ json_extract('table_alias', '_airbyte_data', ['icon'], ['icon']) }} as icon,
{{ json_extract_scalar('_airbyte_data', ['icon'], ['icon']) }} as icon,
{{ json_extract_scalar('_airbyte_data', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar('_airbyte_data', ['type'], ['type']) }} as {{ adapter.quote('type') }},
{{ json_extract('table_alias', '_airbyte_data', ['cover'], ['cover']) }} as cover,
{{ json_extract_scalar('_airbyte_data', ['cover'], ['cover']) }} as cover,
{{ json_extract_scalar('_airbyte_data', ['endAt'], ['endAt']) }} as endat,
{{ json_extract_scalar('_airbyte_data', ['active'], ['active']) }} as active,
{{ json_extract('table_alias', '_airbyte_data', ['notice'], ['notice']) }} as notice,
{{ json_extract_scalar('_airbyte_data', ['notice'], ['notice']) }} as notice,
{{ json_extract_scalar('_airbyte_data', ['screen'], ['screen']) }} as screen,
{{ json_extract_scalar('_airbyte_data', ['article'], ['article']) }} as article,
{{ json_extract('table_alias', '_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
{{ json_extract_scalar('_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
{{ json_extract_scalar('_airbyte_data', ['startAt'], ['startAt']) }} as startat,
{{ json_extract('table_alias', '_airbyte_data', ['segments'], ['segments']) }} as segments,
{{ json_extract_scalar('_airbyte_data', ['segments'], ['segments']) }} as segments,
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,
{{ json_extract_scalar('_airbyte_data', ['groupType'], ['groupType']) }} as grouptype,
{{ json_extract_array('_airbyte_data', ['suppliers'], ['suppliers']) }} as suppliers,
{{ json_extract_scalar('_airbyte_data', ['updatedAt'], ['updatedAt']) }} as updatedat,
{{ json_extract_array('_airbyte_data', ['information'], ['information']) }} as information,

View File

@ -8,20 +8,21 @@
-- depends_on: {{ ref('events_ab1') }}
select
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast(code as {{ dbt_utils.type_string() }}) as code,
cast({{ adapter.quote('desc') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('desc') }},
cast(icon as {{ type_json() }}) as icon,
cast(icon as {{ dbt_utils.type_string() }}) as icon,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast({{ adapter.quote('type') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('type') }},
cast(cover as {{ type_json() }}) as cover,
cast(cover as {{ dbt_utils.type_string() }}) as cover,
cast(endat as {{ dbt_utils.type_string() }}) as endat,
{{ cast_to_boolean('active') }} as active,
cast(notice as {{ type_json() }}) as notice,
cast(notice as {{ dbt_utils.type_string() }}) as notice,
cast(screen as {{ dbt_utils.type_string() }}) as screen,
cast(article as {{ dbt_utils.type_string() }}) as article,
cast({{ adapter.quote('options') }} as {{ type_json() }}) as {{ adapter.quote('options') }},
cast({{ adapter.quote('options') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('options') }},
cast(startat as {{ dbt_utils.type_string() }}) as startat,
cast(segments as {{ type_json() }}) as segments,
cast(segments as {{ dbt_utils.type_string() }}) as segments,
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
cast(grouptype as {{ dbt_utils.type_string() }}) as grouptype,
suppliers,
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
information,

View File

@ -9,20 +9,21 @@
select
{{ dbt_utils.surrogate_key([
'_id',
'code',
adapter.quote('desc'),
object_to_string('icon'),
'icon',
adapter.quote('name'),
adapter.quote('type'),
object_to_string('cover'),
'cover',
'endat',
boolean_to_string('active'),
object_to_string('notice'),
'notice',
'screen',
'article',
object_to_string(adapter.quote('options')),
adapter.quote('options'),
'startat',
object_to_string('segments'),
'segments',
'createdat',
'grouptype',
array_to_string('suppliers'),
'updatedat',
array_to_string('information'),

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events') }}
select
_airbyte_events_hashid,
{{ json_extract_scalar('cover', ['_id'], ['_id']) }} as _id,
{{ json_extract_scalar('cover', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract('table_alias', 'cover', ['dimensions'], ['dimensions']) }} as dimensions,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events') }} as table_alias
-- cover at events/cover
where 1 = 1
and cover is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_cover_ab1') }}
select
_airbyte_events_hashid,
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(dimensions as {{ type_json() }}) as dimensions,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover_ab1') }}
-- cover at events/cover
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_cover_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_events_hashid',
'_id',
adapter.quote('name'),
object_to_string('dimensions'),
]) }} as _airbyte_cover_hashid,
tmp.*
from {{ ref('events_cover_ab2') }} tmp
-- cover at events/cover
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_cover') }}
select
_airbyte_cover_hashid,
{{ json_extract('table_alias', 'dimensions', ['md'], ['md']) }} as md,
{{ json_extract('table_alias', 'dimensions', ['sm'], ['sm']) }} as sm,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover') }} as table_alias
-- dimensions at events/cover/dimensions
where 1 = 1
and dimensions is not null

View File

@ -1,18 +0,0 @@
{{ 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('events_cover_dimensions_ab1') }}
select
_airbyte_cover_hashid,
cast(md as {{ type_json() }}) as md,
cast(sm as {{ type_json() }}) as sm,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover_dimensions_ab1') }}
-- dimensions at events/cover/dimensions
where 1 = 1

View File

@ -1,18 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_cover_dimensions_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_cover_hashid',
object_to_string('md'),
object_to_string('sm'),
]) }} as _airbyte_dimensions_hashid,
tmp.*
from {{ ref('events_cover_dimensions_ab2') }} tmp
-- dimensions at events/cover/dimensions
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_cover_dimensions') }}
select
_airbyte_dimensions_hashid,
{{ json_extract_scalar('md', ['url'], ['url']) }} as url,
{{ json_extract_scalar('md', ['width'], ['width']) }} as width,
{{ json_extract_scalar('md', ['height'], ['height']) }} as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover_dimensions') }} as table_alias
-- md at events/cover/dimensions/md
where 1 = 1
and md is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_cover_dimensions_md_ab1') }}
select
_airbyte_dimensions_hashid,
cast(url as {{ dbt_utils.type_string() }}) as url,
cast(width as {{ dbt_utils.type_float() }}) as width,
cast(height as {{ dbt_utils.type_float() }}) as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover_dimensions_md_ab1') }}
-- md at events/cover/dimensions/md
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_cover_dimensions_md_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_dimensions_hashid',
'url',
'width',
'height',
]) }} as _airbyte_md_hashid,
tmp.*
from {{ ref('events_cover_dimensions_md_ab2') }} tmp
-- md at events/cover/dimensions/md
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_cover_dimensions') }}
select
_airbyte_dimensions_hashid,
{{ json_extract_scalar('sm', ['url'], ['url']) }} as url,
{{ json_extract_scalar('sm', ['width'], ['width']) }} as width,
{{ json_extract_scalar('sm', ['height'], ['height']) }} as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover_dimensions') }} as table_alias
-- sm at events/cover/dimensions/sm
where 1 = 1
and sm is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_cover_dimensions_sm_ab1') }}
select
_airbyte_dimensions_hashid,
cast(url as {{ dbt_utils.type_string() }}) as url,
cast(width as {{ dbt_utils.type_float() }}) as width,
cast(height as {{ dbt_utils.type_float() }}) as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_cover_dimensions_sm_ab1') }}
-- sm at events/cover/dimensions/sm
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_cover_dimensions_sm_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_dimensions_hashid',
'url',
'width',
'height',
]) }} as _airbyte_sm_hashid,
tmp.*
from {{ ref('events_cover_dimensions_sm_ab2') }} tmp
-- sm at events/cover/dimensions/sm
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events') }}
select
_airbyte_events_hashid,
{{ json_extract_scalar('icon', ['_id'], ['_id']) }} as _id,
{{ json_extract_scalar('icon', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract('table_alias', 'icon', ['dimensions'], ['dimensions']) }} as dimensions,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events') }} as table_alias
-- icon at events/icon
where 1 = 1
and icon is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_icon_ab1') }}
select
_airbyte_events_hashid,
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(dimensions as {{ type_json() }}) as dimensions,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon_ab1') }}
-- icon at events/icon
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_icon_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_events_hashid',
'_id',
adapter.quote('name'),
object_to_string('dimensions'),
]) }} as _airbyte_icon_hashid,
tmp.*
from {{ ref('events_icon_ab2') }} tmp
-- icon at events/icon
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_icon') }}
select
_airbyte_icon_hashid,
{{ json_extract('table_alias', 'dimensions', ['md'], ['md']) }} as md,
{{ json_extract('table_alias', 'dimensions', ['sm'], ['sm']) }} as sm,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon') }} as table_alias
-- dimensions at events/icon/dimensions
where 1 = 1
and dimensions is not null

View File

@ -1,18 +0,0 @@
{{ 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('events_icon_dimensions_ab1') }}
select
_airbyte_icon_hashid,
cast(md as {{ type_json() }}) as md,
cast(sm as {{ type_json() }}) as sm,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon_dimensions_ab1') }}
-- dimensions at events/icon/dimensions
where 1 = 1

View File

@ -1,18 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_icon_dimensions_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_icon_hashid',
object_to_string('md'),
object_to_string('sm'),
]) }} as _airbyte_dimensions_hashid,
tmp.*
from {{ ref('events_icon_dimensions_ab2') }} tmp
-- dimensions at events/icon/dimensions
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_icon_dimensions') }}
select
_airbyte_dimensions_hashid,
{{ json_extract_scalar('md', ['url'], ['url']) }} as url,
{{ json_extract_scalar('md', ['width'], ['width']) }} as width,
{{ json_extract_scalar('md', ['height'], ['height']) }} as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon_dimensions') }} as table_alias
-- md at events/icon/dimensions/md
where 1 = 1
and md is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_icon_dimensions_md_ab1') }}
select
_airbyte_dimensions_hashid,
cast(url as {{ dbt_utils.type_string() }}) as url,
cast(width as {{ dbt_utils.type_float() }}) as width,
cast(height as {{ dbt_utils.type_float() }}) as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon_dimensions_md_ab1') }}
-- md at events/icon/dimensions/md
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_icon_dimensions_md_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_dimensions_hashid',
'url',
'width',
'height',
]) }} as _airbyte_md_hashid,
tmp.*
from {{ ref('events_icon_dimensions_md_ab2') }} tmp
-- md at events/icon/dimensions/md
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_icon_dimensions') }}
select
_airbyte_dimensions_hashid,
{{ json_extract_scalar('sm', ['url'], ['url']) }} as url,
{{ json_extract_scalar('sm', ['width'], ['width']) }} as width,
{{ json_extract_scalar('sm', ['height'], ['height']) }} as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon_dimensions') }} as table_alias
-- sm at events/icon/dimensions/sm
where 1 = 1
and sm is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_icon_dimensions_sm_ab1') }}
select
_airbyte_dimensions_hashid,
cast(url as {{ dbt_utils.type_string() }}) as url,
cast(width as {{ dbt_utils.type_float() }}) as width,
cast(height as {{ dbt_utils.type_float() }}) as height,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_icon_dimensions_sm_ab1') }}
-- sm at events/icon/dimensions/sm
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_icon_dimensions_sm_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_dimensions_hashid',
'url',
'width',
'height',
]) }} as _airbyte_sm_hashid,
tmp.*
from {{ ref('events_icon_dimensions_sm_ab2') }} tmp
-- sm at events/icon/dimensions/sm
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events') }}
select
_airbyte_events_hashid,
{{ json_extract_scalar('notice', ['label'], ['label']) }} as {{ adapter.quote('label') }},
{{ json_extract_scalar('notice', ['value'], ['value']) }} as {{ adapter.quote('value') }},
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events') }} as table_alias
-- notice at events/notice
where 1 = 1
and notice is not null

View File

@ -1,18 +0,0 @@
{{ 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('events_notice_ab1') }}
select
_airbyte_events_hashid,
cast({{ adapter.quote('label') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('label') }},
cast({{ adapter.quote('value') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('value') }},
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_notice_ab1') }}
-- notice at events/notice
where 1 = 1

View File

@ -1,18 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_notice_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_events_hashid',
adapter.quote('label'),
adapter.quote('value'),
]) }} as _airbyte_notice_hashid,
tmp.*
from {{ ref('events_notice_ab2') }} tmp
-- notice at events/notice
where 1 = 1

View File

@ -1,23 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events') }}
select
_airbyte_events_hashid,
{{ json_extract_scalar(adapter.quote('options'), ['cash'], ['cash']) }} as cash,
{{ json_extract_scalar(adapter.quote('options'), ['percent'], ['percent']) }} as {{ adapter.quote('percent') }},
{{ json_extract_scalar(adapter.quote('options'), ['validInDays'], ['validInDays']) }} as validindays,
{{ json_extract_scalar(adapter.quote('options'), ['minOrderValue'], ['minOrderValue']) }} as minordervalue,
{{ json_extract_scalar(adapter.quote('options'), ['minOrderToClaim'], ['minOrderToClaim']) }} as minordertoclaim,
{{ json_extract_scalar(adapter.quote('options'), ['userCreatedBeforeDate'], ['userCreatedBeforeDate']) }} as usercreatedbeforedate,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events') }} as table_alias
-- options at events/options
where 1 = 1
and {{ adapter.quote('options') }} is not null

View File

@ -1,22 +0,0 @@
{{ 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('events_options_ab1') }}
select
_airbyte_events_hashid,
cast(cash as {{ dbt_utils.type_float() }}) as cash,
cast({{ adapter.quote('percent') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('percent') }},
cast(validindays as {{ dbt_utils.type_float() }}) as validindays,
cast(minordervalue as {{ dbt_utils.type_float() }}) as minordervalue,
cast(minordertoclaim as {{ dbt_utils.type_float() }}) as minordertoclaim,
cast(usercreatedbeforedate as {{ dbt_utils.type_string() }}) as usercreatedbeforedate,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_options_ab1') }}
-- options at events/options
where 1 = 1

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_options_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_events_hashid',
'cash',
adapter.quote('percent'),
'validindays',
'minordervalue',
'minordertoclaim',
'usercreatedbeforedate',
]) }} as _airbyte_options_hashid,
tmp.*
from {{ ref('events_options_ab2') }} tmp
-- options at events/options
where 1 = 1

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events') }}
select
_airbyte_events_hashid,
{{ json_extract_array('segments', ['segments'], ['segments']) }} as segments,
{{ json_extract_scalar('segments', ['userSegment'], ['userSegment']) }} as usersegment,
{{ json_extract('table_alias', 'segments', ['lastMonthSales'], ['lastMonthSales']) }} as lastmonthsales,
{{ json_extract('table_alias', 'segments', ['highestMonthlySales'], ['highestMonthlySales']) }} as highestmonthlysales,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events') }} as table_alias
-- segments at events/segments
where 1 = 1
and segments is not null

View File

@ -1,20 +0,0 @@
{{ 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('events_segments_ab1') }}
select
_airbyte_events_hashid,
segments,
cast(usersegment as {{ dbt_utils.type_string() }}) as usersegment,
cast(lastmonthsales as {{ type_json() }}) as lastmonthsales,
cast(highestmonthlysales as {{ type_json() }}) as highestmonthlysales,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_segments_ab1') }}
-- segments at events/segments
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_segments_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_events_hashid',
array_to_string('segments'),
'usersegment',
object_to_string('lastmonthsales'),
object_to_string('highestmonthlysales'),
]) }} as _airbyte_segments_hashid,
tmp.*
from {{ ref('events_segments_ab2') }} tmp
-- segments at events/segments
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_segments') }}
select
_airbyte_segments_hashid,
{{ json_extract_scalar('highestmonthlysales', ['to'], ['to']) }} as {{ adapter.quote('to') }},
{{ json_extract_scalar('highestmonthlysales', ['from'], ['from']) }} as {{ adapter.quote('from') }},
{{ json_extract_scalar('highestmonthlysales', ['active'], ['active']) }} as active,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_segments') }} as table_alias
-- highestmonthlysales at events/segments/highestMonthlySales
where 1 = 1
and highestmonthlysales is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_segments_highestmonthlysales_ab1') }}
select
_airbyte_segments_hashid,
cast({{ adapter.quote('to') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('to') }},
cast({{ adapter.quote('from') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('from') }},
{{ cast_to_boolean('active') }} as active,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_segments_highestmonthlysales_ab1') }}
-- highestmonthlysales at events/segments/highestMonthlySales
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_segments_highestmonthlysales_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_segments_hashid',
adapter.quote('to'),
adapter.quote('from'),
boolean_to_string('active'),
]) }} as _airbyte_highestmonthlysales_hashid,
tmp.*
from {{ ref('events_segments_highestmonthlysales_ab2') }} tmp
-- highestmonthlysales at events/segments/highestMonthlySales
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('events_segments') }}
select
_airbyte_segments_hashid,
{{ json_extract_scalar('lastmonthsales', ['to'], ['to']) }} as {{ adapter.quote('to') }},
{{ json_extract_scalar('lastmonthsales', ['from'], ['from']) }} as {{ adapter.quote('from') }},
{{ json_extract_scalar('lastmonthsales', ['active'], ['active']) }} as active,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_segments') }} as table_alias
-- lastmonthsales at events/segments/lastMonthSales
where 1 = 1
and lastmonthsales is not null

View File

@ -1,19 +0,0 @@
{{ 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('events_segments_lastmonthsales_ab1') }}
select
_airbyte_segments_hashid,
cast({{ adapter.quote('to') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('to') }},
cast({{ adapter.quote('from') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('from') }},
{{ cast_to_boolean('active') }} as active,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('events_segments_lastmonthsales_ab1') }}
-- lastmonthsales at events/segments/lastMonthSales
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('events_segments_lastmonthsales_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_segments_hashid',
adapter.quote('to'),
adapter.quote('from'),
boolean_to_string('active'),
]) }} as _airbyte_lastmonthsales_hashid,
tmp.*
from {{ ref('events_segments_lastmonthsales_ab2') }} tmp
-- lastmonthsales at events/segments/lastMonthSales
where 1 = 1

View File

@ -7,21 +7,22 @@
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ source('unibag', '_airbyte_raw_inventories') }}
select
{{ json_extract_scalar('_airbyte_data', ['id'], ['id']) }} as {{ adapter.quote('id') }},
{{ json_extract_scalar('_airbyte_data', ['_id'], ['_id']) }} as _id,
{{ json_extract_scalar('_airbyte_data', ['code'], ['code']) }} as code,
{{ json_extract_scalar('_airbyte_data', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar('_airbyte_data', ['slug'], ['slug']) }} as slug,
{{ json_extract_scalar('_airbyte_data', ['active'], ['active']) }} as active,
{{ json_extract('table_alias', '_airbyte_data', ['contact'], ['contact']) }} as contact,
{{ json_extract('table_alias', '_airbyte_data', ['partner'], ['partner']) }} as partner,
{{ json_extract_scalar('_airbyte_data', ['contact'], ['contact']) }} as contact,
{{ json_extract_scalar('_airbyte_data', ['partner'], ['partner']) }} as partner,
{{ json_extract_scalar('_airbyte_data', ['checksum'], ['checksum']) }} as checksum,
{{ json_extract('table_alias', '_airbyte_data', ['location'], ['location']) }} as {{ adapter.quote('location') }},
{{ json_extract('table_alias', '_airbyte_data', ['supplier'], ['supplier']) }} as supplier,
{{ json_extract_scalar('_airbyte_data', ['location'], ['location']) }} as {{ adapter.quote('location') }},
{{ json_extract_scalar('_airbyte_data', ['supplier'], ['supplier']) }} as supplier,
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,
{{ json_extract_scalar('_airbyte_data', ['updatedAt'], ['updatedAt']) }} as updatedat,
{{ json_extract_scalar('_airbyte_data', ['minimumValue'], ['minimumValue']) }} as minimumvalue,
{{ json_extract_scalar('_airbyte_data', ['searchString'], ['searchString']) }} as searchstring,
{{ json_extract('table_alias', '_airbyte_data', ['paymentMethods'], ['paymentMethods']) }} as paymentmethods,
{{ json_extract_scalar('_airbyte_data', ['paymentMethods'], ['paymentMethods']) }} as paymentmethods,
{{ json_extract_scalar('_airbyte_data', ['canIssueInvoice'], ['canIssueInvoice']) }} as canissueinvoice,
{{ json_extract_array('_airbyte_data', ['deliveryMethods'], ['deliveryMethods']) }} as deliverymethods,
{{ json_extract_scalar('_airbyte_data', ['canAutoSendEmail'], ['canAutoSendEmail']) }} as canautosendemail,

View File

@ -7,21 +7,22 @@
-- SQL model to cast each column to its adequate SQL type converted from the JSON schema type
-- depends_on: {{ ref('inventories_ab1') }}
select
cast({{ adapter.quote('id') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('id') }},
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast(code as {{ dbt_utils.type_float() }}) as code,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(slug as {{ dbt_utils.type_string() }}) as slug,
{{ cast_to_boolean('active') }} as active,
cast(contact as {{ type_json() }}) as contact,
cast(partner as {{ type_json() }}) as partner,
cast(contact as {{ dbt_utils.type_string() }}) as contact,
cast(partner as {{ dbt_utils.type_string() }}) as partner,
cast(checksum as {{ dbt_utils.type_string() }}) as checksum,
cast({{ adapter.quote('location') }} as {{ type_json() }}) as {{ adapter.quote('location') }},
cast(supplier as {{ type_json() }}) as supplier,
cast({{ adapter.quote('location') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('location') }},
cast(supplier as {{ dbt_utils.type_string() }}) as supplier,
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
cast(minimumvalue as {{ dbt_utils.type_float() }}) as minimumvalue,
cast(searchstring as {{ dbt_utils.type_string() }}) as searchstring,
cast(paymentmethods as {{ type_json() }}) as paymentmethods,
cast(paymentmethods as {{ dbt_utils.type_string() }}) as paymentmethods,
{{ cast_to_boolean('canissueinvoice') }} as canissueinvoice,
deliverymethods,
{{ cast_to_boolean('canautosendemail') }} as canautosendemail,

View File

@ -8,21 +8,22 @@
-- depends_on: {{ ref('inventories_ab2') }}
select
{{ dbt_utils.surrogate_key([
adapter.quote('id'),
'_id',
'code',
adapter.quote('name'),
'slug',
boolean_to_string('active'),
object_to_string('contact'),
object_to_string('partner'),
'contact',
'partner',
'checksum',
object_to_string(adapter.quote('location')),
object_to_string('supplier'),
adapter.quote('location'),
'supplier',
'createdat',
'updatedat',
'minimumvalue',
'searchstring',
object_to_string('paymentmethods'),
'paymentmethods',
boolean_to_string('canissueinvoice'),
array_to_string('deliverymethods'),
boolean_to_string('canautosendemail'),

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('inventories') }}
select
_airbyte_inventories_hashid,
{{ json_extract_scalar('contact', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar('contact', ['email'], ['email']) }} as email,
{{ json_extract_scalar('contact', ['phone'], ['phone']) }} as phone,
{{ json_extract_scalar('contact', ['address'], ['address']) }} as address,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories') }} as table_alias
-- contact at inventories/contact
where 1 = 1
and contact is not null

View File

@ -1,20 +0,0 @@
{{ 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('inventories_contact_ab1') }}
select
_airbyte_inventories_hashid,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(email as {{ dbt_utils.type_string() }}) as email,
cast(phone as {{ dbt_utils.type_string() }}) as phone,
cast(address as {{ dbt_utils.type_string() }}) as address,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_contact_ab1') }}
-- contact at inventories/contact
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('inventories_contact_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_inventories_hashid',
adapter.quote('name'),
'email',
'phone',
'address',
]) }} as _airbyte_contact_hashid,
tmp.*
from {{ ref('inventories_contact_ab2') }} tmp
-- contact at inventories/contact
where 1 = 1

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('inventories') }}
select
_airbyte_inventories_hashid,
{{ json_extract_scalar(adapter.quote('location'), ['ward'], ['ward']) }} as ward,
{{ json_extract_scalar(adapter.quote('location'), ['address'], ['address']) }} as address,
{{ json_extract_scalar(adapter.quote('location'), ['district'], ['district']) }} as district,
{{ json_extract('table_alias', adapter.quote('location'), ['location'], ['location']) }} as {{ adapter.quote('location') }},
{{ json_extract_scalar(adapter.quote('location'), ['province'], ['province']) }} as province,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories') }} as table_alias
-- location at inventories/location
where 1 = 1
and {{ adapter.quote('location') }} is not null

View File

@ -1,21 +0,0 @@
{{ 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('inventories_location_ab1') }}
select
_airbyte_inventories_hashid,
cast(ward as {{ dbt_utils.type_string() }}) as ward,
cast(address as {{ dbt_utils.type_string() }}) as address,
cast(district as {{ dbt_utils.type_string() }}) as district,
cast({{ adapter.quote('location') }} as {{ type_json() }}) as {{ adapter.quote('location') }},
cast(province as {{ dbt_utils.type_string() }}) as province,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_location_ab1') }}
-- location at inventories/location
where 1 = 1

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('inventories_location_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_inventories_hashid',
'ward',
'address',
'district',
object_to_string(adapter.quote('location')),
'province',
]) }} as _airbyte_location_hashid,
tmp.*
from {{ ref('inventories_location_ab2') }} tmp
-- location at inventories/location
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('inventories_location') }}
select
_airbyte_location_hashid,
{{ json_extract_scalar(adapter.quote('location'), ['type'], ['type']) }} as {{ adapter.quote('type') }},
{{ json_extract_array(adapter.quote('location'), ['coordinates'], ['coordinates']) }} as coordinates,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_location') }} as table_alias
-- location at inventories/location/location
where 1 = 1
and {{ adapter.quote('location') }} is not null

View File

@ -1,18 +0,0 @@
{{ 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('inventories_location_location_ab1') }}
select
_airbyte_location_hashid,
cast({{ adapter.quote('type') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('type') }},
coordinates,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_location_location_ab1') }}
-- location at inventories/location/location
where 1 = 1

View File

@ -1,18 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('inventories_location_location_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_location_hashid',
adapter.quote('type'),
array_to_string('coordinates'),
]) }} as _airbyte_location_3_hashid,
tmp.*
from {{ ref('inventories_location_location_ab2') }} tmp
-- location at inventories/location/location
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('inventories') }}
select
_airbyte_inventories_hashid,
{{ json_extract_scalar('partner', ['code'], ['code']) }} as code,
{{ json_extract_scalar('partner', ['identityCode'], ['identityCode']) }} as identitycode,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories') }} as table_alias
-- partner at inventories/partner
where 1 = 1
and partner is not null

View File

@ -1,18 +0,0 @@
{{ 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('inventories_partner_ab1') }}
select
_airbyte_inventories_hashid,
cast(code as {{ dbt_utils.type_string() }}) as code,
cast(identitycode as {{ dbt_utils.type_string() }}) as identitycode,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_partner_ab1') }}
-- partner at inventories/partner
where 1 = 1

View File

@ -1,18 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('inventories_partner_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_inventories_hashid',
'code',
'identitycode',
]) }} as _airbyte_partner_hashid,
tmp.*
from {{ ref('inventories_partner_ab2') }} tmp
-- partner at inventories/partner
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('inventories') }}
select
_airbyte_inventories_hashid,
{{ json_extract_scalar('paymentmethods', ['cod'], ['cod']) }} as cod,
{{ json_extract_scalar('paymentmethods', ['bankTransfer'], ['bankTransfer']) }} as banktransfer,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories') }} as table_alias
-- paymentmethods at inventories/paymentMethods
where 1 = 1
and paymentmethods is not null

View File

@ -1,18 +0,0 @@
{{ 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('inventories_paymentmethods_ab1') }}
select
_airbyte_inventories_hashid,
{{ cast_to_boolean('cod') }} as cod,
{{ cast_to_boolean('banktransfer') }} as banktransfer,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_paymentmethods_ab1') }}
-- paymentmethods at inventories/paymentMethods
where 1 = 1

View File

@ -1,18 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('inventories_paymentmethods_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_inventories_hashid',
boolean_to_string('cod'),
boolean_to_string('banktransfer'),
]) }} as _airbyte_paymentmethods_hashid,
tmp.*
from {{ ref('inventories_paymentmethods_ab2') }} tmp
-- paymentmethods at inventories/paymentMethods
where 1 = 1

View File

@ -1,20 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('inventories') }}
select
_airbyte_inventories_hashid,
{{ json_extract_scalar('supplier', ['_id'], ['_id']) }} as _id,
{{ json_extract_scalar('supplier', ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar('supplier', ['searchString'], ['searchString']) }} as searchstring,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories') }} as table_alias
-- supplier at inventories/supplier
where 1 = 1
and supplier is not null

View File

@ -1,19 +0,0 @@
{{ 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('inventories_supplier_ab1') }}
select
_airbyte_inventories_hashid,
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(searchstring as {{ dbt_utils.type_string() }}) as searchstring,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('inventories_supplier_ab1') }}
-- supplier at inventories/supplier
where 1 = 1

View File

@ -1,19 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('inventories_supplier_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_inventories_hashid',
'_id',
adapter.quote('name'),
'searchstring',
]) }} as _airbyte_supplier_hashid,
tmp.*
from {{ ref('inventories_supplier_ab2') }} tmp
-- supplier at inventories/supplier
where 1 = 1

View File

@ -16,8 +16,10 @@ select
{{ json_extract_scalar('_airbyte_data', ['active'], ['active']) }} as active,
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,
{{ json_extract_scalar('_airbyte_data', ['updatedAt'], ['updatedAt']) }} as updatedat,
{{ json_extract_scalar('_airbyte_data', ['updatedat'], ['updatedat']) }} as updatedat_1,
{{ json_extract_scalar('_airbyte_data', ['transaction'], ['transaction']) }} as {{ adapter.quote('transaction') }},
{{ json_extract_scalar('_airbyte_data', ['bonusPercent'], ['bonusPercent']) }} as bonuspercent,
{{ json_extract_scalar('_airbyte_data', ['bonuspercent'], ['bonuspercent']) }} as bonuspercent_1,
{{ json_extract_scalar('_airbyte_data', ['transactionMinValue'], ['transactionMinValue']) }} as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,

View File

@ -16,8 +16,10 @@ select
{{ cast_to_boolean('active') }} as active,
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
cast(updatedat_1 as {{ dbt_utils.type_string() }}) as updatedat_1,
cast({{ adapter.quote('transaction') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('transaction') }},
cast(bonuspercent as {{ dbt_utils.type_float() }}) as bonuspercent,
cast(bonuspercent_1 as {{ dbt_utils.type_float() }}) as bonuspercent_1,
cast(transactionminvalue as {{ dbt_utils.type_float() }}) as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,

View File

@ -17,8 +17,10 @@ select
boolean_to_string('active'),
'createdat',
'updatedat',
'updatedat_1',
adapter.quote('transaction'),
'bonuspercent',
'bonuspercent_1',
'transactionminvalue',
]) }} as _airbyte_membership_hashid,
tmp.*

View File

@ -8,8 +8,8 @@
-- depends_on: {{ source('unibag', '_airbyte_raw_membership_histories') }}
select
{{ json_extract_scalar('_airbyte_data', ['_id'], ['_id']) }} as _id,
{{ json_extract('table_alias', '_airbyte_data', ['new'], ['new']) }} as {{ adapter.quote('new') }},
{{ json_extract('table_alias', '_airbyte_data', ['old'], ['old']) }} as {{ adapter.quote('old') }},
{{ json_extract_scalar('_airbyte_data', ['new'], ['new']) }} as {{ adapter.quote('new') }},
{{ json_extract_scalar('_airbyte_data', ['old'], ['old']) }} as {{ adapter.quote('old') }},
{{ json_extract_scalar('_airbyte_data', ['type'], ['type']) }} as {{ adapter.quote('type') }},
{{ json_extract_scalar('_airbyte_data', ['user'], ['user']) }} as {{ adapter.quote('user') }},
{{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,

View File

@ -8,8 +8,8 @@
-- depends_on: {{ ref('membership_histories_ab1') }}
select
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast({{ adapter.quote('new') }} as {{ type_json() }}) as {{ adapter.quote('new') }},
cast({{ adapter.quote('old') }} as {{ type_json() }}) as {{ adapter.quote('old') }},
cast({{ adapter.quote('new') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('new') }},
cast({{ adapter.quote('old') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('old') }},
cast({{ adapter.quote('type') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('type') }},
cast({{ adapter.quote('user') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('user') }},
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,

View File

@ -9,8 +9,8 @@
select
{{ dbt_utils.surrogate_key([
'_id',
object_to_string(adapter.quote('new')),
object_to_string(adapter.quote('old')),
adapter.quote('new'),
adapter.quote('old'),
adapter.quote('type'),
adapter.quote('user'),
'createdat',

View File

@ -1,24 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('membership_histories') }}
select
_airbyte_membership_histories_hashid,
{{ json_extract_scalar(adapter.quote('new'), ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar(adapter.quote('new'), ['level'], ['level']) }} as {{ adapter.quote('level') }},
{{ json_extract('table_alias', adapter.quote('new'), ['condition'], ['condition']) }} as {{ adapter.quote('condition') }},
{{ json_extract_scalar(adapter.quote('new'), ['statistic'], ['statistic']) }} as statistic,
{{ json_extract_scalar(adapter.quote('new'), ['transaction'], ['transaction']) }} as {{ adapter.quote('transaction') }},
{{ json_extract_scalar(adapter.quote('new'), ['bonusPercent'], ['bonusPercent']) }} as bonuspercent,
{{ json_extract_scalar(adapter.quote('new'), ['transactionMinValue'], ['transactionMinValue']) }} as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories') }} as table_alias
-- new at membership-histories/new
where 1 = 1
and {{ adapter.quote('new') }} is not null

View File

@ -1,23 +0,0 @@
{{ 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('membership_histories_new_ab1') }}
select
_airbyte_membership_histories_hashid,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast({{ adapter.quote('level') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('level') }},
cast({{ adapter.quote('condition') }} as {{ type_json() }}) as {{ adapter.quote('condition') }},
cast(statistic as {{ dbt_utils.type_string() }}) as statistic,
cast({{ adapter.quote('transaction') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('transaction') }},
cast(bonuspercent as {{ dbt_utils.type_float() }}) as bonuspercent,
cast(transactionminvalue as {{ dbt_utils.type_float() }}) as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories_new_ab1') }}
-- new at membership-histories/new
where 1 = 1

View File

@ -1,23 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('membership_histories_new_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_membership_histories_hashid',
adapter.quote('name'),
adapter.quote('level'),
object_to_string(adapter.quote('condition')),
'statistic',
adapter.quote('transaction'),
'bonuspercent',
'transactionminvalue',
]) }} as _airbyte_new_hashid,
tmp.*
from {{ ref('membership_histories_new_ab2') }} tmp
-- new at membership-histories/new
where 1 = 1

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('membership_histories_new') }}
select
_airbyte_new_hashid,
{{ json_extract_scalar(adapter.quote('condition'), ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar(adapter.quote('condition'), ['sales'], ['sales']) }} as sales,
{{ json_extract_scalar(adapter.quote('condition'), ['transaction'], ['transaction']) }} as {{ adapter.quote('transaction') }},
{{ json_extract_scalar(adapter.quote('condition'), ['bonusPercent'], ['bonusPercent']) }} as bonuspercent,
{{ json_extract_scalar(adapter.quote('condition'), ['transactionMinValue'], ['transactionMinValue']) }} as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories_new') }} as table_alias
-- condition at membership-histories/new/condition
where 1 = 1
and {{ adapter.quote('condition') }} is not null

View File

@ -1,21 +0,0 @@
{{ 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('membership_histories_new_condition_ab1') }}
select
_airbyte_new_hashid,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast(sales as {{ dbt_utils.type_float() }}) as sales,
cast({{ adapter.quote('transaction') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('transaction') }},
cast(bonuspercent as {{ dbt_utils.type_float() }}) as bonuspercent,
cast(transactionminvalue as {{ dbt_utils.type_float() }}) as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories_new_condition_ab1') }}
-- condition at membership-histories/new/condition
where 1 = 1

View File

@ -1,21 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('membership_histories_new_condition_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_new_hashid',
adapter.quote('name'),
'sales',
adapter.quote('transaction'),
'bonuspercent',
'transactionminvalue',
]) }} as _airbyte_condition_hashid,
tmp.*
from {{ ref('membership_histories_new_condition_ab2') }} tmp
-- condition at membership-histories/new/condition
where 1 = 1

View File

@ -1,24 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('membership_histories') }}
select
_airbyte_membership_histories_hashid,
{{ json_extract_scalar(adapter.quote('old'), ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar(adapter.quote('old'), ['level'], ['level']) }} as {{ adapter.quote('level') }},
{{ json_extract('table_alias', adapter.quote('old'), ['condition'], ['condition']) }} as {{ adapter.quote('condition') }},
{{ json_extract('table_alias', adapter.quote('old'), ['statistic'], ['statistic']) }} as statistic,
{{ json_extract_scalar(adapter.quote('old'), ['transaction'], ['transaction']) }} as {{ adapter.quote('transaction') }},
{{ json_extract_scalar(adapter.quote('old'), ['bonusPercent'], ['bonusPercent']) }} as bonuspercent,
{{ json_extract_scalar(adapter.quote('old'), ['transactionMinValue'], ['transactionMinValue']) }} as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories') }} as table_alias
-- old at membership-histories/old
where 1 = 1
and {{ adapter.quote('old') }} is not null

View File

@ -1,23 +0,0 @@
{{ 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('membership_histories_old_ab1') }}
select
_airbyte_membership_histories_hashid,
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
cast({{ adapter.quote('level') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('level') }},
cast({{ adapter.quote('condition') }} as {{ type_json() }}) as {{ adapter.quote('condition') }},
cast(statistic as {{ type_json() }}) as statistic,
cast({{ adapter.quote('transaction') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('transaction') }},
cast(bonuspercent as {{ dbt_utils.type_float() }}) as bonuspercent,
cast(transactionminvalue as {{ dbt_utils.type_float() }}) as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories_old_ab1') }}
-- old at membership-histories/old
where 1 = 1

View File

@ -1,23 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to build a hash column based on the values of this record
-- depends_on: {{ ref('membership_histories_old_ab2') }}
select
{{ dbt_utils.surrogate_key([
'_airbyte_membership_histories_hashid',
adapter.quote('name'),
adapter.quote('level'),
object_to_string(adapter.quote('condition')),
object_to_string('statistic'),
adapter.quote('transaction'),
'bonuspercent',
'transactionminvalue',
]) }} as _airbyte_old_hashid,
tmp.*
from {{ ref('membership_histories_old_ab2') }} tmp
-- old at membership-histories/old
where 1 = 1

View File

@ -1,22 +0,0 @@
{{ config(
indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
schema = "_airbyte_unibag",
tags = [ "nested-intermediate" ]
) }}
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
-- depends_on: {{ ref('membership_histories_old') }}
select
_airbyte_old_hashid,
{{ json_extract_scalar(adapter.quote('condition'), ['name'], ['name']) }} as {{ adapter.quote('name') }},
{{ json_extract_scalar(adapter.quote('condition'), ['sales'], ['sales']) }} as sales,
{{ json_extract_scalar(adapter.quote('condition'), ['transaction'], ['transaction']) }} as {{ adapter.quote('transaction') }},
{{ json_extract_scalar(adapter.quote('condition'), ['bonusPercent'], ['bonusPercent']) }} as bonuspercent,
{{ json_extract_scalar(adapter.quote('condition'), ['transactionMinValue'], ['transactionMinValue']) }} as transactionminvalue,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('membership_histories_old') }} as table_alias
-- condition at membership-histories/old/condition
where 1 = 1
and {{ adapter.quote('condition') }} is not null

Some files were not shown because too many files have changed in this diff Show More