insert by period materialization failing on last hour


I’m running backfill job using

I’m using insert_by_period_materialization for backfill incremental load.
Im incrementaly loading historical data per hour and all hours of increment works nice except last one which fails with statement:

 Tried to run an empty query on model 
   sql, eg. in a model hook, make sure your `else` clause contains valid sql!

I googled but it seeme like this is not really error it’s just that dbt fails in case it has to run empty query.
This is causing problems since model stops execution on this error.
Any help apriciated,

Hey @hrvoje, I’d suggest opening an issue on the repo: dbt-labs-experimental-features/insert_by_period at main · dbt-labs/dbt-labs-experimental-features · GitHub

Note that it’s not an officially-supported macro so we probably won’t be able to dig into it very far, but potentially another community member will be able to contribute to a workaround.

In the meantime, I would ensure that you always have a record for the final period - perhaps you can widen the size of your windows?

Thank you @joellabes , do you know any simillar materialization that works well for incremental load in Snowflake?

I think another community contributor has expressed interest in making it usable in Snowflake but I don’t think it’s come to fruition yet.