Jade Forlani-Brennan
07/31/2024, 10:28 AMedr report command working.
Error:
2024-07-31 12:28:17 — INFO — Running with edr=0.15.1
2024-07-31 12:28:17 — ERROR — Unable to get the latest invocation: Failed to run dbt command.
2024-07-31 12:28:17 — ERROR — Failed to parse Elementary's database and schema.
2024-07-31 12:28:17 — INFO — Running dbt --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_test_results", "macro_args": {"days_back": 7, "invocations_per_test": 720, "disable_passed_test_metrics": false}} --project-dir C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\dbt_project
2024-07-31 12:28:17 — ERROR — Could not generate the report - Error: Failed to run dbt command.
Please reach out to our community for help with this issue.
Environment
Database*: snowflake*
OS: Windows 11 (x64)
Python: 3.11.9
dbt type: dbt-core (snowflake)
dbt package: dbt-snowflake 1.8.3
elementarty type: elementary community CLI
elementary-data: elementary-data[snowflake] 0.15.1
virtual environment manager: poetry
Troubleshooting steps attempted:
1. I have tried edr version 0.15.1 and 0.15.2, no change in error
2. I have tried both using the poetry virtual environemt and using no virtual env manager, no change in error
3. I have succesful ran dbt run -s package:elementary and dbt run -s elementary --full-refresh
4. I have checked my .dbt/profiles.yml, which seems to have the same connection details as I use for my regular dbt project, details found below
5. I have checked the Snowflake database and confirmed the schema elementary exists and is populated with tables and views after running step 3.
6. I have tried searching google and this slack channel for other people with the same issue. It seems a few users had similar issues which were fixed by either updating the dbt package from 0.15.0 to 0.15.1, or there was an issue with their path related to packages.yml. I've tried to apply the learnings from both but may have missed something.
7. I've checked the snowflake query logs and confirmed that no queries were generated.
Current theory
My current theory is that it's failing to call/exeucte the dbt command, so it's failing in the step before it even attempts to connect to the Snowflake database. This I'm a little unsure how to continue debugging as the edr report command looks like it calls dbt as a sub-process, so I would first want to check which dbt that subprocess is using and make sure it's the same one as in my poetry created virtual environement. And try to reproduce the command and error directly myself in terminal.
profiles.yml
target: elementary
outputs:
elementary:
dbt_project.yml
models:
elementary:
+schema: "elementary"
edr.log
2024-07-31 12:40:30 � INFO � Running with edr=0.15.1
2024-07-31 12:40:30 � DEBUG � Running dbt --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_latest_invocation", "macro_args": {}} --project-dir C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\dbt_project
[31;20m2024-07-31 12:40:30 � ERROR � Unable to get the latest invocation: Failed to run dbt command.[0m
2024-07-31 12:40:30 � DEBUG � Running dbt --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_adapter_type_and_unique_id", "macro_args": {}} --project-dir C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\dbt_project
2024-07-31 12:40:30 � DEBUG � Could not get warehouse info.
Traceback (most recent call last):
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\clients\dbt\dbt_runner.py", line 88, in _run_command
result = subprocess.run(
^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dbt', '--log-format', 'json', 'run-operation', 'elementary.log_macro_results', '--args', '{"macro_name": "elementary_cli.get_adapter_type_and_unique_id", "macro_args": {}}', '--project-dir', 'C:\\Users\\Jade.Forlani\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\snowflake-transformations-UkusCXy8-py3.11\\Lib\\site-packages\\elementary\\monitor\\dbt_project']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\data_monitoring\data_monitoring.py", line 140, in _get_warehouse_info
self.internal_dbt_runner.run_operation(
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\clients\dbt\dbt_runner.py", line 160, in run_operation
success, command_output = self._run_command(
^^^^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\clients\dbt\dbt_runner.py", line 99, in _run_command
raise DbtCommandError(err, command_args, logs=logs)
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command.
2024-07-31 12:40:30 � DEBUG � Running dbt --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_elementary_database_and_schema", "macro_args": {}} --project-dir C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\dbt_project
[31;20m2024-07-31 12:40:30 � ERROR � Failed to parse Elementary's database and schema.[0m
2024-07-31 12:40:30 � INFO � Running dbt --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_test_results", "macro_args": {"days_back": 7, "invocations_per_test": 720, "disable_passed_test_metrics": false}} --project-dir C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\dbt_project
[31;20m2024-07-31 12:40:31 � ERROR � Could not generate the report - Error: Failed to run dbt command.
Please reach out to our community for help with this issue.[0m
Traceback (most recent call last):
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\clients\dbt\dbt_runner.py", line 88, in _run_command
result = subprocess.run(
^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dbt', '--log-format', 'json', 'run-operation', 'elementary.log_macro_results', '--args', '{"macro_name": "elementary_cli.get_test_results", "macro_args": {"days_back": 7, "invocations_per_test": 720, "disable_passed_test_metrics": false}}', '--project-dir', 'C:\\Users\\Jade.Forlani\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\snowflake-transformations-UkusCXy8-py3.11\\Lib\\site-packages\\elementary\\monitor\\dbt_project']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\api\report\report.py", line 50, in get_report_data
tests_api = TestsAPI(
^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\api\tests\tests.py", line 43, in __init__
self.test_results_db_rows = self._get_test_results_db_rows(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\api\tests\tests.py", line 55, in _get_test_results_db_rows
return self.tests_fetcher.get_all_test_results_db_rows(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\monitor\fetchers\tests\tests.py", line 25, in get_all_test_results_db_rows
run_operation_response = self.dbt_runner.run_operation(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\clients\dbt\dbt_runner.py", line 160, in run_operation
success, command_output = self._run_command(
^^^^^^^^^^^^^^^^^^
File "C:\Users\Jade.Forlani\AppData\Local\pypoetry\Cache\virtualenvs\snowflake-transformations-UkusCXy8-py3.11\Lib\site-packages\elementary\clients\dbt\dbt_runner.py", line 99, in _run_command
raise DbtCommandError(err, command_args, logs=logs)
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command.Connor McShane
08/07/2024, 2:24 PMelementary:
outputs:
default:
dataset: elementary_connor
# the next lines just copy from your other outputs
job_execution_timeout_seconds: 3600 # 30 minutes, full-loads can take a while
job_retries: 1
location: EU
method: oauth
priority: interactive
project: <MY GCP PROJECT>
threads: 8
type: bigquery
Your models looks correct. Other thing I needed to do is specify profiles-dir .
edr report --profiles-dir . or whereever your profiles-dir is, I have an env var set for this but for some reason it wasn’t getting picked up