Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani authored Nov 15, 2024
1 parent 77efb97 commit 57906e4
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ The DuckDB Cron extension adds support for scheduled query execution within Duck
> Experimental: USE AT YOUR OWN RISK!

### Cron
### Cron Runner
```sql
-- Run a query every minute
SELECT cron('SELECT COUNT(*) FROM mytable', '* * * * *') AS job_id;
-- Run a query every ten seconds
SELECT cron('SELECT version()', '*/10 * * * * *') AS job_id;

-- Run a query every hour at minute 0
SELECT cron('SELECT now()', '0 * * * *') AS job_id;

-- Run a query every day at 2:30 AM
SELECT cron('CALL maintenance()', '30 2 * * *') AS job_id;
SELECT cron('SELECT now()', '0 * * * * *') AS job_id;
```

The function returns a job ID that can be used to manage the scheduled task.

```sql
┌──────────┐
│ job_id │
varchar
├──────────┤
│ task_0 │
└──────────┘
```

### Listing Jobs
Use the cron_jobs() table function to view all scheduled jobs and their status:
```sql
Expand Down

0 comments on commit 57906e4

Please sign in to comment.