SQL

Use the SQL connector to write, save, and automate SQL queries to any database Mitto has connectivity to.

The queries need to be written in the syntax of the database they are being sent to.

Standard use cases include creating tables, views, and stored procedures.

Mitto does not validate SQL queries when creating a job. Best practice is to write your SQL queries in another tool (ie Datagrip) to test the SQL, and then when you are ready to save and automate the SQL, drop it into a Mitto job.

Instructions for creating a SQL job in Mitto:

Click Add Job:


Choose the SQL connector:

Simply type the SQL into the "Enter Statement" window.


Click Next.


Then specify the Title of the job and the Type of database you are sending the query to.

Standard practice for a SQL job Title:

[SQL] <schema>.<table> 


Type explanation:

  • Local Database - the internal Mitto PostgreSQL database
  • Custom - specify the connection string of the destination database.



Example SQL job:

SQL:

DROP TABLE IF EXISTS public.test;
CREATE TABLE IF NOT EXISTS public.test AS
SELECT 
  1 AS id,
  'test' AS name
;

Title: [SQL] public.test

Type: Local Database



Note: Mitto only accepts multi-line comments.

DON'T do this:

DO this: