hello, Im upgrading to latest elementary version (...
# community-support
v
hello, Im upgrading to latest elementary version (0.18.1 cli, 0.18.2 package). Got the below error, I couldnt find any reason causing this? Anyone can help to debug this? Thank you.
Copy code
2025-04-16 08:12:58,917  [INFO]: Successfully connected to Snowflake

    ________                          __
   / ____/ /__  ____ ___  ___  ____  / /_____ ________  __
  / __/ / / _ \/ __ `__ \/ _ \/ __ \/ __/ __ `/ ___/ / / /
 / /___/ /  __/ / / / / /  __/ / / / /_/ /_/ / /  / /_/ /
/_____/_/\___/_/ /_/ /_/\___/_/ /_/\__/\__,_/_/   \__, /
                                                 /____/


Any feedback and suggestions are welcomed! join our community here - <https://bit.ly/slack-elementary>

2025-04-16 08:13:01 — INFO — Running with edr=0.18.1
2025-04-16 08:13:08 — INFO — edr (0.18.1) and Elementary's dbt package (0.18.1) are compatible.
2025-04-16 08:13:09 — INFO — Elementary's database and schema: '"CI_DBT.SNAP_PROD_ANALYTICS_ELEMENTARY"'
2025-04-16 08:13:09 — INFO — Running dbt command --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 /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/dbt_project --profiles-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form --target default
2025-04-16 08:14:23 — INFO — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_source_freshness_results", "macro_args": {"days_back": 7, "invocations_per_test": 720}} --project-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/dbt_project --profiles-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form --target default
2025-04-16 08:14:27 — INFO — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_seeds", "macro_args": {}} --project-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/dbt_project --profiles-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form --target default
2025-04-16 08:14:30 — INFO — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_snapshots", "macro_args": {}} --project-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/dbt_project --profiles-dir /Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form --target default
{"data": {"exc": "Database Error\n  000904 (42000): SQL compilation error: error line 21 at position 18\n  invalid identifier 'UNIQUE_KEY'"}, "info": {"category": "", "code": "Q001", "extra": {}, "invocation_id": "b86b0e86-6fc4-4643-87ae-fe01544f85fc", "level": "error", "msg": "Encountered an error while running operation: Database Error\n  000904 (42000): SQL compilation error: error line 21 at position 18\n  invalid identifier 'UNIQUE_KEY'", "name": "RunningOperationCaughtError", "pid": 16402, "thread": "MainThread", "ts": "2025-04-16T01:14:33.036462Z"}}
2025-04-16 08:14:34 — ERROR — Could not generate the report - Error: Failed to run dbt command.
{"info": {"name": "RunningOperationCaughtError", "code": "Q001", "msg": "Encountered an error while running operation: Database Error\n  000904 (42000): SQL compilation error: error line 21 at position 18\n  invalid identifier 'UNIQUE_KEY'", "level": "error", "invocationId": "b86b0e86-6fc4-4643-87ae-fe01544f85fc", "pid": 16402, "thread": "MainThread", "ts": "2025-04-16T01:14:33.036462Z"}, "data": {"exc": "Database Error\n  000904 (42000): SQL compilation error: error line 21 at position 18\n  invalid identifier 'UNIQUE_KEY'"}}
Please reach out to our community for help with this issue.
Traceback (most recent call last):
  File "/Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/api/report/report.py", line 103, in get_report_data
    snapshots = models_api.get_snapshots()
  File "/Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/api/models/models.py", line 140, in get_snapshots
    snapshot_results = self.models_fetcher.get_snapshots()
  File "/Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/monitor/fetchers/models/models.py", line 48, in get_snapshots
    run_operation_response = self.dbt_runner.run_operation(
  File "/Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 177, in run_operation
    result = self._run_command(
  File "/Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 114, in _run_command
    result = self._inner_run_command(
  File "/Users/vanducng/git/work/cnb/cnb-ds-dbt-order-form/.venv/lib/python3.10/site-packages/elementary/clients/dbt/api_dbt_runner.py", line 54, in _inner_run_command
    raise DbtCommandError(
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command.
{"info": {"name": "RunningOperationCaughtError", "code": "Q001", "msg": "Encountered an error while running operation: Database Error\n  000904 (42000): SQL compilation error: error line 21 at position 18\n  invalid identifier 'UNIQUE_KEY'", "level": "error", "invocationId": "b86b0e86-6fc4-4643-87ae-fe01544f85fc", "pid": 16402, "thread": "MainThread", "ts": "2025-04-16T01:14:33.036462Z"}, "data": {"exc": "Database Error\n  000904 (42000): SQL compilation error: error line 21 at position 18\n  invalid identifier 'UNIQUE_KEY'"}}
2025-04-16 08:14:36,300  [ERROR]: 2025-04-16 08:14:34.734 osascript[16622:46802674] ApplePersistence=NO
n
Hey @Van Duc Nguyen! It seems that the Elementary tables haven't been updated to their new structure yet. Try running
dbt run --select elementary
and see if it helps 🙂
v
yeah, I did it before running the report command. Could you guide me where I can see the log under the hood like checking the compile sql? It says
invalid identifier 'UNIQUE_KEY'"
after running
"macro_name": "elementary_cli.get_snapshots"
, which table or model should I check?
n
This error refers to two tables that had a column
unique key
added to them in latest versions -
dbt_snapshots
and
dbt models
. Can you check if you have these columns there?
👀 1
v
Thanks @Noya Offer, somehow I did run
dbt run --select elementary --full-refresh
before, I reran
dbt run --select elementary
again and the
unique_key
now appears. I is working now. Thank youuuu!
🙌 1
n
Amazing!