---
title: "Calendars in Postgres using Foreign Data Wrappers"
description: "A Cal.com Foreign Data Wrapper, built on Supabase's Wasm-based Wrappers framework, lets Postgres read Cal.com event types and bookings and create bookings with a plain INSERT, so a signup and its calendar booking can happen in one transaction."
url: "https://swe.quest/articles/calendars-in-postgres-using-foreign-data-wrappers-4dbdcfd48394df6d"
canonical: "https://supabase.com/blog/calendars-in-postgres-using-foreign-data-wrappers"
source: "Supabase"
published: "2024-12-20"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["postgres","webassembly","sql"]
---

# Calendars in Postgres using Foreign Data Wrappers

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2024-12-20, 4 min read, How-to. Original: [https://supabase.com/blog/calendars-in-postgres-using-foreign-data-wrappers](https://supabase.com/blog/calendars-in-postgres-using-foreign-data-wrappers)

## Summary

A Cal.com Foreign Data Wrapper, built on Supabase's Wasm-based Wrappers framework, lets Postgres read Cal.com event types and bookings and create bookings with a plain INSERT, so a signup and its calendar booking can happen in one transaction. Setup has three steps: enable the wrappers extension, create a wasm\_wrapper foreign server pointing at the Cal.com FDW package with an API key, and define foreign tables whose single jsonb attrs column holds the API objects. Data is extracted with JSON operators and json\_array\_elements. Inserts require the rowid\_column option on the bookings table.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- JSONB querying in Postgres ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))

## Keywords

Supabase Wrappers, Cal.com, Foreign Data Wrappers, WebAssembly, Supabase

## Related posts

- [Supabase Wrappers, a Postgres FDW framework written in Rust](https://swe.quest/articles/supabase-wrappers-a-postgres-fdw-framework-written-in-rust-284bf0f40798dcde.md): Supabase · 2022-12-15 · Medium · 9 min read · PostgreSQL, Rust, Data pipelines, Analytics & OLAP
  Supabase Wrappers is an alpha Rust framework, built on pgx, for writing Postgres Foreign Data Wrappers that expose external systems such as Stripe and Firebase as queryable foreign tables.
- [Postgres Foreign Data Wrappers with Wasm](https://swe.quest/articles/postgres-foreign-data-wrappers-with-wasm-121e854eab291417.md): Supabase · 2024-08-16 · Medium · 5 min read · PostgreSQL, WebAssembly, Rust, Sandboxing & isolation
  Supabase Wrappers, a Rust framework for building Postgres Foreign Data Wrappers, now supports WebAssembly FDWs that are downloaded from URLs like GitHub or S3, checksum-verified, cached and run in a sandboxed Wasm runtime inside the Postgres extension.
- [Supabase Wrappers v0.2: Query Pushdown & Remote Subqueries](https://swe.quest/articles/supabase-wrappers-v0-2-query-pushdown-remote-subqueries-4a8d4853bc0c2d1c.md): Supabase · 2023-12-14 · Medium · 4 min read · PostgreSQL, Databases, Rust
  Supabase Wrappers v0.2, a Rust-based Postgres foreign data wrapper framework for querying third-party sources with SQL, adds query pushdown, remote subqueries and per-FDW usage statistics.
- [Cal.com launches Expert Marketplace built with Next.js and Supabase.](https://swe.quest/articles/cal-com-launches-expert-marketplace-built-with-next-js-and-supabase-2659e9baa272f3f6.md): Supabase · 2024-06-18 · Medium · 5 min read · PostgreSQL, Frontend, Serverless, Storage systems
  Cal.com's open-source Platform Starter Kit for building expert marketplaces runs on Next.js and Supabase, having switched from SQLite to Postgres via Prisma shortly before launch once file storage was needed.
- [Sync Stripe Data to Your Supabase Database in One Click](https://swe.quest/articles/sync-stripe-data-to-your-supabase-database-in-one-click-b7cbed62c6a06c5c.md): Supabase · 2025-12-19 · Medium · 5 min read · Payments & fintech, PostgreSQL, Data pipelines, SQL
  Supabase now offers a one-click Stripe Sync Engine integration that copies Stripe customers, subscriptions, invoices and payments into real Postgres tables, kept current via webhooks plus scheduled backfills run through pgmq-based Supabase Queues and Edge Functions with retries.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
