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

44 lines
1.9 KiB
MySQL
Raw Normal View History

2022-04-13 07:06:23 +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('social_posts_ab1') }}
select
cast(_id as {{ dbt_utils.type_string() }}) as _id,
tags,
{{ cast_to_boolean('ispin') }} as ispin,
cast({{ adapter.quote('order') }} as {{ dbt_utils.type_float() }}) as {{ adapter.quote('order') }},
cast(title as {{ dbt_utils.type_string() }}) as title,
cast(author as {{ dbt_utils.type_string() }}) as author,
cities,
photos,
cast(reason as {{ dbt_utils.type_string() }}) as reason,
cast(status as {{ dbt_utils.type_string() }}) as status,
videos,
cast({{ adapter.quote('content') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('content') }},
{{ cast_to_boolean('istimer') }} as istimer,
cast(startat as {{ dbt_utils.type_string() }}) as startat,
products,
cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
{{ cast_to_boolean('hasupdate') }} as hasupdate,
2022-05-10 14:30:53 +00:00
cast(statistic as {{ type_json() }}) as statistic,
2022-04-13 07:06:23 +00:00
cast(updatedat as {{ dbt_utils.type_string() }}) as updatedat,
categories,
{{ cast_to_boolean('fromsystem') }} as fromsystem,
cast(contributor as {{ dbt_utils.type_string() }}) as contributor,
cast(publishedat as {{ dbt_utils.type_string() }}) as publishedat,
cast(searchstring as {{ dbt_utils.type_string() }}) as searchstring,
cast(updatedcount as {{ dbt_utils.type_float() }}) as updatedcount,
2022-05-10 14:30:53 +00:00
cast(sharestatistic as {{ type_json() }}) as sharestatistic,
2022-04-13 07:06:23 +00:00
{{ cast_to_boolean('enablenotificationforcontributor') }} as enablenotificationforcontributor,
_airbyte_ab_id,
_airbyte_emitted_at,
{{ current_timestamp() }} as _airbyte_normalized_at
from {{ ref('social_posts_ab1') }}
-- social_posts
where 1 = 1