Querying your Cloudant database with SQL

Updating the silverlining Node.js library to support the basics of SQL

Glynn Bird
Jul 18, 2017 · 3 min read
SELECT name, colour, price 
FROM animalsdb
WHERE type='cat' OR (price > 500 AND price < 1000)
LIMIT 50
Many databases can store BLOB types, but this isn’t one of those kinds of blobs. Image credit: mark du toit.

Silverlining + SQL

The latest version of the silverlining Node.js library can now accept SQL queries. It will convert the SQL into a Cloudant Query and deliver the results.

npm install -s silverlining
var db = require('silverlining')('https://USER:PASS@HOST.cloudant.com/animalsdb');
db.query('SELECT name FROM animalsdb').then(function(data) {
// data!
});

Limitations

Before we get carried away, this feature doesn’t suddenly make Cloudant support joins, unions, transactions, stored procedures etc. It’s just a translation from SQL to Cloudant Query.

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.

Glynn Bird

Written by

Developer @ IBM. https://glynnbird.com

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.