Resource "Snowflake_view" giving an error when the Query runs fine on a snowflake worksheet #1986
Unanswered
Jessica-Lu-404
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have a Snowflake View that needs to be managed as a resource in Terraform but I keep getting an error when trying to create this view
resource "snowflake_view" "forecast_features" {
database = var.base_schema.database
schema = var.base_schema.name
name = "FORECAST_FEATURES"
comment = "forecast_features view"
or_replace = true
statement = <<EOT
select
all_combos.date,
all_combos.site_id,
all_combos.item_id,
zeroifnull(agg_trans.soldunits) as soldunits,
ffg.month_1,
ffg.month_2,
ffg.month_3,
ffg.month_4,
ffg.month_5,
ffg.month_6,
ffg.month_7,
ffg.month_8,
ffg.month_9,
ffg.month_10,
ffg.month_11,
ffg.month_12,
ffg.weekday_0,
ffg.weekday_1,
ffg.weekday_2,
ffg.weekday_3,
ffg.weekday_4,
ffg.weekday_5,
ffg.weekday_6
from
RETAILOPS.tf_scct_base.all_combos as all_combos
left join RETAILOPS.tf_scct_base_agg_trans as agg_trans on agg_trans.date = all_combos.date
and agg_trans.site_id = all_combos.site_id
and agg_trans.item_id = all_combos.item_id,
table(
RETAILOPS.tf_scct_base.udtf_forecast_feature_gen(
month(all_combos.date),
dayofweek(all_combos.date)
)
) AS ffg
order by
all_combos.date asc;
EOT
}
The actual query statement runs fine in a Snowflake worksheet.
Beta Was this translation helpful? Give feedback.
All reactions