commandsjob sql

Set the SQL command/s to execute in a sql job.

Usage

job sql (add|set) name text
job sql clear name

where
add a line of SQL.
set the jobs SQL, replacing any previously defined SQL.
clear a jobs SQL.
name of job whose SQL to add/set/clear.
text line of SQL to add/set. See variables for available variables that can be included.

write on name

url for setting the sql jobs’ url.

this command will set the job type to sql.

if the output path has a suffix of .csv, any output will be formatted as csv

Examples

Define a simple SQL call

BeyondCron % job sql set /examples/sql/select select * from bc_status limit 20
BeyondCron % job show $$

----------- ---------------------------------- Name /examples/sql/select Description Select from job status table ... URL jdbc:postgresql://localhost:5433/beyondcron SQL select * from bc_status limit 20 ...

Define a multi-line SQL update call which includes BeyondCron variables

BeyondCron % job sql set /examples/sql/update delete from bc_status
BeyondCron % job sql add $$ where bc_timestamp < {{ time -1M epoch }}
BeyondCron % job show $$

----------- -------------------------------------------- Name /examples/sql/update Description Remove old entries in job status table ... URL jdbc:postgresql://localhost:5433/beyondcron SQL delete from bc_status where bc_timestamp < {{ time -1M epoch }} ...

See also

Reference