Multicorn based PostgreSQL Foreign Data Wrapper for RethinkDB
This was set up for Python 2.7, Multicorn 1.1, PostgreSQL 9.3, and RethinkDB 1.15. If you are using something else, your mileage may vary. ... Heck, your mileage may vary anyhow. We think this works for us, we make no guarantee or promise it will work for you too ...
- $ sudo pip install rethinkdb
- $ sudo pgxn install multicorn
- $ git clone https://github.com/rotten/rethinkdb-multicorn-postgresql-fdw
- $ cd rethinkdb-multicorn-postgresql-fdw
- $ sudo python setup.py install
- mydb=# create extension multicorn;
- mydb-# create server myrethinkdb foreign data wrapper multicorn options (wrapper 'rethinkdb_fdw.rethinkdb_fdw.RethinkDBFDW', host 'myhost', port '28015', database 'somerethinkdb');
create foreign table mytable ( id uuid, somekey varchar, someotherkey varchar, sometimestamp timestamp (6) with time zone, bigintegerkey bigint, nestedjsonkey json, yetanotherkey varchar ) server myrethinkdb options (table_name 'rethinkdb_table');
When foreign table performance is an issue, you may want to put a materialized view in front of your foreign table. ** Remember to refresh the materialized view when you need to see the latest stuff from your RethinkDB. (PostgreSQL does not yet have auto-refreshing materialized views.)
#####Some Notes on development/troubleshooting this FDW:
- You can set:
log_min_messages = debug1in your postgresql.conf to see the log_to_postgres() DEBUG messages.
- You will probably need to exit psql and re-enter it to pick up changes to the python libraries when you push an update. (You do not necessarily have to drop your server and table definitions if you are only changing the querying logic.)
- Send us a pull request if you have bug fixes or enhancements or good ideas to make it better.
Here is a noteworthy blog post on the RethinkDB site about this project: http://rethinkdb.com/blog/postgres-foreign-data-wrapper/