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

Change dbt columns materialization in bigquery #450

Merged
merged 7 commits into from
Aug 3, 2023

Conversation

ofek1weiss
Copy link
Contributor

No description provided.

@ofek1weiss ofek1weiss requested a review from elongl August 2, 2023 12:11
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

👋 @ofek1weiss
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in the elementary repository.

@@ -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 %}
Copy link
Member

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.

Copy link
Contributor Author

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) %}
Copy link
Member

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() %}
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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 %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

Copy link
Member

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.

@ofek1weiss ofek1weiss merged commit b698b4f into master Aug 3, 2023
8 checks passed
@ofek1weiss ofek1weiss deleted the change-dbt-columns-materialization-in-bigquery branch August 3, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants