DataStax Extends Stargate
Written by Nikos Vaggalis   
Monday, 11 October 2021

DataStax, mostly known for AstraDB the multi-cloud database based on Apache Cassandra, has announced the addition of new capabilities to its Stargate Gateway product.

 stargate

Stargate is a data gateway deployed between client applications and databases. Its novelty lies in that it exposes the database layer as a multitude of APIs, that way offering flexibility to the way you expose your data. Needless to say, that's a big boon for developers.

stargatesq

The APIs in question are the Document, REST, CQL and GraphQL. As such under the Document API you can modify and query data stored as unstructured JSON documents in collections. The REST API exposes CRUD access to data stored in Cassandra tables, while under the CQL API you can access those tables using Cassandra’s native query language CQL.

Lastly, under the GraphQL API you can easily modify and query table data using GraphQL types, queries, and mutations. This happens seamlessly as when Stargate’s GraphQL API is added to an existing Cassandra deployment, it scans the database and automatically creates HTTP endpoints with GraphQL queries and mutations for the objects that it finds in the database. New database tables can also be created directly via the API.

While the GraphQL API is not a new addition to Stargate, it now is being extended so that developers can create tables and define schemas in Apache Cassandra without the need to work directly with Cassandra Query Language (CQL).

But what does that actually mean? How were things working before that change? I've reached out and Doug Wettlaufer, Senior Software Engineer at DataStax, kindly provided the details:

Basically the GraphQL API has two modes, schema-first (also referred to as GraphQL-first) and CQL-first.

In CQL-first the API feels very familiar to someone that's used CQL. You're working with keyspaces and tables. Plus this API will expose exactly what's in your existing Cassandra schema.

On the other hand GraphQL-first takes a more GraphQL native approach; it instead accepts a GraphQL schema file to generate your underlying Cassandra schema.

The new version adds this GraphQL-first schema approach.

As such Stargate’s GraphQL API,which is built upon graphql-java, exposes the following GraphQL services over HTTP: 

  • /graphql-schema exposes DDL operations (describe, create table, etc). It can be used for any keyspace (most operations take a keyspace argument).

  • for each keyspace, there is a /graphql/<keyspace> service for DML operations (read and insert data, etc). Initially, its GraphQL schema is automatically generated from the CQL data model. We call this the CQL-first model.

  • /graphql-admin allows users to deploy their own GraphQL schemas. Stargate will alter the CQL schema to match what they want to map. This is called the GraphQL-first model. Once a GraphQL-first schema has been deployed in this manner, it replaces the CQL-first one:
    /graphql/<keyspace> now uses the custom schema, and the generated schema is not available any more.

This functionality, however, goes beyond Cassandra - through integration with the Apollo Gateway it can interface with other databases that support GraphQL including MongoDB, MySQL and PostgreSQL, as well with data stores on AWS, Google Cloud, and Microsoft Azure.

Stargate is available as part of the Astra DB cloud service and as an open source project for Apache Cassandra and DataStax Enterprise.

So how far can you go seeking to add GraphQL support? Do you go as far as a dedicated GraphQL dbms like DGraph or do you easily extend your existing infrastructure through Stargate?

More Information

AstraDB GraphQL API

GraphQL API Quickstart

GraphQL API on GitHub

Related Articles

Spring GraphQL Milestone One

Netflix's GraphQL for Spring Boot

Graphcool Eases Your Way Into GraphQL

Hasura's Guide to GraphQL 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Interact With Virtual Historic Computers
14/04/2024

Alan Turing's ACE computer is a legendary computer that is particularly special for I Programmer - our account of it was the first ever history article on the site when it launched in 2009. Now this i [ ... ]



Important Conference Results
17/04/2024

The SIGBOVIK conference has just finished and its proceedings can be downloaded, but only at your peril. You might never see computer science in the same way ever again.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info