-
Notifications
You must be signed in to change notification settings - Fork 89
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
Change dbt columns materialization in bigquery #450
Change dbt columns materialization in bigquery #450
Conversation
👋 @ofek1weiss |
@@ -0,0 +1,66 @@ | |||
{% macro get_dbt_columns_query(is_on_run_end=false) %} | |||
{% if is_on_run_end %} | |||
{% set get_relation = elementary.get_elementary_relation %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we care, but just a thought, if a user installs Elementary and doesn't run our models, this would return None
and then the query would be from None
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if he does not run our models, this wont run as well
@@ -0,0 +1,66 @@ | |||
{% macro get_dbt_columns_query(is_on_run_end=false) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The true distinction that you want to make is whether you're in a model build context or not so I'd rename this to in_model_build_context
or something like that. For instance, in the on-run-start
, materializations, or other places, it's still meaningful.
@@ -26,6 +26,10 @@ | |||
{% do elementary.file_log('[{}] Artifacts already ran.'.format(artifacts_model)) %} | |||
{% endif %} | |||
{% endfor %} | |||
{% if elementary.get_dbt_columns_materialization() != "view" %} | |||
{% do adapter.commit() %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? There's should_commit=true
for the uploads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we need to commit before running the dbt_columns
query, as it queries the other artifacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I'm saying that the there are no pending transactions at this point because of the should_commit=True
and each model commits when it finishes executing.
{% macro upload_dbt_columns() %} | ||
{% set relation = elementary.get_elementary_relation('dbt_columns') %} | ||
{% if execute and relation %} | ||
{% set query %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use create_or_replace
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this macro exists?, i searched and did not find it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? There's a link in my comment, lol.
No description provided.