iCalendar
Turn .ics calendar feeds into queryable events, to-dos and feed health checks
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available Β· $10/month organization minimum
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.
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;
INSTALL vgi FROM community;
LOAD vgi;
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
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;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connectorβs deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
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;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'ical' AS ical
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
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;
Query Farm operates iCalendar for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
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;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use ical as the catalog alias for the query below.
4. Run a query
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;
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
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)

Query iCalendar feeds directly in DuckDB SQL β turn .ics calendar files into queryable rows of events, to-dos, and calendar metadata, powered by the battle-tested iCal4j RFC 5545 parser.
This VGI extension brings full iCalendar parsing to your SQL workflow. If you work with calendar exports from Google Calendar, Microsoft Outlook, Apple Calendar, or any RFC 5545-compliant feed, you can load and analyze that data without a separate ETL step. It is built for data engineers, analysts, and developers who want to ingest calendar feeds, run scheduling analytics, deduplicate events, audit recurrence rules, or validate .ics files entirely in SQL.
Under the hood the worker wraps iCal4j, the mature open-source Java library implementing the iCalendar specification (RFC 5545). Parsing runs with relaxed, Outlook-compatible compatibility hints so messy real-world feeds load cleanly, and every timestamp is normalised to UTC and surfaced as TIMESTAMP WITH TIME ZONE. Results stream back to DuckDB over Apache Arrow, so large feeds are processed efficiently and bad or unparsable input never crashes a query β it simply yields no rows, NULL, or false.
What you can do
The worker exposes both table functions, which expand a feed into one row per calendar entry (surfacing fields such as uid, summary, description, start/end or due timestamps, all-day flag, location, status, organizer, attendees, recurrence rule, priority, and percent-complete), and scalar functions for quick, row-level answers such as reading a calendar's display name, tallying entries, or validating a feed.
Every function takes the same polymorphic argument: a VARCHAR file path (the worker opens and reads the file) or a BLOB of raw .ics bytes (parsed in place), making it easy to query files on disk or calendar data already stored in a column. Recurrence rules are surfaced as their raw RRULE strings rather than expanded into individual occurrences.
Learn more
Catalog
Everything ical exposes once attached β read straight from the worker's
released build.
main 1 view Β· 5 functions
iCalendar (.ics) parsing functions: extract events and todos as rows, and read calendar-level metadata (iCal4j).
Schema 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;
example_calendars
Curated, browsable registry of ready-to-use sample iCalendar (.ics) feeds.
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;
ical_calendar_name (path VARCHAR) +1 overload
The calendar's display name from an .ics file (X-WR-CALNAME, falling back to PRODID).
ical_calendar_name(path VARCHAR) β VARCHARical_calendar_name(content BLOB) β VARCHAR
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;
ical_event_count (path VARCHAR) +1 overload
Count the VEVENTs in an .ics file (0 when the feed is empty or unparsable).
ical_event_count(path VARCHAR) β INTEGERical_event_count(content BLOB) β INTEGER
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;
is_valid_ical (path VARCHAR) +1 overload
True when the file at the given path can be parsed as a well-formed iCalendar (.ics) feed (iCal4j, relaxed).
is_valid_ical(path VARCHAR) β BOOLEANis_valid_ical(content BLOB) β BOOLEAN
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;
ical_events (path VARCHAR) +1 overload
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).
ical_events(path VARCHAR)ical_events(content BLOB)
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;
ical_todos (path VARCHAR) +1 overload
Parse an iCalendar (.ics) feed into one row per VTODO: uid, summary, UTC-normalised due date, status, priority, and percent complete (iCal4j).
ical_todos(path VARCHAR)ical_todos(content BLOB)
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;
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.
Related workers
Ical typescript
File formats & encodings
Parse events, to-dos and calendar metadata with TypeScript
ASN.1
File formats & encodings
Decode ASN.1 BER/DER blobs and SNMP, Kerberos, LDAP, CMS, PKCS and OCSP messages into SQL rows
BSON
File formats & encodings
Query BSON documents and move them between files and tables