Skip to content

iCalendar

Turn .ics calendar feeds into queryable events, to-dos and feed health checks

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/ical/index.md to help me query iCalendar with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Read calendar events as SQL rows

Replace team.ics with an exported calendar file on the machine running DuckDB.

SET VARIABLE calendar = (SELECT content FROM read_text('team.ics'));
SELECT summary, dtstart, location
FROM ical.main.ical_events(getvariable('calendar')::BLOB)
ORDER BY dtstart;

Quick start

Choose where to run iCalendar, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

ATTACH 'ical' AS ical (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-ical:0.5.0'
);

3. Run a query

query.sql
SET VARIABLE calendar = (SELECT content FROM read_text('team.ics'));
SELECT summary, dtstart, location
FROM ical.main.ical_events(getvariable('calendar')::BLOB)
ORDER BY dtstart;
More example queries β†’
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

ATTACH 'ical' AS ical (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-ical:0.5.0'
);

Overview

iCalendar (.ics) events, todos, and metadata parsing (iCal4j)

Catalog

Everything ical exposes once attached β€” read straight from the worker's released build.

ical 1 schema
main 1 view Β· 5 functions

iCalendar (.ics) parsing functions: extract events and todos as rows, and read calendar-level metadata (iCal4j).

Schema examples (8)
Examples (8)

List the events in an iCalendar feed.

SELECT summary, location
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB)
ORDER BY dtstart;

List the to-dos in an iCalendar feed.

SELECT summary, status
FROM ical.main.ical_todos(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB)
ORDER BY due;

Read the calendar display name.

