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

Fix does_table_exist macro cases where quoted objects exist in graph #85

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion macros/does_table_exist.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{%- macro does_table_exist(table_name) -%}
{%- if execute -%} -- returns true when dbt is in execute mode
{%- set ns = namespace(has_table=false) -%} -- declare boolean namespace and default value
{%- set stripe_database = var('stripe_database') -%} -- get stripe database from project.yml
{%- set stripe_schema = var('stripe_schema') -%} -- get stripe schema from project.yml
{%- for node in graph.sources.values() -%} -- grab sources from the dictionary of nodes
-- call the database for the matching table
{%- set source_relation = adapter.get_relation(
Expand All @@ -14,4 +16,4 @@
{% endif %}
{%- endfor -%}
{%- endif -%}
{%- endmacro -%}
{%- endmacro -%}