Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Native APIs for Querying Couchbase Server with...

Native APIs for Querying Couchbase Server with N1QL

This talk was given by Jeff Morris and me on the next generation Couchbase SDKs and how they integrate with N1QL (query language) at our Couchbase Connect 2014 conference in San Francisco.

Michael Nitschinger

October 06, 2014
Tweet

More Decks by Michael Nitschinger

Other Decks in Programming

Transcript

  1. Native APIs for Querying Couchbase Server with N1QL Jeff Morris

    | Software Engineer, Couchbase Michael Nitschinger | Software Engineer, Couchbase
  2. Everything shown in this talk is a preview and subject

    to change before we ship official N1QL integration. Take everything with a grain of salt and give us feedback to make it even better. Disclaimer ©2014 Couchbase, Inc. 2
  3. Motivation ©2014 Couchbase, Inc. 4 Querying is integral to Couchbase

    Server SDKs need to provide first-class querying for §  Views §  N1QL The 2.0 SDKs provide document oriented APIs and querying needs to blend together
  4. N1QL Overview ©2014 Couchbase, Inc. 5 N1QL (“Nickel”) is the

    next generation query language for Couchbase Server §  Designed to be similar to SQL §  First-Class JSON support §  Currently in Developer Preview §  See http://query.couchbase.com §  Supports SELECT, DML, DDL § SDKs focus is on SELECT for now
  5. 2.0 Querying API ©2014 Couchbase, Inc. 9 Provides consistent experience

    across §  Views §  N1QL Blends into Document API Sweet spot between §  Consistency across SDKs §  Language features
  6. Query Generators and Executers •  Ad-hoc queries •  New LINQ

    Provider Mapping results and Handling Errors •  Query Mapping •  Query Results N1QL Query Support in .NET SDK 2.0 ©2014 Couchbase, Inc. 11
  7. §  Part of the SDK 2.0 IBucket interface §  Standard

    un-typed, string based queries §  No syntactical help §  Results can be mapped to POCOs or to a dynamic type §  Supports all N1QL commands, keywords, etc §  Errors are handled and propagated up to the caller §  The current query interface for N1QL queries in Couchbase Server §  Github Url: https://github.com/couchbase/couchbase-net-client Ad-Hoc Queries ©2014 Couchbase, Inc. 12
  8. §  An extension of the Couchbase .NET SDK 2.0 § 

    Open Source Apache 2.0 License § Pull requests kindly accepted! §  Github url: https://github.com/couchbaselabs/Linq2Couchbase §  Brings familiar LINQ syntax to N1QL and Couchbase Server §  Currently supports a minimal subset of the N1QL language (this will soon change) §  Errors are un-handled §  Results are mapped to POCOs §  The “future” query interface for N1QL and Couchbase Server in .NET Linq2Couchbase ©2014 Couchbase, Inc. 17
  9. Expect a GA released with N1QL GA Eventually a “full-featured”

    LINQ provider Anything that is not supported by the LINQ provider can be done via IBucket.Query<T>(string query) Linq2Couchbase: Future Support ©2014 Couchbase, Inc. 22
  10. Java SDK API ©2014 Couchbase, Inc. 25 Access types § 

    Asynchronous (Reactive) using Rx Observables §  Synchronous Utilizes a JSON streaming parser and pushes chunks as they arrive Works on a per-bucket basis
  11. N1QL DSL ©2014 Couchbase, Inc. 31 §  The SDK ships

    with a N1QL DSL §  syntax aware (based on the EBNF) §  strongly typed §  Should be used in favor of the raw string §  Makes developing N1QL queries a breeze §  Built-in IDE autocomplete awareness §  Heavily inspired by jOOQ (http://www.jooq.org/)
  12. QA