You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{% set relation_exists = (load_relation(ref('my_model')) is not none %}
{% if relation_exists %}
{{ log("my_model has already been built", info=true) }}
{% else %}
{{ log("my_model doesn't exist in the warehouse. Maybe it was dropped?", info=true) }}
{% endif %}
When I run this snippet, I'll get the "my model doesn't exist" log, followed by a compilation error. This feels off since there would be no point in using this function to test if a relation exists if I can't use it with either ref or source.
Using adapter.get_relation would help solve the issue since it won't raise an error, but that entails with referring to the source database instead of assuming that a model exists.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm following this documentation
When I run this snippet, I'll get the "my model doesn't exist" log, followed by a compilation error. This feels off since there would be no point in using this function to test if a relation exists if I can't use it with either
ref
orsource
.Using
adapter.get_relation
would help solve the issue since it won't raise an error, but that entails with referring to the source database instead of assuming that a model exists.Beta Was this translation helpful? Give feedback.
All reactions