-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from fivetran/bugfix/duplicate-columns
Bugfix/duplicate columns
- Loading branch information
Showing
25 changed files
with
97 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
target/ | ||
dbt_modules/ | ||
logs/ | ||
env/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
engagement_id,_fivetran_deleted,_fivetran_synced,property_hs_createdate,property_hs_object_id,property_hs_task_type,property_hs_timestamp,property_hubspot_owner_id,property_hubspot_team_id,type | ||
32034933897,false,2023-06-08 23:22:51.021000,2023-03-03 10:40:09.556000,32034933897,TODO,2023-03-08 02:30:00.000000,32779820,9747038,TASK | ||
engagement_id,_fivetran_deleted,_fivetran_synced,property_hs_createdate,property_hs_object_id,property_hs_task_type,property_hs_timestamp,property_hubspot_owner_id,property_hubspot_team_id,type,task_type,property_hs_engagement_source | ||
32034933897,false,2023-06-08 23:22:51.021000,2023-03-03 10:40:09.556000,32034933897,TODO,2023-03-08 02:30:00.000000,32779820,9747038,TASK,,Hello | ||
32034933899,false,2023-06-08 23:22:51.021000,2023-03-03 10:40:09.556000,32034933897,,2023-03-08 02:30:00.000000,32779820,,,TODO, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% macro remove_duplicate_and_prefix_from_columns(columns, prefix='', exclude=[]) %} | ||
|
||
{# Loop once to find duplicates #} | ||
{%- set duplicate_exclude = [] -%} | ||
{% for col in columns if col.name not in exclude %} | ||
{%- for dupe in columns if col.name[prefix|length:]|lower == dupe.name|lower -%} | ||
{%- do duplicate_exclude.append(col.name) -%} | ||
{%- do duplicate_exclude.append(dupe.name) -%} | ||
, {{ col.name }} as {{ col.name[prefix|length:] }} | ||
{%- endfor %} | ||
{% endfor %} | ||
|
||
{# Loop again to find non-duplicates #} | ||
{% for col in columns if col.name not in exclude %} | ||
{%- if col.name|lower not in duplicate_exclude|lower -%} | ||
{% if col.name[:prefix|length]|lower == prefix %} | ||
, {{ col.name }} as {{ col.name[prefix|length:] }} | ||
{%- else %} | ||
, {{ col.name }} | ||
{%- endif -%} | ||
{%- endif -%} | ||
{% endfor %} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters