简体   繁体   English

如何在雪花中自动化 sql 脚本

[英]How to automate a sql script in snowflake

I have a SQL script that transforms data for various tables in snowflake.我有一个 SQL 脚本,可以转换雪花中各种表的数据。 I need to run this SQL code daily and I want to automate it somehow.我需要每天运行这个 SQL 代码,我想以某种方式自动化它。 I thought I could automate the SQL with 'tasks' in snowflake but 'tasks' are unable to run more than one single SQL statement and my code contains a multitude of SQL statements.我以为我可以用雪花中的“任务”自动化 SQL,但“任务”无法运行多个 SQL 语句,我的代码包含大量 Z9778840A06700CB30C52828 语句。 Does anyone have any ideas?有没有人有任何想法? Any help is appreciated任何帮助表示赞赏

If you want to automate more than one sql statement, you have two options:如果您想自动化多个 sql 语句,您有两种选择:

  1. Run a task for each of your statements and build up dependencies between them为每个语句运行一个任务并在它们之间建立依赖关系
  2. Wrap your whole script into a stored procedure and trigger this procedure with your task.将整个脚本包装到一个存储过程中,并使用您的任务触发此过程。 The statement for triggering the procedure is something like CALL myProcedure(optional parameters);触发过程的语句类似于CALL myProcedure(optional parameters);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM