[Bug] Update partitioning logic to account for source_relation
, empty source tables and union data
#77
Labels
error:unforced
status:in_review
Currently in review
type:bug
Something is broken or incorrect
type:enhancement
New functionality or enhancement
update_type:models
Primary focus requires model updates
Is there an existing issue for this?
Describe the issue
Sub-issue 1: Add
source_relation
to allpartition by
clausesFor models
stg_shopify__metafield
andstg_shopify__abandoned_checkout_discount_code
, the columnsource_relation
should be added to thepartition by
clauses used to determineis_most_recent_record
.Same update also needs to be added to line 5 of
int_shopify__customer_email_rollup
in the transform.Below update from @fivetran-avinash
Sub-issue 2: Identify best approach to handle empty source models for Redshift
In Redshift, an empty source model that contains a partitioning clause will fail at the staging layer with the
constant expressions are not supported in partition by clauses
error. One customer reported this error arising from thestg_shopify__abandoned_checkout_discount_code
model. This particularly comes into play when unioning schemas and databases.There are several approaches that could be taken, each which have pros and cons. See the comments for more details on the options.
The path forward we chose will be hard coding a case when statement for the situation where a table is empty.
Example code below:
Relevant error log or model output
No response
Expected behavior
is_most_recent_record
will produce correct flag when used with unioned sources.Null tables will not generate partitioning errors.
dbt Project configurations
n/a
Package versions
v0.10.0
Additional Context
No response
Are you willing to open a PR to help address this issue?
The text was updated successfully, but these errors were encountered: