Report

Simple Data Toolkit - Tutorial - Windows - Scheduled Task

July 12, 2022 at 10:10 AM PST
This post has no media.
Profile picture
Franklin Powers

Let's suppose you want to create a task that loads a Pipe Delimited File into a database on a daily basis. The task is to run on Windows and you are using Snowflake for the database. You can do it with SDTK as follows:

1) Download SDTK. For this tutorial, we're going to use the latest version of the Windows Shell Script version as of this writing (0.1.2) which is here: https://sourceforge.net/projects/simple-data-toolkit/files/0.1.3/stc-wsh.js/download

2) Create a new text file called ConvertPSV.cmd

3) Open the file with a text editor (like Notepad or Visual Studio Code)
Enter the following text:
cscript stc-wsh.js clients.psv clients.sql createorreplace clients
(For more info on STC and SDTK see the following URL: https://www.vis-software.com/#sdtk)
(For more info on cscript see the following URL: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cscript)

SET SNOWSQL_PWD=password
snowsql -a myorganization-myaccount -u jsmith -f clients.sql -d database -s public -o quiet=true -o friendly=false
(For more info on snowsql see the following URL: https://docs.snowflake.com/en/user-guide/snowsql-use.html)

4) Go to the Start Menu.

5) Search for Task Scheduler.
(For more info on Task Scheduler see the following URL: https://docs.microsoft.com/en-us/windows/win32/taskschd/about-the-task-scheduler)

6) Open Task Scheduler.

7) Click Create Task.

8) For name enter: Convert PSV to SQL

9) Click Triggers Tab

10) Click New button

11) Select Daily

12) Start start time to 8:00 AM.

13) Click the OK button.

14) Click Actions tab.

15) Click New button

16) For Program/script click Browse.

17) Find the ConvertPSV.cmd script.

18) Click Open.

19) Set Start in to the directory that the ConvertPSV.cmd script is in.

20) Click the OK button.

21) Click the OK button.

22) To test, right click Convert PSV to SQL.

23) Select Run.

Any thoughts on Franklin's post?

To comment or reply, you need an Ortingo account.

Sign in or sign up

Here's what Ortingoers think of Franklin's post.

There are no comments on this post.