Hi all, I’m having trouble generating the report (...
# community-support
p
Hi all, I’m having trouble generating the report (
edr report --select last_invocation --env prod
): I’ve got an error that says
Copy code
2024-06-18 08:21:29 — ERROR — Could not generate the report - Error: Failed to run dbt command.
Please reach out to our community for help with this issue.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/elementary/clients/dbt/dbt_runner.py", line 88, in _run_command
    result = subprocess.run(
  File "/usr/local/lib/python3.10/subprocess.py", line 526, 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', '/usr/local/lib/python3.10/site-packages/elementary/monitor/dbt_project']' died with <Signals.SIGKILL: 9>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/elementary/monitor/api/report/report.py", line 50, in get_report_data
    tests_api = TestsAPI(
  File "/usr/local/lib/python3.10/site-packages/elementary/monitor/api/tests/tests.py", line 43, in __init__
    self.test_results_db_rows = self._get_test_results_db_rows(
  File "/usr/local/lib/python3.10/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 "/usr/local/lib/python3.10/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 "/usr/local/lib/python3.10/site-packages/elementary/clients/dbt/dbt_runner.py", line 160, in run_operation
    success, command_output = self._run_command(
  File "/usr/local/lib/python3.10/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.
details in the thread, any help is much appreciated 🙏
my package version:
Copy code
- package: elementary-data/elementary
    version: 0.15.1
in my devcontainer
Copy code
RUN pip install elementary-data==0.15.1
RUN pip install 'elementary-data[redshift]'
however, still, I receive the following warning:
Copy code
2024-06-18 08:20:05 — WARNING — You are using incompatible versions between edr (0.15.1) and Elementary's dbt package (0.11.1).
 To fix please update your packages.yml, and run:
dbt deps && dbt run --select elementary
I’ve run the following commands after updating
packages.yml
to
0.15.1
Copy code
dbt clean && dbt deps
dbt run -s elementary -t prod
the error persists also if I drop all the flags, i.e. simply running
edr report
update: I was on dbt 1.5.1 and now I’ve updated to dbt 1.7.7. The update to Elementary’s dbt package (1.5.1) is now successful and the warning message about that went away. However, the main error message stayed and the report is not generating.
👍 2
s
Did you ever find what was the issue? I'm having the same error and can't seem to resolve it. I tried pruning the Elementary tables but no luck
p
yes, I did. So the basics are: 1. update elementary cli 2. and elementary dbt package so they are compatible (you get a warning if they are not) I don’t fully remember what I had to remove exactly but these are your options. 1. first run into the error again (e.g. run `dbt run -s dummy_model`in your terminal w/ elementary hooks being enabled) 2. then open either dbt logs or elementary logs (in the edr_target folder) 3. search for the error message in the logs from the failed elementary cli command 4. see which table or view was updating before it ran into the error 5. remove that table or view 6. then run
dbt run -s elementary
7. it should work but if not, try re-running models with
--full-refresh
that come up in the logs and may cause the issues (if they are incremental)
not entirely sure but I think my last error was regarding the
elementary.dbt_columns
view
s
Thanks! I'll give it a try!
Just FYI and in case someone else stumbles into this in the future, I followed these steps but still couldn't make it work (in production environment not local). What worked for me was setting the
--days-back
parameter of the
edr send-report
command to 5 days (instead of the default 7). Not ideal as I still wasn't able to pinpoint the problematic tables(s) and/ore computations. Also I have to report on less days. Thanks for the support Peter!
p
sorry to hear that you didn’t find the actual culprit. edit: I think the underlying issue is that a “simple” elementary update isn’t working if you simply follow the docs. The reason being that tables/views that elementary create change across their updates and are not backward compatible. With these updates deletion/update of these underlying resources is not automated and error messages are not informative either.
s
Yes that's an interesting perspective, I also noticed these schema changes when I upgraded to the latest version and had to backup a the tables to keep history. I might take another stab at it, in the near future, hopefully with fresh eyes
p
good luck, hope you’ll figure it out 🤞
thankyou 1