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

45 lines
2.2 KiB
MySQL
Raw Permalink 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 cast each column to its adequate SQL type converted from the JSON schema type
-- depends_on: {{ ref('users_ab1') }}
select
cast(_id as {{ dbt_utils.type_string() }}) as _id,
cast(code as {{ dbt_utils.type_string() }}) as code,
2022-05-11 04:21:03 +00:00
cast(info as {{ dbt_utils.type_string() }}) as info,
2022-03-22 04:03:52 +00:00
cast({{ adapter.quote('name') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('name') }},
2022-05-11 04:21:03 +00:00
cast(team as {{ dbt_utils.type_string() }}) as team,
cast(zalo as {{ dbt_utils.type_string() }}) as zalo,
cast(email as {{ dbt_utils.type_string() }}) as email,
cast(phone as {{ dbt_utils.type_string() }}) as phone,
cast(avatar as {{ dbt_utils.type_string() }}) as avatar,
2022-03-22 04:03:52 +00:00
{{ cast_to_boolean('banned') }} as banned,
cast(segment as {{ dbt_utils.type_string() }}) as segment,
2022-05-11 04:21:03 +00:00
cast(facebook as {{ dbt_utils.type_string() }}) as facebook,
2022-03-22 04:03:52 +00:00
{{ cast_to_boolean('hasorder') }} as hasorder,
2022-05-11 04:21:03 +00:00
cast(referral as {{ dbt_utils.type_string() }}) as referral,
2022-03-22 04:03:52 +00:00
segments,
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
2022-05-11 04:21:03 +00:00
cast(statistic as {{ dbt_utils.type_string() }}) as statistic,
2022-03-22 04:03:52 +00:00
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
2022-05-11 04:21:03 +00:00
cast(membership as {{ dbt_utils.type_string() }}) as membership,
cast(lastorderat as {{ dbt_utils.type_string() }}) as lastorderat,
cast(firstorderat as {{ dbt_utils.type_string() }}) as firstorderat,
2022-03-22 04:03:52 +00:00
cast(registerfrom as {{ dbt_utils.type_string() }}) as registerfrom,
cast(searchstring as {{ dbt_utils.type_string() }}) as searchstring,
2022-05-11 04:21:03 +00:00
cast(adjusttracker as {{ dbt_utils.type_string() }}) as adjusttracker,
2022-03-22 04:03:52 +00:00
{{ cast_to_boolean('isupdatedinfo') }} as isupdatedinfo,
2022-05-11 04:21:03 +00:00
cast(identification as {{ dbt_utils.type_string() }}) as identification,
2022-03-22 04:03:52 +00:00
cast(lastactivatedat as {{ dbt_utils.type_string() }}) as lastactivatedat,
cast(lastviewnotificationat as {{ dbt_utils.type_string() }}) as lastviewnotificationat,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('users_ab1') }}
-- users
where 1 = 1