SELECT ical.main.ical_calendar_name(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS calendar_name;

Count the events in a feed.

SELECT ical.main.ical_event_count(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS event_count;
4 more examples

Validate an iCalendar feed.

SELECT ical.main.is_valid_ical(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS is_valid;

Health-check a column of stored feeds: the scalars accept columns (table functions do not). Both example_calendars samples come back valid (Ops Calendar 2 events, Team Calendar 1); a truncated export comes back false, NULL, 0. Cast text to `BLOB`: a `VARCHAR` is read as a file path.

SELECT name, ical.main.is_valid_ical(feed::BLOB) AS is_valid,
  ical.main.ical_calendar_name(feed::BLOB) AS parsed_name,
  ical.main.ical_event_count(feed::BLOB) AS parsed_events
FROM (SELECT name, feed FROM ical.main.example_calendars UNION ALL SELECT 'truncated_export', 'BEGIN:VCALENDAR') AS f
ORDER BY name;

Find double-booked events: self-join ical_events on overlapping [dtstart, dtend) ranges. Returns Design review with Customer call, overlapping 09:30-10:00 UTC; Team sync starts as Customer call ends, so it is not a conflict.

SELECT a.summary AS first_event, b.summary AS second_event,
  greatest(a.dtstart, b.dtstart) AS overlap_start,
  least(a.dtend, b.dtend) AS overlap_end
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Design Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Design review','DTSTART:20240402T090000Z','DTEND:20240402T100000Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Customer call','DTSTART:20240402T093000Z','DTEND:20240402T101500Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Team sync','DTSTART:20240402T101500Z','DTEND:20240402T110000Z','END:VEVENT','END:VCALENDAR'], chr(10))::BLOB) AS a
JOIN ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Design Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Design review','DTSTART:20240402T090000Z','DTEND:20240402T100000Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Customer call','DTSTART:20240402T093000Z','DTEND:20240402T101500Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Team sync','DTSTART:20240402T101500Z','DTEND:20240402T110000Z','END:VEVENT','END:VCALENDAR'], chr(10))::BLOB) AS b ON a.uid < b.uid AND a.dtstart < b.dtend AND b.dtstart < a.dtend
ORDER BY overlap_start, first_event;

List, for each event, the to-dos that fall due within 7 days of its start, by joining ical_events to ical_todos on a time window. iCalendar does not link to-dos to events, so the pairing is by time only: the Ops Calendar's one to-do, Update changelog (due 2024-03-12 17:00 UTC), pairs with both Deploy release and Retro.

SELECT e.summary AS event, e.dtstart, t.summary AS todo, t.due
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Ops Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Deploy release','DTSTART:20240310T150000Z','DTEND:20240310T160000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Retro','DTSTART:20240311T170000Z','DTEND:20240311T173000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Update changelog','DUE:20240312T170000Z','STATUS:NEEDS-ACTION','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS e
JOIN ical.main.ical_todos(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Ops Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Deploy release','DTSTART:20240310T150000Z','DTEND:20240310T160000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Retro','DTSTART:20240311T170000Z','DTEND:20240311T173000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Update changelog','DUE:20240312T170000Z','STATUS:NEEDS-ACTION','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS t ON t.due BETWEEN e.dtstart AND e.dtstart + INTERVAL 7 DAY
ORDER BY e.dtstart, t.due;
Views
example_calendars 2 examples6 cols

Curated, browsable registry of ready-to-use sample iCalendar (.ics) feeds.

Columns
name VARCHAR
Short slug identifier for the sample feed (e.g. `team_calendar`).
calendar_name VARCHAR
The feed's display name from its X-WR-CALNAME property (e.g. `Team Calendar`).
event_count INTEGER
Number of VEVENT entries in the sample feed (a small integer count).
todo_count INTEGER
Number of VTODO entries in the sample feed (a small integer count).
description VARCHAR
One-line human summary of what the sample feed contains.
feed VARCHAR
Raw iCalendar (`.ics`) text for the sample feed, lines separated by LF; cast it to `BLOB` before passing it to the scalar helpers.
Examples (2)

List the built-in sample iCalendar feeds, richest first, with their display name and event/to-do counts.

SELECT name, calendar_name, event_count, todo_count
FROM ical.main.example_calendars
ORDER BY event_count DESC, name;

Health-check a column of stored feeds: the scalars accept columns (table functions do not). Both example_calendars samples come back valid (Ops Calendar 2 events, Team Calendar 1); a truncated export comes back false, NULL, 0. Cast text to `BLOB`: a `VARCHAR` is read as a file path.

SELECT name, ical.main.is_valid_ical(feed::BLOB) AS is_valid,
  ical.main.ical_calendar_name(feed::BLOB) AS parsed_name,
  ical.main.ical_event_count(feed::BLOB) AS parsed_events
FROM (SELECT name, feed FROM ical.main.example_calendars UNION ALL SELECT 'truncated_export', 'BEGIN:VCALENDAR') AS f
ORDER BY name;
Link
Scalar functions
ical_calendar_name (path VARCHAR) +1 overload 1 example

The calendar's display name from an .ics file (X-WR-CALNAME, falling back to PRODID).

Arguments
path VARCHAR
Filesystem path to an iCalendar (.ics) file, opened by the worker. NULL input returns no rows for table functions and NULL for scalars.
Overloads
ical_calendar_name(path VARCHAR) β†’ VARCHARical_calendar_name(content BLOB) β†’ VARCHAR
ReturnsVARCHAR
Example

Read the display name of an iCalendar feed (X-WR-CALNAME, falling back to PRODID).

SELECT ical.main.ical_calendar_name(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS calendar_name;
Link
ical_event_count (path VARCHAR) +1 overload 1 example

Count the VEVENTs in an .ics file (0 when the feed is empty or unparsable).

Arguments
path VARCHAR
Filesystem path to an iCalendar (.ics) file, opened by the worker. NULL input returns no rows for table functions and NULL for scalars.
Overloads
ical_event_count(path VARCHAR) β†’ INTEGERical_event_count(content BLOB) β†’ INTEGER
ReturnsINTEGER
Example

Count the VEVENTs in an iCalendar feed.

SELECT ical.main.ical_event_count(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS event_count;
Link
is_valid_ical (path VARCHAR) +1 overload 2 examples

True when the file at the given path can be parsed as a well-formed iCalendar (.ics) feed (iCal4j, relaxed).

Arguments
path VARCHAR
Filesystem path to an iCalendar (.ics) file, opened by the worker. NULL input returns no rows for table functions and NULL for scalars.
Overloads
is_valid_ical(path VARCHAR) β†’ BOOLEANis_valid_ical(content BLOB) β†’ BOOLEAN
ReturnsBOOLEAN
Examples (2)

Test whether the input parses as a well-formed iCalendar (.ics) feed.

SELECT ical.main.is_valid_ical(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS is_valid;

Health-check a column of stored feeds: the scalars accept columns (table functions do not). Both example_calendars samples come back valid (Ops Calendar 2 events, Team Calendar 1); a truncated export comes back false, NULL, 0. Cast text to `BLOB`: a `VARCHAR` is read as a file path.

SELECT name, ical.main.is_valid_ical(feed::BLOB) AS is_valid,
  ical.main.ical_calendar_name(feed::BLOB) AS parsed_name,
  ical.main.ical_event_count(feed::BLOB) AS parsed_events
FROM (SELECT name, feed FROM ical.main.example_calendars UNION ALL SELECT 'truncated_export', 'BEGIN:VCALENDAR') AS f
ORDER BY name;
Link
Table functions
ical_events (path VARCHAR) +1 overload 3 examples

Parse an iCalendar (.ics) feed into one row per VEVENT: uid, summary, UTC-normalised start/end, all-day flag, location, status, organizer, attendees array, recurrence rule, sequence, category tags, url, and created/last-modified timestamps (iCal4j).

Arguments
path VARCHAR
Filesystem path to an iCalendar (.ics) file, opened by the worker. NULL input returns no rows for table functions and NULL for scalars.
Overloads
ical_events(path VARCHAR)ical_events(content BLOB)
Returns columns
uid VARCHAR
VEVENT unique identifier (UID).
summary VARCHAR
Event title (SUMMARY).
description VARCHAR
Long-form description (DESCRIPTION).
dtstart TIMESTAMP WITH TIME ZONE
Start, UTC-normalised (DTSTART).
dtend TIMESTAMP WITH TIME ZONE
End, UTC-normalised (DTEND), or NULL.
all_day BOOLEAN
True when DTSTART is DATE-valued (an all-day event).
location VARCHAR
Free-text location (LOCATION).
status VARCHAR
Event status: CONFIRMED / TENTATIVE / CANCELLED (STATUS).
organizer VARCHAR
ORGANIZER value (usually a mailto: URI).
attendees VARCHAR[]
ATTENDEE values, one array element per attendee.
rrule VARCHAR
Recurrence rule as the raw RRULE string, or NULL.
sequence INTEGER
Revision sequence number (SEQUENCE).
categories VARCHAR[]
Category tags (CATEGORIES), one array element per tag.
url VARCHAR
Associated URL (URL property), or NULL.
created TIMESTAMP WITH TIME ZONE
Creation time, UTC-normalised (CREATED), or NULL.
last_modified TIMESTAMP WITH TIME ZONE
Last-modified time, UTC-normalised (LAST-MODIFIED), or NULL.
Examples (3)

List every event in an iCalendar feed by start time.

SELECT summary, location, all_day
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB)
ORDER BY dtstart;

Find double-booked events: self-join ical_events on overlapping [dtstart, dtend) ranges. Returns Design review with Customer call, overlapping 09:30-10:00 UTC; Team sync starts as Customer call ends, so it is not a conflict.

SELECT a.summary AS first_event, b.summary AS second_event,
  greatest(a.dtstart, b.dtstart) AS overlap_start,
  least(a.dtend, b.dtend) AS overlap_end
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Design Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Design review','DTSTART:20240402T090000Z','DTEND:20240402T100000Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Customer call','DTSTART:20240402T093000Z','DTEND:20240402T101500Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Team sync','DTSTART:20240402T101500Z','DTEND:20240402T110000Z','END:VEVENT','END:VCALENDAR'], chr(10))::BLOB) AS a
JOIN ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Design Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Design review','DTSTART:20240402T090000Z','DTEND:20240402T100000Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Customer call','DTSTART:20240402T093000Z','DTEND:20240402T101500Z','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Team sync','DTSTART:20240402T101500Z','DTEND:20240402T110000Z','END:VEVENT','END:VCALENDAR'], chr(10))::BLOB) AS b ON a.uid < b.uid AND a.dtstart < b.dtend AND b.dtstart < a.dtend
ORDER BY overlap_start, first_event;

List, for each event, the to-dos that fall due within 7 days of its start, by joining ical_events to ical_todos on a time window. iCalendar does not link to-dos to events, so the pairing is by time only: the Ops Calendar's one to-do, Update changelog (due 2024-03-12 17:00 UTC), pairs with both Deploy release and Retro.

SELECT e.summary AS event, e.dtstart, t.summary AS todo, t.due
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Ops Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Deploy release','DTSTART:20240310T150000Z','DTEND:20240310T160000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Retro','DTSTART:20240311T170000Z','DTEND:20240311T173000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Update changelog','DUE:20240312T170000Z','STATUS:NEEDS-ACTION','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS e
JOIN ical.main.ical_todos(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Ops Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Deploy release','DTSTART:20240310T150000Z','DTEND:20240310T160000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Retro','DTSTART:20240311T170000Z','DTEND:20240311T173000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Update changelog','DUE:20240312T170000Z','STATUS:NEEDS-ACTION','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS t ON t.due BETWEEN e.dtstart AND e.dtstart + INTERVAL 7 DAY
ORDER BY e.dtstart, t.due;
Link
ical_todos (path VARCHAR) +1 overload 2 examples

Parse an iCalendar (.ics) feed into one row per VTODO: uid, summary, UTC-normalised due date, status, priority, and percent complete (iCal4j).

Arguments
path VARCHAR
Filesystem path to an iCalendar (.ics) file, opened by the worker. NULL input returns no rows for table functions and NULL for scalars.
Overloads
ical_todos(path VARCHAR)ical_todos(content BLOB)
Returns columns
uid VARCHAR
VTODO unique identifier (UID).
summary VARCHAR
To-do title (SUMMARY).
due TIMESTAMP WITH TIME ZONE
Due date/time, UTC-normalised (DUE), or NULL.
status VARCHAR
To-do status: NEEDS-ACTION / IN-PROCESS / COMPLETED / CANCELLED (STATUS).
priority INTEGER
Priority 0-9, where lower is higher priority (PRIORITY).
percent_complete INTEGER
Completion percentage 0-100 (PERCENT-COMPLETE).
Examples (2)

List the outstanding to-dos from an iCalendar feed by due date.

SELECT summary, status, percent_complete
FROM ical.main.ical_todos(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB)
WHERE status <> 'COMPLETED'
ORDER BY due;

List, for each event, the to-dos that fall due within 7 days of its start, by joining ical_events to ical_todos on a time window. iCalendar does not link to-dos to events, so the pairing is by time only: the Ops Calendar's one to-do, Update changelog (due 2024-03-12 17:00 UTC), pairs with both Deploy release and Retro.

SELECT e.summary AS event, e.dtstart, t.summary AS todo, t.due
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Ops Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Deploy release','DTSTART:20240310T150000Z','DTEND:20240310T160000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Retro','DTSTART:20240311T170000Z','DTEND:20240311T173000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Update changelog','DUE:20240312T170000Z','STATUS:NEEDS-ACTION','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS e
JOIN ical.main.ical_todos(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Ops Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Deploy release','DTSTART:20240310T150000Z','DTEND:20240310T160000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Retro','DTSTART:20240311T170000Z','DTEND:20240311T173000Z','STATUS:CONFIRMED','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Update changelog','DUE:20240312T170000Z','STATUS:NEEDS-ACTION','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS t ON t.due BETWEEN e.dtstart AND e.dtstart + INTERVAL 7 DAY
ORDER BY e.dtstart, t.due;
Link

Try these queries

List the events in an iCalendar feed.

SELECT summary, location
FROM ical.main.ical_events(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB)
ORDER BY dtstart;

Uses ical_events

List the to-dos in an iCalendar feed.

SELECT summary, status
FROM ical.main.ical_todos(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB)
ORDER BY due;

Uses ical_todos

Read the calendar display name.

SELECT ical.main.ical_calendar_name(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS calendar_name;

Uses ical_calendar_name

Count the events in a feed.

SELECT ical.main.ical_event_count(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS event_count;

Uses ical_event_count

Validate an iCalendar feed.

SELECT ical.main.is_valid_ical(array_to_string(['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Query Farm//vgi-ical//EN','X-WR-CALNAME:Team Calendar','BEGIN:VEVENT','UID:[email protected]','SUMMARY:Sprint Planning','DESCRIPTION:Plan the next two-week sprint.','DTSTART:20240115T093000Z','DTEND:20240115T103000Z','LOCATION:Conference Room A','STATUS:CONFIRMED','ORGANIZER:mailto:[email protected]','ATTENDEE:mailto:[email protected]','ATTENDEE:mailto:[email protected]','RRULE:FREQ=WEEKLY;BYDAY=MO','SEQUENCE:3','END:VEVENT','BEGIN:VTODO','UID:[email protected]','SUMMARY:Write release notes','DUE:20240120T170000Z','STATUS:NEEDS-ACTION','PRIORITY:2','PERCENT-COMPLETE:40','END:VTODO','END:VCALENDAR'], chr(10))::BLOB) AS is_valid;

Uses is_valid_ical

List the built-in sample iCalendar feeds, richest first, with their display name and event/to-do counts.

SELECT name, calendar_name, event_count, todo_count
FROM ical.main.example_calendars
ORDER BY event_count DESC, name;

Uses example_calendars

5 more examples in the Catalog, each listed under the table or function it uses.

iCalendar is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.