Alter and delete a job
Alter an existing job with [alter_job][api-alter_job]. You can change both the config and the schedule on which the job runs.
- Change a job's config
To replace the entire JSON config for a job, call alter_job with a new config object. For example, replace the JSON config for a job with ID 1000:
- Turn off job scheduling
To turn off automatic scheduling of a job, call alter_job and set scheduledto false. You can still run the job manually with run_job. For example, turn off the scheduling for a job with ID 1000:
- Re-enable automatic scheduling of a job
To re-enable automatic scheduling of a job, call alter_job and set scheduled to true. For example, re-enable scheduling for a job with ID 1000:
- Delete a job with [
delete_job][api-delete_job]
For example, to delete a job with ID 1000:
===== PAGE: https://docs.tigerdata.com/use-timescale/hyperfunctions/function-pipelines/ =====
Examples:
Example 1 (sql):
CREATE FUNCTION <function_name> (job_id INT DEFAULT NULL, config JSONB DEFAULT NULL)
RETURNS VOID
DECLARE
<declaration>;
BEGIN
<function_body>;
END;
$<variable_name>$ LANGUAGE <language>;Example 2 (sql):
CREATE FUNCTION reindex_mytable(job_id INT DEFAULT NULL, config JSONB DEFAULT NULL)
RETURNS VOID
AS $$
BEGIN
REINDEX TABLE mytable;
END;
$$ LANGUAGE plpgsql;Example 3 (sql):
select reindex_mytable();Example 4 (sql):
reindex_mytable
-----------------
(1 row)