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 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_membership_histories') }}
|
|
|
|
select
|
|
|
|
{{ json_extract_scalar('_airbyte_data', ['_id'], ['_id']) }} as _id,
|
2022-05-11 04:21:03 +00:00
|
|
|
{{ json_extract_scalar('_airbyte_data', ['new'], ['new']) }} as {{ adapter.quote('new') }},
|
|
|
|
{{ json_extract_scalar('_airbyte_data', ['old'], ['old']) }} as {{ adapter.quote('old') }},
|
2022-03-22 04:03:52 +00:00
|
|
|
{{ 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,
|
|
|
|
_airbyte_ab_id,
|
|
|
|
_airbyte_emitted_at,
|
|
|
|
{{ current_timestamp() }} as _airbyte_normalized_at
|
|
|
|
from {{ source('unibag', '_airbyte_raw_membership_histories') }} as table_alias
|
|
|
|
-- membership_histories
|
|
|
|
where 1 = 1
|
|
|
|
|