Breaking

Thursday, October 8, 2015

SQL on NoSQL? Couchbase 4.0

NoSQL document store's new SQL


Version 4.0 of Couchbase Server, a NoSQL document store that competes with the likes of MongoDB and Cassandra, is now available. Its main mission is to make working with unstructured data (namely JSON) as easy as querying more conventional row-and-column databases.

Couchbase is following the success of projects like Spark to provide easy-to-program tools that obtain quick, actionable results. In Couchbase's eyes, SQL is still one of the best ways to accomplish the task.

I speak SQL to my document store

Couchbase Server 4.0 uses N1QL, a query language that extends the SQL syntax with commands specific to JSON documents. JSON syntax can nest data within other data, so some of the extensions allow developers to unnest documents and treat them as if they were conventional tabular data.
The language only targets SQL '92, so it doesn't provide some of the latest and most powerful SQL syntax, nor does it support transactions. But other developer-oriented functions are available, such as the EXPLAIN keyword for describing how the query optimizer processes a statement. Plus, Couchbase plans to add features like transactions over time.

InfoWorld's Ian Pointer took a prerelease version of Couchbase 4's N1QL for a test-drive. Based on what he saw, Pointer claimed the view system for Couchbase, which is currently used to extract data from the system, could in time "slowly [fade] away as N1QL becomes the standard for interacting with Couchbase documents." Couchbase wants N1QL to be akin to the SQL that people know and use, not merely a crippled subset of it.

Couchbase isn't alone in providing a SQL-like query language. Cassandra has CQL, which has been the official query interface for the system since version 2.0. But N1QL provides some features not offered in Cassandra 2.0, such as JOIN operations. MongoDB also has a SQL connector, slated for the 3.2 release, designed to help interface with third-party products like Tableau -- but it too lacks the ability to perform JOINs.

Old school vs. new school

If the transformative power of big data tools is best unleashed through programmatic interfaces -- for example, Couchbase's view and map/reduce jobs -- why are envelope-pushing products like Couchbase, Cassandra, and MongoDB adding old-school SQL interfaces? (The irony of "SQL on NoSQL" is hard to ignore.)

One obvious reason is to connect their products to legacy BI tools that use SQL for querying. But another reason, according to Couchbase, is that despite its limitations, SQL allows for rapid application development since a good deal can be accomplished in a query with relatively little code. Sometimes, a simple SQL query is more than enough.

Similar claims are made for the Hadoop data-processing framework Spark -- not because it offers its own SQL query mechanism, Spark SQL, but because it provides native data-access methodologies that tend to be less verbose to work with than the competition. Couchbase is touting SQL via N1QL as a way to get results fast while still respecting connectivity with existing BI products.

The real change, though, may come when front-end BI products choose to speak the new native languages of big data. Tableau, for instance, added a Spark SQL connector earlier this year -- a possible prelude to deeper integration with Spark.
In the meantime, Couchbase is making itself useful to the SQL-based analytics systems out there right now.

SOURCE

No comments:

Post a Comment