I am working on a demo project on dbt with AWS Athena, I can build dbt models and working with Athena well. There are two problems:
- The output location in AWS s3 requires a dynamic location. In our case, we need the storage path with date, i.e. s3://mybucket/dbt/2023/01/17/demo.
- The generated parquet file is all good except its file name. I got something like: “20230112_023258_00015_ddqb9_6b8d55cf-02bd-4f7b-80f4-f6dc991829b3”. I would like to customize its name like: “mydemo001.parquet”.
Note: I tried but cannot find much helpful info from internet. I also tried to define various ‘vars’ but seem not working in this case.
Here are the sample code:
{{ config(materialized=‘table’, file_format=‘parquet’, external_location=‘s3://mybucket/dbt/demo’) }}
with source_data as (
select distinct emplid from {{ source(‘demo_athena’, ‘demo_table’) }}
)
select * from source_data