couchcsvexport
v1.1.0
Published
CouchDB export-to-csv utility
Downloads
6
Readme
couchcsvexport
Introduction
The couchcsvexport command-line utility is useful for exporting Apache CouchDB database to CSV format. Note:
- the documents must be uniform i.e. have the same number of attributes.
- "flat" JSON documents make for better CSV exports
- the first line of the CSV will be the column headers
Installation
Install using npm or another Node.js package manager:
npm install -g couchcsvexport
Usage
couchcsvexport (or its alias couchexport) writes a CSV to stdout which can be redirected to a file:
couchexport --db mydatabase > mydatabase.csv
couchexport's configuration parameters can be stored in environment variables or supplied as command line arguments.
Configuration - environment variables
Simply set the COUCH_URL
environment variable e.g. for a hosted Cloudant database
export COUCH_URL="https://myusername:[email protected]"
and define the name of the CouchDB database to write to by setting the COUCH_DATABASE
environment variable e.g.
export COUCH_DATABASE="mydatabase"
Configuring - command-line options
Supply the --url
and --database
parameters as command-line parameters instead:
couchexport --url "http://user:password@localhost:5984" --database "mydata"
IAM
To use IBM IAM authentication, use the IAM_API_KEY
environment variable e.g.
export IAM_API_KEY="my_api_key"
export COUCH_URL="https://my.cloudant.com"
couchexport --db mydata