我写了一个任务,每个周末调用该程序。
这是我将值插入表中的过程
CREATE OR REPLACE TABLE TABLE1(DATABASE_ VARCHAR, TABLE_ VARCHAR); // Table to store values
CREATE OR REPLACE PROCEDURE TASK_() //Procedure to insert values into table
RETURNS string
LANGUAGE JAVASCRIPT
AS
$$
var str = '';
var stmt = snowflake.createStatement({sqlText: "INSERT INTO TABLE1 VALUES ('DB1','TB1')"});
stmt.execute();
return str;
$$;
Run Code Online (Sandbox Code Playgroud)
这是我每个周末调用上述程序的任务。
CREATE TASK mytask_hour
WAREHOUSE = COMPUTE_WH
SCHEDULE = 'USING CRON 0 0 * 1-12 SUN America/Los_Angeles'
TIMESTAMP_INPUT_FORMAT = 'YYYY-MM-DD HH24'
as
call TASK_();
Run Code Online (Sandbox Code Playgroud)
但是当我检查时,上面的任务没有运行,值也没有插入到表中。
因此,我尝试调试我的任务并编写了一个每分钟调用上述过程的任务。
create task mytask_hour
warehouse = …Run Code Online (Sandbox Code Playgroud) javascript sql stored-procedures snowflake-cloud-data-platform
I have created a macro to returns a table name from the INFORMATION_SCHEMA in Snowflake.
I have tables in snowflake as follows
------------
| TABLES |
------------
| ~one |
| ~two |
| ~three |
------------
Run Code Online (Sandbox Code Playgroud)
I want to pass the table type i.e. one into the macro and get the actual table name i.e. ~one
Here is my macro(get_table.sql) in DBT that takes in parameter and returns the table name
{%- macro get_table(table_type) -%}
{%- set …Run Code Online (Sandbox Code Playgroud)