I've a project in Snowflake which is just a set of .sql files executed sequentially. For some parameters, I did as follow:
1- I created a exported env variables called MY_DATABASE
2- I declared this variable in my snowflake.yml (this just has the env block actually)
Everything is working as expected in snow CLI and this is ok for my CICD environment eventually:
snow -q "select '<% ctx.env.MY_DATABASE $>'
But it doesn't in VSCode, where I see the only way to setup an env is skaffolding a native app project definition (which I have not)
So I created two files that works more or less this way:
init.cicd.sql
set my_database_sql_context = '<% ctx.env.MY_DATABASE %>';
set my_schema_sql_context = '<% ctx.env.SCHEMA %>';
USE DATABASE IDENTIFIER($my_database_sql_context);
USE SCHEMA IDENTIFIER($my_chema_sql_context);
-- Apparently one cannot concat, ie:
-- USE SCHEMA IDENTIFIER($my_database_sql_context).IDENTIFIER($my_schema_sql_context)
init.vscode.sql
set my_database_sql_context = 'THE_DEV_DATABASE';
set my_schema_sql_context = 'THE_DEV_SCHEMA';
But it definitively doesn't look as the best way to do it.
Is there a way for VS Code to be aware of environment setup within the project definition file, just like snow CLI tool does?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744787189a4593697.html
评论列表(0条)