fivetran / fivetran/dbt_fivetran_utils

[FEATURE] - update_persist_pass_through_columns to include field aliasing

Open
#115 0 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Shell
Stars
33
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Update the titular macro with this as the default. This is to allow for the case where we wish to append anything to any pass through fields. We ran into this in [salesforce](https://github.com/fivetran/dbt_salesforce/pull/38) where we were joining 1 table twice, and ran into problems with ambiguous columns. The below is Joe's fix for specifying which table a field is coming from.

```

{% macro custom_persist_pass_through_columns(pass_through_variable, identifier=none, transform='', append_string='') %}

{% if var(pass_through_variable, none) %}
{% for field in var(pass_through_variable) %}
, {{ transform ~ '(' ~ (identifier ~ '.' if identifier else '') ~ (field.alias if field.alias else field.name) ~ ')' }} as {{ field.alias if field.alias else field.name }}{{ append_string }}
{% endfor %}
{% endif %}

{% endmacro %}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.