Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] - update_persist_pass_through_columns to include field aliasing #115

Open
fivetran-reneeli opened this issue May 2, 2023 · 0 comments
Labels
type:enhancement New functionality or enhancement

Comments

@fivetran-reneeli
Copy link

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 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 %}
@fivetran-joemarkiewicz fivetran-joemarkiewicz changed the title update_persist_pass_through_columns [FEATURE] - update_persist_pass_through_columns to include field aliasing Feb 23, 2024
@fivetran-joemarkiewicz fivetran-joemarkiewicz added the type:enhancement New functionality or enhancement label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New functionality or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants