Skip to main content

Airtable Multicorn FDW for Postgres

Project description

Airtable Foreign Data Wrapper

Usage

Ensure multicorn is loaded and define Foreign Data Wrapper for airtable

create extension if not exists multicorn;
create server if not exists multicorn_airtable_srv foreign data wrapper multicorn options (
    wrapper 'airtable_fdw.AirtableFDW'
    );

Define table as

create foreign table schema.table_name (
    "_id" varchar options (rowid 'true'),                       -- column used as rowid, may be any name, 
                                                                -- should appear only onece
    "Some text column" varchar,
    "Some numeric column" numeric,
    "Some date column" date,
    "Some complex column" json,                                 -- can be used for complex fields but see example below 
    "Some json nullable column" json options (nulljson 'true'), -- keep nulls as json ('null'::json instead of null::json)
    "Some computed column" varchar options (computed 'true')    -- column that won't be modified with update
                                                                -- may appear multiple times
) server multicorn_airtable_srv options (
    api_key '...',      -- api access key
    base_key '...',     -- database identifier
    table_name '...',   -- name of table to read from
    view_name '...',    -- optional view name, if not present raw table will be read
    rowid_column '...'  -- optional rowid column name will be used if no column has `rowid` option set 
);

If complex column - like Collaborator - appears in table it is read from AirTable API as a json and could be treated as json or as a complex, custom defined type.

create type AirtableCollaborator as
(
    id     varchar,
    email  varchar,
    "name" varchar
);
create foreign table schema.table_name (
    "_id" varchar options (rowid 'true'),
    "editor" AirtableCollaborator options (complextype_fields 'id,email,name', complextype_send 'email')
) server multicorn_airtable_srv options (
    api_key '...',
    base_key '...',
    table_name '...'
);

where:

  • complextype_fields 'id,email,name' indicates how record string should be constructed from json - so {"id": "someid", "email": "me@example.com", "name":"My Name"} will be converted to (someid,me@example.com,My Name) and will be correctly casted to AirtableCollaborator type.
  • complextype_send 'email' means that when this field is modified only email field will be sent to API

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airtable_fdw-0.3.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airtable_fdw-0.3.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file airtable_fdw-0.3.0.tar.gz.

File metadata

  • Download URL: airtable_fdw-0.3.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for airtable_fdw-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8dc56a95c121a0f3a7dda791a355e1fb3f4fce6f4ce69b96471a5d76bb7f85f9
MD5 c10cbbbd210b9fc60bb36c417e9e6119
BLAKE2b-256 ef3c92625eb41e838354c041d3926c3afcd59ada9d5828d3181b2ab07f8aabc9

See more details on using hashes here.

File details

Details for the file airtable_fdw-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: airtable_fdw-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for airtable_fdw-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7b4cba120a42cbf3f9da545d067763ab3635839a119f22e4b084187bbcd58c1
MD5 24f3ecfd4199b46f68c38092a4978dd3
BLAKE2b-256 0d82ccbe1681aae18923ca24b3b35d42ace69c7020e959f37b30d3644189aa09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page