coding stuff

Simple way to access CouchDB views using SQL


In order to send CouchDB data for Business Intelligence cubes of one of my costumers, I searched the Internet for Foreign Data Wrappers who perform this access in a simple and fast way.

I’ve quickly found only these options:

  1. couchdb_fdw [https://github.com/ZhengYang/couchdb_fdw]
  2. couch-to-postgres [https://github.com/sysadminmike/couch-to-postgres]

The first one, is a FDW written natively in C (which I thought a bit complicated and long time without maintenance)

And the second is not a FDW, it’s just a solution that replicates data (I think I don’t need my data duplicated, so I’ve discarded this option).

Without any valid options, i remembered a year ago, I had contact with the excellent Multicorn, which abstracts the creation of Foreign Data Wrappers using python.

So I decided to write one that fits to my needs, then I started the couch-fdw r [https://github.com/mdaparte/couch-fdw] repository  with a Foreign Data Wrapper written in python using the Multicorn.

Now, to perform SQL queries against CouchDB views (and therefore integrating with traditional ETL tools) was very simple as described below: (copied from the github repo)

Read More


How to use js libs (like underscorejs) in your CouchDB views


Sometimes, in CouchDB you have to do some data manipulation in the map/reduce functions, that involves array manipulation, summing timestamps, grouping and so on.

But CouchDB doesn’t offer a native way to do that. So you have to code all by your bare hands, like this:

Read More


Powered by WordPress & Theme by Anders Norén