DEV Community

TJ-MD for WayScript

Posted on

Tutorial: Automate Daily SQL Queries in 4 minutes


Looking to automate SQL queries? You're in the right place. In this tutorial, we'll look at how we can set up an automated system using WayScript, which will query your SQL based database daily, hourly, weekly, or at whatever time interval you want. Let's get started!

WayScript is a rapid development platform built for busy developers. Currently in Beta, it's free and would love your feedback.


No prerequisites but some content you might find helpful:
Working with our SQL Module
Working with our Time Triggers

Automating an Action at Intervals

On WayScript, we're able to easily automate complex interactions on a schedule. Whether you need to run a script by the day, hour, or minute, you can easily do this in our editor. To start programming on WayScript, sign up on the home page, or login to your account. We can create scripts, by clicking on the "+ New Script" at the top of the webpage. These scripts are what will house our automations.

We're able to automate anything on a schedule using time triggers. We can pull a time trigger into our workflow and configure the settings:

Alt text of image

To activate our SQL script daily, we'll need to set it to that.

activate our SQL script

There's other options we could select here if we wanted to, including the option to input custom CRON syntax. We'll keep it simple and just select the daily option. Next, we can specify what time of day we want to execute our query.

specify what time of day

Querying our Database

Now that we have the time trigger in place, we need to build our script! Since we're wanting to do a query on a database, we should drag in a SQL module.

Drag SQL module

With WayScript, we're able to do anything we could do with our database locally, like reading and writing data. We can add a database to our account by selecting the drop down of "add a database" and providing our database information.

add a database

Supplying our database information:

Supplying our database information

Once we supply this information, we're able to fully access our database on WayScript. If you get stuck while trying to set up your database, feel free to reference this Youtube tutorial.

Next, we can write SQL directly into WayScript's editor by clicking on edit code:

Click Edit

Let's pull data from our database about products we're making:

FROM order_summary

which pulls some dummy data that we can import into our workflow:

Data to import

Doing more with our Data

With a simple two minute script, we can automate doing a query on our database. It's pretty easy from here to use this data on WayScript's platform too! Should you want to send emails, add data to google sheets, integrate with forms, build automated bots, WayScript makes it easy.


If there's any questions leave a comment and we'll help you out. Or, feel free to join our Discord channel as well.

Top comments (0)