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

#23 #26 Improve error handling for relation macros #27

Merged
merged 1 commit into from
Apr 29, 2022
Merged

Conversation

tovganesh
Copy link
Contributor

@tovganesh tovganesh commented Apr 14, 2022

Restructure relation macros to better handle errors, improving consistency of getting the relation types.

Description of the issue can be found in #23 and #26

Test plan:
The test cases are available in GH Issue #23 and Issue #26

@tovganesh tovganesh requested a review from sdairs April 14, 2022 12:24
@tovganesh tovganesh marked this pull request as draft April 14, 2022 12:25
@tovganesh tovganesh requested a review from geethamurthy April 14, 2022 16:12
@sdairs
Copy link
Collaborator

sdairs commented Apr 14, 2022

This seems to have improved things for #23 but not completely eliminated it - it is able to recover from a failure on a subsequent run, which it couldn't before.

I do still see drop table if exists dbt_demo_staging_covid.stg_covid__cases__dbt_backup being run on view materialisations.

Perhaps we should investigate a more reliable way of determining the entity type of a model?

@tovganesh
Copy link
Contributor Author

tovganesh commented Apr 18, 2022

This seems to have improved things for #23 but not completely eliminated it - it is able to recover from a failure on a subsequent run, which it couldn't before.

I do still see drop table if exists dbt_demo_staging_covid.stg_covid__cases__dbt_backup being run on view materialisations.

Perhaps we should investigate a more reliable way of determining the entity type of a model?

Right - the "drop table" is created because the get_relation_type macro defaults to return 'table' if the object is not found. May be the execution of drop shouldn't happen at all if the object is not found.

I have now added a tweak - which should take the relation type correctly.

I did try using jinja dbt functions - but wasn't able to get required info.

Were you able to also test this for #26 ?

The relevant macros are restructured to handle error better.

Test plan:
The test cases are available in GH Issue#23 and Issue#26
@sdairs sdairs marked this pull request as ready for review April 27, 2022 12:28
@sdairs sdairs requested a review from raghotham April 27, 2022 12:28
@sdairs sdairs changed the title This is a work in progress PR for addressing GH issue 23 and 26 #23 #26 Improve error handling for relation macros Apr 29, 2022
@raghotham
Copy link

LGTM

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