MulticornPostgreSQL外部数据源访问接口

联合创作 · 2023-09-30 20:24

Multicorn 是一个 PostgreSQL 9.1+ 的扩展模块,用于简化外部数据封装开发,允许开发者使用 Python 编程语言开发。

特性:

  • Multicorn 允许你访问 PostgreSQL 数据库的任何数据源
  • 你可以使用强大的SQL来查询数据
  • 任何SQL工具都可以在这些数据源上重用

支持的数据源包括:

  • oracle_fdw – connects to Oracle databases.
  • mysql_fdw – connects to MySQL databases.
  • tds_fdw – connects to Sybase and Microsoft SQL Server databases.
  • odbc_fdw – connects to any ODBC source.
  • couchdb_fdw – connects to CouchDB databases.
  • redis_fdw – connects to Redis databases.
  • twitter_fdw – fetches messages from Twitter.
  • ldap_fdw – queries LDAP servers.
  • file_fdw – access data files in the server’s file system and query them as tables.
  • file_fixed_length_record_fdw – reads flat files with columns of fixed width.
  • PGStrom – uses GPU devices to accelerate sequential scan on massive amount of records with complex qualifiers.
  • s3_fdw – reads files located in Amazon S3.
  • www_fdw – accesses web services as a data source.

示例代码:

create foreign table gmail (
    "Message-ID" character varying,
    "From" character varying,
    "Subject" character varying,
    "payload" character varying,
    "flags" character varying[],
    "To" character varying) server multicorn_imap options (
        host 'imap.gmail.com',
        port '465',
        payload_column 'payload',
        flags_column 'flags',
        ssl 'True',
        login 'mylogin',
        password 'mypassword'
);

select flags, "Subject", payload  from gmail where "From" like 'pgsql-%'
and "Subject" like '%Daily digest%' limit 2;
浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报