Skip to content

Commit 9c86335

Browse files
fix: add null checks for dbt node execution and compilation (#1695)
Co-authored-by: anandgupta42 <[email protected]>
1 parent 0e2fe61 commit 9c86335

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dbt_core_integration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,8 @@ def execute_sql(self, raw_sql: str, original_node: Optional[Union["ManifestNode"
693693
def execute_node(self, node: "ManifestNode") -> DbtAdapterExecutionResult:
694694
"""Execute dbt SQL statement against database from a"ManifestNode"""
695695
try:
696+
if node is None:
697+
raise ValueError("This model doesn't exist within this dbt project")
696698
raw_sql: str = getattr(node, RAW_CODE)
697699
compiled_sql: Optional[str] = getattr(node, COMPILED_CODE, None)
698700
if compiled_sql:
@@ -718,6 +720,8 @@ def compile_node(
718720
self, node: "ManifestNode"
719721
) -> Optional[DbtAdapterCompilationResult]:
720722
try:
723+
if node is None:
724+
raise ValueError("This model doesn't exist within this dbt project")
721725
with self.adapter.connection_named("master"):
722726
return self._compile_node(node)
723727
except Exception as e:

0 commit comments

Comments
 (0)