cloudfs_fdw

A foreign data wrapper for accessing CSV, JSON, EXCEL and ODF files on cloud filesystems.

Installation

CREATE EXTENSION multicorn;

CREATE SERVER <server> FOREIGN DATA WRAPPER multicorn OPTIONS (wrapper 'cloudfs_fdw.cloudfs_fdw.cloudfs_fdw');

CREATE USER MAPPING FOR <user> SERVER <server>;

Create table

CREATE FOREIGN TABLE <schema>.<table> (...) SERVER <server> OPTIONS (<options>);

See this for general information how SQL/MED in PostgreSQL works, and this for CREATE FOREIGN TABLE syntax.

Available Options

S3 compatible

  • source ‘s3’
  • bucket <bucket>
  • filepath <filename>
  • host <host>, default: localhost
  • port <port>, default: 443
  • region <region>
  • aws_access_key <access_key>
  • aws_secret_key <secret_key>

HTTP / HTTPS

  • source ‘http/https’
  • url <URL>

Filesystem

  • source ‘file’
  • filepath <filepath>

JSON

  • format ‘json’
  • json_path <json_path>

CSV

  • format ‘csv’
  • header <true/false>
  • delimiter <delimiter>, default: ,
  • quote_char <quote_char>, default: “

EXCEL (.xls, .xlsx)

  • format ‘excel’
  • header <true/false>
  • sheet <sheet_name>, default: first sheet

ODF (.ods)

  • format ‘odf’
  • header <true/false>
  • sheet <sheet_name>, default: first sheet

Compression

‘.gz’ and ‘.zip’ compressed files are decompressed automagically.

GitHub

View Github