Skip to content

Handle empty values in get_column_values macro #1012

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions macros/sql/get_column_values.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@

{# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}
{# TODO: Change the method signature in a future 0.x.0 release #}
{%- set target_relation = table -%}

{%- set target_relation = table -%}
{% if table is string %}
{{ log("target_relation" ~ target_relation ~ "is not in the valid database.schema.table format. Returning the default value: " ~ default, info=True) }}
{{ return(default) }}
{% endif %}
{# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}
{% set relation_exists = (load_relation(target_relation)) is not none %}

Expand Down
Loading