Skip to content

Commit

Permalink
Raise exception on missing compute resource
Browse files Browse the repository at this point in the history
Raise an exception if a model specifies a compute resource that is not defined in the profile.
Signed-off-by: Raymond Cypher <[email protected]>
  • Loading branch information
rcypher-databricks committed Oct 30, 2023
1 parent ef89e18 commit fbe3f25
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dbt/adapters/databricks/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,16 @@ def get_http_path(node: Optional[ResultNode], creds: DatabricksCredentials) -> O
# Get the http path of the compute resource specified in the node's config.
# If none is specified return the default path from creds.
compute_name = get_compute_name(node)
http_path = creds.http_path
if compute_name and creds.compute:
http_path = creds.compute.get(compute_name, {}).get("http_path", creds.http_path)
if not node or not compute_name:
return creds.http_path

http_path = None
if creds.compute:
http_path = creds.compute.get(compute_name, {}).get("http_path", None)

if not http_path:
raise dbt.exceptions.DbtRuntimeError(
f"Compute resource {compute_name} does not exist, relation: {node.relation_name}"
)

return http_path

0 comments on commit fbe3f25

Please sign in to comment.