Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Creating Elementary models fails on Athena Engine V3 #1678

Closed
oliviercar0n opened this issue Aug 22, 2024 · 2 comments
Closed

Bug: Creating Elementary models fails on Athena Engine V3 #1678

oliviercar0n opened this issue Aug 22, 2024 · 2 comments
Labels
Bug Something isn't working Triage 👀

Comments

@oliviercar0n
Copy link

oliviercar0n commented Aug 22, 2024

Describe the bug

When following the instructions to set up Elementary on a project with Athena data warehouse, the following error is encountered when creating the Elementary models

NOT_SUPPORTED: Incorrect timestamp precision for timestamp(6); the configured precision is MILLISECONDS; column name: bucket_start.

This is a known issue with Athena and CTAS statements. See additional context below

To Reproduce
Steps to reproduce the behavior:

  1. Add Elementary package 0.16.0 to a dbt project
  2. Run the following command as specific in the documentation
dbt run --select elementary

Expected behavior
All model complete successfully

Screenshots

CleanShot 2024-08-22 at 12 08 54

CleanShot 2024-08-22 at 12 13 27

Environment (please complete the following information):

  • Elementary CLI (edr) version: 0.16.0
  • Elementary dbt package version: 0.16.0
  • dbt version: 1.8.3
  • Data warehouse: Athena
  • Infrastructure details (e.g. operating system, prod / dev / staging, deployment infra, CI system, etc)

Additional context

This error is documented in the Athena Engine V3 release notes

Athena engine version 3 checks to make sure that the precision of timestamps in the data is the same as the precision specified for the column data type in the table specification. Currently, this precision is always 3. If the data has a precision greater than this (for example, microseconds instead of milliseconds), queries can fail with the error noted. [...] Then, because Athena does not support timestamp 6, cast the value again to timestamp (for example, in a view).

Would you be willing to contribute a fix for this issue?
Yes I would be willing to help contribute a fix

@oliviercar0n oliviercar0n added Bug Something isn't working Triage 👀 labels Aug 22, 2024
@oliviercar0n
Copy link
Author

It appears it tries to create views as table

-- /* {"app": "dbt", "dbt_version": "1.8.3", "profile_name": "athena_finance", "target_name": "dev", "node_id": "model.elementary.metrics_anomaly_score"} */


    create table "awsdatacatalog"."dbt_oli"."metrics_anomaly_score"
    with (
      table_type='hive',
      is_external=true,external_location='s3://<redacted>/dbt/dev/output/dbt_oli/metrics_anomaly_score/7ee042ca-bf21-45ba-b9d7-7e03ff67bc58',
      write_compression='SNAPPY',
      format='parquet'
    )
    as

@oliviercar0n
Copy link
Author

There was a global materialization config that affected Elementary models. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Triage 👀
Projects
None yet
Development

No branches or pull requests

1 participant