multicorn
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
multicorn | 3.2 | FDW | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 8510 | multicorn | No | Yes | No | Yes | No | No | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 3.2 | 1817161514 | multicorn | - |
| RPM | PGDG | 3.2 | 1817161514 | multicorn2_$v | - |
| DEB | PIGSTY | 3.2 | 1817161514 | postgresql-$v-multicorn | python3-multicorn |
Install
You can install multicorn directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Multicorn2 allows you to write Foreign Data Wrappers in Python. You implement a Python class that inherits from multicorn.ForeignDataWrapper, and Multicorn handles bridging it to PostgreSQL’s FDW interface. Version 3.2 is tested with PostgreSQL 14-18 and Python 3.9-3.13, though upstream recommends Python 3.10-3.12 for near-term distro compatibility.
Define a Python FDW Class
Create a Python module (e.g., myfdw.py) accessible to the PostgreSQL process:
Create Server and Foreign Table
The wrapper option specifies the fully qualified Python class name. Any additional options are passed to the class constructor’s options parameter.
Built-in FDW Examples
Multicorn ships with several example FDW implementations that can be used directly or as reference:
- CsvFdw – read CSV files
- ProcessFdw – execute system commands and parse output
- GCalFdw – access Google Calendar
- ImapFdw – query IMAP mailboxes
- RssFdw – read RSS/Atom feeds
Version Notes
Multicorn 3.2 adds basic OFFSET/LIMIT pushdown and LDAP paging support, and fixes LDAP right-parenthesis escaping. Upstream 3.1 added PostgreSQL 18 and Python 3.13 support while dropping PostgreSQL versions before 14.
Caveats
Multicorn2 and PL/Python are incompatible in the same PostgreSQL database on Python 3.12 due to CPython limitations. They can be installed on the same system, but avoid enabling both in one database.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)