databricks / dbt-databricks

A dbt adapter for Databricks.
https://databricks.com
Apache License 2.0
195 stars 104 forks source link

Handle in-progress refresh for MV/ST #674

Closed benc-db closed 1 month ago

benc-db commented 1 month ago

Description

If a scheduled refresh is already in progress when you request a refresh, you get an exception. Exception handling during a materialization is gnarly, so instead, I ensure that any in progress pipelines are completed before we do any further processing of an MV/ST.

This PR also removes polling for completion of a create or refresh kicked off by dbt, as those operations are now synchronous by default. Since I already have the pipeline id when I do need to check the refresh state, I can get rid of the API call we were using to get the pipeline id, which fixes another bug: refresh for MV/ST wasn't working in dbt-databricks if you needed to escape your relation name (since we had to strip off the escaping to call the API).

Checklist