Skip to content

ref macro breaks when using model aliases (without custom generate_alias_name) #47

@rossellatoma

Description

@rossellatoma

Hi! Thanks for this package, it’s been really helpful.

In our dbt project, we frequently use the alias property to override model names (without a custom generate_alias_name macro). As a result, the production table name often differs from the filename.

To get the ref macro working correctly, we had to update this line:

{% set prod_rel_name = re.search("\w+(?=\.)", parent_node.path).group() %}

to instead use:

{% set prod_rel_name = parent_node.alias %}

This ensures the macro returns the correct table name.

I realise this may be an edge case but wanted to flag in case it’s useful (and to make sure I'm not missing a key piece.. we are on Snowflake)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions