Couldn’t create backup tables through a dbt model, Is there a way I create backup tables directly, at the moment when I trigger model a view is getting created which is causing issue as we have create table inside Creaview.
I want to backup my tables before I drop few as part of recovery process
I tried to Create backup using a Model but when trigger dbt run --select Backup.sql
Snowflake adapter: Snowflake error: 001003 (42000): SQL compilation error:
syntax error line 6 at position 8 unexpected ‘CREATE’.
On model.stack_schema_name.BACKUP: create or replace view DATABASE_NAME.SCHEMA_NAME.BACKUP
copy grants as (
– Update the below parameters for any new model starts ----- select query generated using macro, replaced with the dbt sources to get the lineage
CREATE TABLE IF NOT EXISTS DATABASE_NAME.SCHEMA_NAME.TBL_BKP_30082023 AS SELECT * FROM DATABASE_NAME.SCHEMA_NAME.TBL; CREATE TABLE IF NOT EXISTS DATABASE_NAME.SCHEMA_NAME.TBL_BKP_30082023 AS SELECT * FROM DATABASE_NAME.SCHEMA_NAME.TBL
2023-08-30 05:58:41.106449 (Thread-4): 05:58:41 Opening a new connection, currently in state closed