elementary-data / elementary

The dbt-native data observability solution for data & analytics engineers. Monitor your data pipelines in minutes. Available as self-hosted or cloud service with premium features.
https://www.elementary-data.com/
Apache License 2.0
1.84k stars 153 forks source link

`UNRESOLVED_COLUMN` exception when upgrading to elementary 0.15.1 #1538

Open hamzamazhar opened 2 months ago

hamzamazhar commented 2 months ago

Describe the bug When I upgrade to elementary 0.15.0 from 0.13.0 and run elementary models, it fails for the model model_run_results and throws this exception:

Runtime Error in model model_run_results (models/edr/run_results/model_run_results.sql)
  [UNRESOLVED_COLUMN.WITH_SUGGESTION] A column or function parameter with name `models`.`unique_id` cannot be resolved. Did you mean one of the following? [`run_results`.`unique_id`, `models`.`metadata_hash`, `run_results`.`query_id`, `run_results`.`name`, `run_results`.`failures`]

To Reproduce Steps to reproduce the behavior:

  1. One a new dbt project, use elementary==0.13.0 as a package and run elementary models with dbt run -s elementary
  2. Then, upgrade the elementary package to 0.15.0 and install this package.
  3. Run the elementary models again with dbt run -s elementary and this exception occurs.

Expected behavior Elementary models should run.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

haritamar commented 2 months ago

Hi @hamzamazhar ! Thanks for posting this issue. Unfortunately I'm not able to reproduce this, so I'm guessing this issue is a bit more specific to your environment.

I see that you are using Databricks. Are you using it with or without Unity Catalog? Does the dbt_models table exist in the elementary schema when this error occurs?

Any additional information about your setup can help to understand this.

hamzamazhar commented 3 weeks ago

@haritamar Apologies on my side. I upgraded from 0.13.0 -> 0.15.0 version. In the issue, I wrote 0.15.0 -> 0.15.1, which is incorrect. I have fixed the description of the issue.

I faced the same problem when I pushed the upgrade from version 0.13 to 0.15 on my production environment.

However, the interesting thing to note is that I ran this in an Airflow task with 3 retries specified on it.

My hunch is that some columns were missing in the elementary models when it first ran. However, it created those columns so by the time Airflow retried the task, the columns were already there and it passed.

I hope this is helpful.