Oracle Database Support for GraphQL

Advancements in relational database technologies have further amplified the benefits of GraphQL. Oracle AI Database now provides the support for integrating GraphQL by providing means to query the database directly without using custom resolvers.

Through Oracle Database Support for GraphQL Queries, you can effortlessly create, introspect, and query complex data objects without sacrificing the performance, scalability, or optimization provided by relational databases. Automated schema inference from relational structures streamlines the querying process, making GraphQL a seamless add-on to established relational storage models.

Starting 26ai, Oracle AI Database Support for GraphQL Queries also introduces a table function which lets Oracle AI Database understand GraphQL through an inbuilt GraphQL parser.

Table 1-1 GraphQL Query vs Oracle Supported GraphQL Table Function

  Standard GraphQL Query Oracle AI Database Supported GraphQL Table Function
Sample Query
query {
  race {
    name
    date
    result {
      finalPosition
      driver {
	name
      }
    }
  }
}
select * from graphql(' 
  race {
    name
    date
    result {
      finalPosition
      driver {
	name
      }
    }
  }
')
Output The GraphQL query will produce one JSON document, which will contain data from all races. The Oracle AI Database Supported Table Function for GraphQL Queries will create and return one row per race.
Oracle Database Support for GraphQL Queries also introduces the following to eliminate the need for extensive repetitive, manual coding tasks, simplifying maintenance and enabling sophisticated data flows within applications:

Since GraphQL query is embedded inside a SQL query, existing SQL tools used for diagnosability, performance measurement, and performance optimization such as AWR, SQL Monitor, SQL Tracing, SQL Hints can also be used with the Oracle Database supported GraphQL queries.

Complementing this, Oracle AI Database 26ai offers JSON Relational Duality, a paradigm allowing data to reside in normalized relational tables while being accessed as flexible, developer-friendly JSON documents. Oracle Database Support for GraphQL Queries allows you to create the Duality Views, which are defined using an intuitive GraphQL-like syntax to bridge the structured relational model with modern application needs. Duality Views make it straightforward to create, and query complex data objects while retaining the performance and scalability benefits of relational storage. These approaches collectively streamline querying and data manipulation by enabling automated schema inference from relational models and seamless GraphQL integration with databases.

This book covers only the most basic information related to integrating GraphQL to Oracle AI Database. It is assumed that you are familiar with the concept of JSON-relational duality views and have brief knowledge about the GraphQL standard. Oracle recommends referring to the official documentation and specifications from GraphQL to gain a complete picture. Refer to JSON-Relational Duality Developer's Guide for understanding the concepts of JSON-relational duality views. The popular car racing example is used to illustrate GraphQL integration into the Oracle AI Database.