Building and Running with SQL

You can create, test, and run your Workflows using SQL queries. This can help you skip the step of setting up API calls, removing the last element of engineering work from setting up Sliderule.

Creating a Workflow Using SQL

Start by clicking Create Workflow from the Workflows page. Click on the Input block of your new Workflow. Instead of clicking Add Field to configure your new workflow, choose Add from SQL at the top right.

Next, you'll see a screen appear to set up your Input fields. Select a database credential from the dropdown. If you don't see the database you want listed, you'll need to add a database credential

Once you've selected a credential, you'll see the available tables and columns appear on the right hand helper panel. Write your query and select Fetch Sample Row.

Each column returned will be used as an Input field in your workflow

When you're ready, click Save. You'll then see the fields appear along with their types and sample values in the Input block. You're all set to start building your workflow!

Running a Workflow Using SQL

You can run your Workflows using a SQL query through the Batch Runner. Each column returned by your query will be used as an input field. Each row will be used as the inputs for an execution of your Workflow.

You can run any Workflow using a SQL query, but since the column names returned by your query must match your workflow's Input Field names exactly, we recommend using the "Add Fields From SQL" method above when creating a Workflow you plan to run using SQL

From the Batch Runner menu, click Create to add a new job. Then select the "SQL Query" option. Select the Workflow and Version you'd like to run, then click Next.

Choose a credential to get started with the query builder. You can click Run to test your query. When you see all the inputs you'd like to use appearing in the results table, click Next.

Here you can pick whether you want to run the job once, schedule it for the future, or even set up a recurring scheduled job. Visit the Batch Runner page for more details