Skip to main content

datasette-ics

PyPI Changelog Tests License

Datasette plugin that adds support for generating iCalendar .ics files with the results of a SQL query.

Installation

Install this plugin in the same environment as Datasette to enable the .ics output extension.

$ pip install datasette-ics

Usage

To create an iCalendar file you need to define a custom SQL query that returns a required set of columns:

  • event_name - the short name for the event
  • event_dtstart - when the event starts

The following columns are optional:

  • event_dtend - when the event ends
  • event_duration - the duration of the event (use instead of dtend)
  • event_description - a longer description of the event
  • event_uid - a globally unique identifier for this event
  • event_tzid - the timezone for the event, e.g. America/Chicago

A query that returns these columns can then be returned as an ics feed by adding the .ics extension.

Demo

This SQL query calculates the lowest tide per day at Pillar Point in Half Moon Bay, California.

Since the query returns event_name, event_dtstart and event_tzid columns it produces this ICS feed. If you subscribe to that in a calendar application such as Apple Calendar you get something that looks like this:

Apple Calendar showing low tides at Pillar Point during a week

Using a canned query

Datasette's canned query mechanism can be used to configure calendars. If a canned query definition has a title that will be used as the title of the calendar.

Here's an example, defined using a metadata.yaml file:

databases:
  mydatabase:
    queries:
      calendar:
        title: My Calendar
        sql: |-
          select
            title as event_name,
            start as event_dtstart,
            description as event_description
          from
            events
          order by
            start
          limit
            100

This will result in a calendar feed at http://localhost:8001/mydatabase/calendar.ics

Release files for datasette-ics 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-ics 0.5.2
File Size Uploaded
datasette-ics-0.5.2.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datasette-ics 0.5.2
File Interpreter ABI Platform
datasette_ics-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / datasette-ics-0.5.2.tar.gz

Download URL datasette-ics-0.5.2.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
61ba2c939338526d2ef46add8cb3279748f478d9254981f36f8c7bd50b46f4e0
BLAKE2b-256 checksum
How to use checksums
bfb12f08723d89563604348a12b0f5bc334115cc6d02ac08be541f81e62324df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / datasette_ics-0.5.2-py3-none-any.whl

Download URL datasette_ics-0.5.2-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ca8f5927adf2255aaa1e750e3b17fe3cf6fc089841c578db42c37f9ae32471f
BLAKE2b-256 checksum
How to use checksums
f71634340fa1c33142bbdf6efa106a22cfed863cc93acf480c1377239f9bee2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5

1 release file

0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page