fivetran / dbt_hubspot_source

Data models for Hubspot built using dbt.
https://fivetran.github.io/dbt_hubspot_source/
Apache License 2.0
31 stars 30 forks source link

[Bug] Staging models with where clause before fill_staging_columns macro #66

Closed fivetran-joemarkiewicz closed 2 years ago

fivetran-joemarkiewicz commented 2 years ago

Is there an existing issue for this?

Describe the issue

There are a few staging models where there is a where clause within the first CTE before the fill_staging_columns macro is created.

This can cause errors if the field in the where clause is not in the source table. See here for an example of this error.

Relevant error log or model output

15:24:45  Database Error in model stg_hubspot__contact_list_member (models/stg_hubspot__contact_list_member.sql)
15:24:45    column "_fivetran_deleted" does not exist
15:24:45    LINE 12:     where not coalesce(_fivetran_deleted, false)

Expected behavior

The staging model leverages the fill_staging_columns macro to pass a null record in when the field does not exist in the source table.

dbt Project configurations

N/A

Package versions

packages:

What database are you using dbt with?

postgres, redshift, snowflake, bigquery, databricks

dbt Version

installed version: 1.0.4
   latest version: 1.1.0

Additional Context

No response

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