`edr report` error on Athena due to incorrect `table_type="hive"`
Describe the bug
After the changes introduced in v0.16.2, the edr report command fails with the following Athena error:
NOT_SUPPORTED: Incorrect timestamp precision for timestamp(6); the configured precision is MILLISECONDS; column name: detected_at.
To Reproduce Steps to reproduce the behavior:
- Run
edr reportwith anelementaryprofile withtype: athena.
Expected behavior The report is generated without issues.
Environment (please complete the following information):
- Elementary CLI (edr) version: 0.16.2
- Elementary dbt package version: 0.16.4
- dbt version: 1.9.2
- Data warehouse: athena (
dbt-athena==1.9.1)
Additional context
The error occurs when running the elementary_cli.get_test_results macro:
2025-02-20 12:48:19 — 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/49353/dbt/.venv/lib/python3.13/site-packages/elementary/monitor/dbt_project
2025-02-20 12:50:16 — ERROR — Could not generate the report - Error: Failed to run dbt command.
{"info": {"name": "RunningOperationCaughtError", "code": "Q001", "msg": "Encountered an error while running operation: Runtime Error\n Runtime Error\n NOT_SUPPORTED: Incorrect timestamp precision for timestamp(6); the configured precision is MILLISECONDS; column name: detected_at. You may need to manually clean the data at location 's3://tendam-temporary/dbt/tables/e036cef7-71f4-499d-935b-fe1c9f37748d' before retrying. Athena will not delete data in your account.", "level": "error", "invocationId": "7ad27197-17fa-4c8c-afc4-35dd624bf45a", "pid": 6096, "thread": "MainThread", "ts": "2025-02-20T11:50:15.651080Z"}, "data": {"exc": "Runtime Error\n Runtime Error\n NOT_SUPPORTED: Incorrect timestamp precision for timestamp(6); the configured precision is MILLISECONDS; column name: detected_at. You may need to manually clean the data at location 's3://tendam-temporary/dbt/tables/e036cef7-71f4-499d-935b-fe1c9f37748d' before retrying. Athena will not delete data in your account."}}
Please reach out to our community for help with this issue
This is because now the get_test_results macro creates the temporary table
-- /* {"app": "dbt", "dbt_version": "1.9.2", "profile_name": "elementary", "target_name": "default", "connection_name": "macro_log_macro_results"} */
create table "awsdatacatalog"."elementary"."ordered_test_resultsNone"
with (
table_type='hive',
is_external=true,external_location='s3://tendam-temporary/dbt/tables/elementary/ordered_test_resultsNone/18a5eb4c-ef6e-4d13-9f40-291e129d9dba',
format='parquet'
)
as
...
instead of querying athena directly. Setting table_type='iceberg' (in line with the get_default_table_type macro) solves the issue.
Would you be willing to contribute a fix for this issue? Yes, if appropriate guidance is provided 😄.
What happens if you set the table_type under your dbt_project.yml to 'iceberg'?
Hi @datahunter1205, I already tried that before opening the issue, without success.
Same issue too. May I ask how to set table_type='iceberg' in get_default_table_type macro?
Hi, Same issue. I have same question as @dot1258 .
Thanks
I just meant the solution would be to set table_type='iceberg' somehow in the package. I am currently running v0.16.1 until this is fixed.
Thanks @gontzalm .
I downgraded to 0.16.1 and now is working. I was using the last version: 0.18.0
Hey @gontzalm @datahunter1205 @dot1258 ! See Elementary dbt package 0.18.2 and CLI 0.18.1. This has been fixed 🙌
Hi @NoyaOffer, I just upgraded Elementary and confirm this issue is fixed in 0.18.1. Thank you 💯.