Closed zubair-jaleel closed 6 months ago
You should be able to prefix each script with a USE WAREHOUSE command. Have you tried that?
You should be able to prefix each script with a USE WAREHOUSE command. Have you tried that?
Yes its working, thanks :)
Is your feature request related to a problem? Please describe. I am trying to run a bunch of sql scripts (all part of a single PR) in a single schemachange run. I have specified a warehouse in the schemachange command that will be used for all the scripts. However some scripts need a bigger warehouse, it would be better if we can specify separate warehouse for each script.
Describe the solution you'd like Specify warehouse name at the top of each sql script like below. Schemachange will check for warehouse specification in each sql script if there's none then it will use warehouse specified in the schemachange command. If there's no warehouse specified in the schemachange command as well then it will use default warehouse specified in the config file.
_V1.1__CREATETABLE1.sql:
-- SNOWFLAKE_WAREHOUSE=BI_REPORTING_WH
create table my_db1.my_schema1.table1 (id number);
_V1.2__INSERTTABLE1.sql:
-- SNOWFLAKE_WAREHOUSE=DS_WH
INSERT INTO my_db1.my_schema1.table1 (id) VALUES (1);
_V1.3__UPDATETABLE1.sql:
update my_db1.my_schema1.table1 set id = 10 where id = 1;
Note: In the above example, all three sql scripts are running in a single schemachange command. The first two scripts should run in the warehouse specified within the script file and the third one on the warehouse specified in the schemachange command.
Describe alternatives you've considered grouping sql scripts based on warehouse and running each group separately. In this approach I have to break a PR into few smaller ones.
Additional context