fivetran / dbt_fivetran_log

Data models for Fivetran's internal log connector built using dbt.
https://fivetran.github.io/dbt_fivetran_log/
Apache License 2.0
30 stars 24 forks source link

[Bug] empty `credits_used` table causing date-casting error in `fivetran_platform__usage_mar_destination_history` #104

Closed fivetran-jamie closed 8 months ago

fivetran-jamie commented 9 months ago

Is there an existing issue for this?

Describe the issue

This line is failing with the below error message. I think this is occurring because we employ a full outer join in this CTE, on tables that are potentially 1-record all-NULL tables (https://github.com/fivetran/dbt_fivetran_log/blob/main/models/staging/stg_fivetran_platform__credits_used.sql and https://github.com/fivetran/dbt_fivetran_log/blob/main/models/staging/stg_fivetran_platform__usage_cost.sql)

I think we can get around this by adding a limit 0 to these all-null staging models in order to avoid fanout.

Relevant error log or model output

Database Error in model fivetran_platform__usage_mar_destination_history (models/fivetran_platform__usage_mar_destination_history.sql)

invalid input syntax for type date: "-01"  
compiled Code at target/run/fivetran_log/models/fivetran_platform__usage_mar_destination_history.sql

Expected behavior

No error

dbt Project configurations

Quickstart

Package versions

Quickstart

What database are you using dbt with?

postgres

dbt Version

1.6.6

Additional Context

No response

Are you willing to open a PR to help address this issue?