Skip to content

Commit

Permalink
Revert "uhhhhh more diffs I guess?"
Browse files Browse the repository at this point in the history
This reverts commit 026f3bb.

accidentally committed to wrong branch :(
  • Loading branch information
edgao committed Dec 27, 2021
1 parent 026f3bb commit 3dc361d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ input_data as (
-- NESTED_STREAM_WITH_COMPLEX_COLUMNS_RESULTING_INTO_LONG_NAMES from "AIRBYTE_DATABASE".TEST_NORMALIZATION._AIRBYTE_RAW_NESTED_STREAM_WITH_COMPLEX_COLUMNS_RESULTING_INTO_LONG_NAMES
),

input_data_with_active_row_num as (
select *,
row_number() over (
partition by ID
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _airbyte_active_row_num
from input_data
),
scd_data as (
-- SQL model to build a Type 2 Slowly Changing Dimension (SCD) table for each record identified by their primary key
select
Expand All @@ -42,11 +31,17 @@ scd_data as (
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _AIRBYTE_END_AT,
case when _airbyte_active_row_num = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
case when row_number() over (
partition by ID
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
_AIRBYTE_AB_ID,
_AIRBYTE_EMITTED_AT,
_AIRBYTE_NESTED_STREAM_WITH_COMPLEX_COLUMNS_RESULTING_INTO_LONG_NAMES_HASHID
from input_data_with_active_row_num
from input_data
),
dedup_data as (
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ input_data as (
-- NESTED_STREAM_WITH_COMPLEX_COLUMNS_RESULTING_INTO_LONG_NAMES from {{ source('TEST_NORMALIZATION', '_AIRBYTE_RAW_NESTED_STREAM_WITH_COMPLEX_COLUMNS_RESULTING_INTO_LONG_NAMES') }}
),
{% endif %}
input_data_with_active_row_num as (
select *,
row_number() over (
partition by ID
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _airbyte_active_row_num
from input_data
),
scd_data as (
-- SQL model to build a Type 2 Slowly Changing Dimension (SCD) table for each record identified by their primary key
select
Expand All @@ -80,11 +69,17 @@ scd_data as (
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _AIRBYTE_END_AT,
case when _airbyte_active_row_num = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
case when row_number() over (
partition by ID
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
_AIRBYTE_AB_ID,
_AIRBYTE_EMITTED_AT,
_AIRBYTE_NESTED_STREAM_WITH_COMPLEX_COLUMNS_RESULTING_INTO_LONG_NAMES_HASHID
from input_data_with_active_row_num
from input_data
),
dedup_data as (
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ input_data as (
-- DEDUP_EXCHANGE_RATE from "AIRBYTE_DATABASE".TEST_NORMALIZATION._AIRBYTE_RAW_DEDUP_EXCHANGE_RATE
),

input_data_with_active_row_num as (
select *,
row_number() over (
partition by ID, CURRENCY, cast(NZD as
varchar
)
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _airbyte_active_row_num
from input_data
),
scd_data as (
-- SQL model to build a Type 2 Slowly Changing Dimension (SCD) table for each record identified by their primary key
select
Expand Down Expand Up @@ -55,11 +42,19 @@ scd_data as (
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _AIRBYTE_END_AT,
case when _airbyte_active_row_num = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
case when row_number() over (
partition by ID, CURRENCY, cast(NZD as
varchar
)
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
_AIRBYTE_AB_ID,
_AIRBYTE_EMITTED_AT,
_AIRBYTE_DEDUP_EXCHANGE_RATE_HASHID
from input_data_with_active_row_num
from input_data
),
dedup_data as (
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ input_data as (
-- DEDUP_EXCHANGE_RATE from {{ source('TEST_NORMALIZATION', '_AIRBYTE_RAW_DEDUP_EXCHANGE_RATE') }}
),
{% endif %}
input_data_with_active_row_num as (
select *,
row_number() over (
partition by ID, CURRENCY, cast(NZD as {{ dbt_utils.type_string() }})
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _airbyte_active_row_num
from input_data
),
scd_data as (
-- SQL model to build a Type 2 Slowly Changing Dimension (SCD) table for each record identified by their primary key
select
Expand All @@ -89,11 +78,17 @@ scd_data as (
DATE desc,
_AIRBYTE_EMITTED_AT desc
) as _AIRBYTE_END_AT,
case when _airbyte_active_row_num = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
case when row_number() over (
partition by ID, CURRENCY, cast(NZD as {{ dbt_utils.type_string() }})
order by
DATE is null asc,
DATE desc,
_AIRBYTE_EMITTED_AT desc
) = 1 then 1 else 0 end as _AIRBYTE_ACTIVE_ROW,
_AIRBYTE_AB_ID,
_AIRBYTE_EMITTED_AT,
_AIRBYTE_DEDUP_EXCHANGE_RATE_HASHID
from input_data_with_active_row_num
from input_data
),
dedup_data as (
select
Expand Down

0 comments on commit 3dc361d

Please sign in to comment.