Foreign Data Wrappers是Postgresql取得外部数据比较方便的功能扩展。
可以取得关系数据库的数据,比如Oracle,MysqL,ODBC.
还可以取得NOsql数据库的数据。比如CouchDB,Redis
还可以访问twitter的数据。等等。
可以说利用好这些功能后,我们就会减少很多关联数据的编码。
具体信息参考了wiki。
Foreign Data Wrappers
In 2003,a new extension called SQL/MED ("sql Management of External Data") was added to the sql standard. It is a standardized way of handling access to remote objects in sql databases. In 2011,Postgresql 9.1 was released with a great support of this standard.
In a nutshell,you can now use varIoUs Foreign Data Wrappers (FDW) to connect a Postgresql Server to remote data stores. This page is an incomplete list of the Wrappers available right now. Another fdw list can be found at the PGXN website.
Please keep in mind that most of these wrappers are not officially supported by the Postgresql Global Development Group (PGDG) and that some of these projects are still in Beta version. Use carefully!
sql Databases Wrappers
oracle_fdw
MysqL_fdw
This extension implements a Foreign Data Wrapper for MysqL. It is supported on Postgresql 9.1 and above.
tds_fdw
A wrapper for accessing Sybase and Microsoft sql Server databases.
odbc_fdw
A wrapper for databases with an ODBC driver,including Oracle,DB2,Microsoft sql Server,Sybase,Pervasive sql,IBM Lotus Domino,Postgresql and desktop database products such as FileMaker and Microsoft Access:
- source code
- install with PGXN
- Using odbc_fdw on windows to query sql server (Postgres OnLine Journal March/April 2012)
Nosql Databases Wrappers
couchdb_fdw
A wrapper for CouchDB
redis_fdw
A wrapper for Redis
File Wrappers
file_fdw
A CSV files wrapper. Delivered as an official extension of Postgresql 9.1
- documentation
- example
- Another example Postgres OnLine Journal May 2012
file_text_array_fdw
Another CSV wrapper
- source code
- How to use it Postgres OnLine Journal May 2012
file_fixed_length_record_fdw
Fixed-width flat file wrapper
Others
twitter_fdw
A wrapper fetching text messages from Twitter over the Internet and returning a table
ldap_fdw
Allows Postgresql to query an LDAP server and retrieve data from some pre-configured Organizational Unit
PGStrom
uses GPU devices to accelarate sequential scan on massive amount of records with complex qualifiers.
s3_fdw
Reads files located in Amazon S3
www_fdw
Allows to query different web services:
Multicorn Foreign Data Wrappers
Multicorn is an extension that allows FDWs to be written in Python
sql Database Wrappers
multicorn.sqlalchemyfdw
This fdw can be used to access data stored in any database supported by the sqlalchemy python toolkit.
File Wrappers
muticorn.fsfdw
This fdw can be used to access data stored in varIoUs files,in a filesystem. The files are looked up based on a pattern,and parts of the file's path are mapped to varIoUs columns,as well as the file's content itself.
multicorn.csvfdw
This fdw can be used to access data stored in CSV files. Each column defined in the table will be mapped,in order,against columns in the CSV file.