Simple Data Toolkit - Tutorial - Linux - Scheduled Task

July 12, 2022 at 2:49 PM 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 Linux 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 Python version as of this writing (0.1.2) which is here: https://sourceforge.net/projects/simple-data-toolkit/files/0.1.3/stc.py/download

2) Create a new text file called ConvertPSV.sh

3) Open the file with a text editor (like Text Edit)
Enter the following text:
#!/bin/sh
python stc.py clients.psv clients.sql createorreplace clients
(For more info on STC and SDTK see the following URL: https://www.vis-software.com/#sdtk)

export 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 Terminal.

5) Edit the list of cron jobs with the following command:
nano crontab -e

6) Add the following to a new line:
0 8 * * * cd ~ && ConvertPSV.sh

7) Press CTRL+O and CTRL+X to save and exit nano.

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.