SlideShare une entreprise Scribd logo
1  sur  29
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Intro to GraphQL for Database Developers
Dan McGhan
Developer Advocate @Oracle
May 16, 2019
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
About me
• Dan McGhan
– Developer Advocate @Oracle
– Focus on JavaScript and Oracle Database
• Contact Info
– dan.mcghan@oracle.com
– @dmcghan
– jsao.io
4
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Agenda
Overview of GraphQL
Type system and query language
Demo
1
2
3
5
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Agenda
Overview of GraphQL
Type system and query language
Demo
1
2
3
6
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
What is GraphQL?
• A query language for APIs created by Facebook
– Designed to make APIs more flexible and efficient
• Consists of
– Type system
– Query language and execution semantics
– Static validation
– Type introspection
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraphQL history
• Internal Facebook project since 2012
• First specification released publicly in 2015
– Regular updates since then
• 2019: One of the hottest buzzwords in tech
8
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Spec vs. implementation
• Facebook publishes a spec and a reference implementation
– The spec describes how a GraphQL implementation should work
– GraphQL.js is the reference implementation in JavaScript
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Primary benefits of GraphQL
• Addresses under fetching
– Can get many resources in a single request
• Addresses over fetching
– Can project only what’s needed for the app
• Organization is based on types and fields rather than URL endpoints
– GraphQL servers have a single “smart” endpoint
• Evolve APIs without versions
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
REST vs GraphQL
REST GraphQL
Can send over HTTP Can send over HTTP
Can return JSON Can return JSON
Endpoint is the object identity Object identity is part of the query
Resource is determined by the server Server declares what is available, client
requests what it needs
May require loading from multiple URLs Gets all the data in a single request
GET or POST to same URL query{} and mutation{} use same URL
Calls are stateless Query and mutation operations are
stateless
11
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 12
Web Browser Web Server Database
SQL
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 13
Web Browser Web Server Database
SQLGraphQL
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Agenda
Overview of GraphQL
Type system and query language
Demo
1
2
3
14
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Type system
• Describes the objects that can be returned
– Schema Definition Language expresses the GraphQL schema shape and types
• Default scalar types
– ID, Int, Float, String, Boolean
• Other types
– Object, Interface, Union, Enum, Input Object, List, Directive
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Operation types
• Query
– Think: SELECT or Data Query Language (DQL)
• Mutation
– Think: Data Manipulation Language (DMLP
• Subscription
– Think: Continuous Query Notification (CQN)
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Let’s start with something we know…
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
EMP and DEPT DDL
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
EMP and DEPT as GraphQL schema language
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Adding a root object
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Rolling the query root into a schema
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
REST request/response
REST GET
/departments/1
22
REST Response
{
"deptno": 1,
"dname": "ACCOUNTING",
"loc": "NEW YORK"
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraphQL query/response
GraphQL Query
{
department(id: 1) {
deptno
dname
loc
}
}
23
Response
{
"data": {
"department": {
"deptno": 1,
"dname": "ACCOUNTING",
"loc": "NEW YORK"
}
}
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraphQL query/response
GraphQL Query 2
{
department(id: 1) {
deptno
dname
}
}
24
Response 2
{
"data": {
"department": {
"deptno": 1,
"dname": "ACCOUNTING" }
}
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Agenda
Overview of GraphQL
Type system and query language
Demo
1
2
3
25
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 26
GraphQL Demo Technologies
‘GraphiQL’ UI express, express-graphql,
graphql, and node-oracledb
modules
Oracle Database
Queries and responses GraphQL requests over HTTP Persistence
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Closing thoughts
• REST isn’t going away anytime soon
– And it still has some advantages over GraphQL
• But GraphQL is like giving SQL to front-end developers
– We all know how powerful SQL is!
• Keep GraphQL on your radar
– Front-end devs will likely be asking for it soon…
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Where to go from here
• https://graphql.org/
– The “home” for GraphQL; great learning material
• https://www.howtographql.com
– Another excellent learning resource with videos
• https://graphql.github.io/graphql-spec/
– Specification
• https://goodapi.co/blog/rest-vs-graphql
– Fair, unbiased comparison of REST and GraphQL
Intro to GraphQL for Database Developers

Contenu connexe

Tendances

Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Rafael Wilber Kerr
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperJeff Smith
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Markus Michalewicz
 
API & Backend Integration
API & Backend IntegrationAPI & Backend Integration
API & Backend IntegrationElewayte
 
Deep Dive into the New Features of Apache Spark 3.1
Deep Dive into the New Features of Apache Spark 3.1Deep Dive into the New Features of Apache Spark 3.1
Deep Dive into the New Features of Apache Spark 3.1Databricks
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLDatabricks
 
The evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its CommunityThe evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its CommunityJulian Hyde
 
Beyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFramesBeyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFramesDatabricks
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and TomorrowVMware Tanzu
 
Administración de Apache Hadoop a través de Cloudera
Administración de Apache Hadoop a través de ClouderaAdministración de Apache Hadoop a través de Cloudera
Administración de Apache Hadoop a través de ClouderaDavid Albela Pérez
 
Hive Bucketing in Apache Spark
Hive Bucketing in Apache SparkHive Bucketing in Apache Spark
Hive Bucketing in Apache SparkTejas Patil
 
Some Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdfSome Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdfMichael Kogan
 
Apache Calcite overview
Apache Calcite overviewApache Calcite overview
Apache Calcite overviewJulian Hyde
 
Etsy Activity Feeds Architecture
Etsy Activity Feeds ArchitectureEtsy Activity Feeds Architecture
Etsy Activity Feeds ArchitectureDan McKinley
 
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesBest Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesMarkus Michalewicz
 
Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...
Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...
Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...Flink Forward
 

Tendances (20)

GraphQL
GraphQLGraphQL
GraphQL
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL Developer
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
 
API & Backend Integration
API & Backend IntegrationAPI & Backend Integration
API & Backend Integration
 
Deep Dive into the New Features of Apache Spark 3.1
Deep Dive into the New Features of Apache Spark 3.1Deep Dive into the New Features of Apache Spark 3.1
Deep Dive into the New Features of Apache Spark 3.1
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQL
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
 
The evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its CommunityThe evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its Community
 
Beyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFramesBeyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFrames
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and Tomorrow
 
Administración de Apache Hadoop a través de Cloudera
Administración de Apache Hadoop a través de ClouderaAdministración de Apache Hadoop a través de Cloudera
Administración de Apache Hadoop a través de Cloudera
 
Hive Bucketing in Apache Spark
Hive Bucketing in Apache SparkHive Bucketing in Apache Spark
Hive Bucketing in Apache Spark
 
Some Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdfSome Iceberg Basics for Beginners (CDP).pdf
Some Iceberg Basics for Beginners (CDP).pdf
 
Apache Calcite overview
Apache Calcite overviewApache Calcite overview
Apache Calcite overview
 
Etsy Activity Feeds Architecture
Etsy Activity Feeds ArchitectureEtsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
 
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesBest Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
 
Spring boot
Spring bootSpring boot
Spring boot
 
Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...
Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...
Marc Schwering – Using Flink with MongoDB to enhance relevancy in personaliza...
 

Similaire à Intro to GraphQL for Database Developers

How To Visualize Graphs
How To Visualize GraphsHow To Visualize Graphs
How To Visualize GraphsJean Ihm
 
Intro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersIntro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersDaniel McGhan
 
Why citizen developers should be your new best friend - Oracle APEX
Why citizen developers should be your new best friend - Oracle APEXWhy citizen developers should be your new best friend - Oracle APEX
Why citizen developers should be your new best friend - Oracle APEXDavidPeake15
 
GraphQL research summary
GraphQL research summaryGraphQL research summary
GraphQL research summaryObjectivity
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQLGeorgi Kodinov
 
High performing Salesforce Data Connectors
High performing Salesforce Data ConnectorsHigh performing Salesforce Data Connectors
High performing Salesforce Data ConnectorsNishanth Kadiyala
 
Oracle Spatial Studio: Fast and Easy Spatial Analytics and Maps
Oracle Spatial Studio:  Fast and Easy Spatial Analytics and MapsOracle Spatial Studio:  Fast and Easy Spatial Analytics and Maps
Oracle Spatial Studio: Fast and Easy Spatial Analytics and MapsJean Ihm
 
Why to Use an Oracle Database?
Why to Use an Oracle Database? Why to Use an Oracle Database?
Why to Use an Oracle Database? Markus Michalewicz
 
JavaScript: Why Should I Care?
JavaScript: Why Should I Care?JavaScript: Why Should I Care?
JavaScript: Why Should I Care?Daniel McGhan
 
UNYOUG - APEX 19.2 New Features
UNYOUG - APEX 19.2 New FeaturesUNYOUG - APEX 19.2 New Features
UNYOUG - APEX 19.2 New Featuresmsewtz
 
Primavera Gateway overview - Oracle Primavera P6 Collaborate 14
Primavera Gateway overview - Oracle Primavera P6 Collaborate 14Primavera Gateway overview - Oracle Primavera P6 Collaborate 14
Primavera Gateway overview - Oracle Primavera P6 Collaborate 14p6academy
 
Module 1: JavaScript Basics
Module 1: JavaScript BasicsModule 1: JavaScript Basics
Module 1: JavaScript BasicsDaniel McGhan
 
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...Mohamedcpcbma
 
Graphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docxGraphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docxssuser5583681
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETDelivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETSimon Haslam
 
REST API debate: OData vs GraphQL vs ORDS
REST API debate: OData vs GraphQL vs ORDSREST API debate: OData vs GraphQL vs ORDS
REST API debate: OData vs GraphQL vs ORDSSumit Sarkar
 
(Oracle) DBA and Other Skills Needed in 2020
(Oracle) DBA and Other Skills Needed in 2020(Oracle) DBA and Other Skills Needed in 2020
(Oracle) DBA and Other Skills Needed in 2020Markus Michalewicz
 

Similaire à Intro to GraphQL for Database Developers (20)

How To Visualize Graphs
How To Visualize GraphsHow To Visualize Graphs
How To Visualize Graphs
 
Intro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersIntro to JavaScript for APEX Developers
Intro to JavaScript for APEX Developers
 
Why citizen developers should be your new best friend - Oracle APEX
Why citizen developers should be your new best friend - Oracle APEXWhy citizen developers should be your new best friend - Oracle APEX
Why citizen developers should be your new best friend - Oracle APEX
 
GraphQL research summary
GraphQL research summaryGraphQL research summary
GraphQL research summary
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQL
 
High performing Salesforce Data Connectors
High performing Salesforce Data ConnectorsHigh performing Salesforce Data Connectors
High performing Salesforce Data Connectors
 
Oracle Spatial Studio: Fast and Easy Spatial Analytics and Maps
Oracle Spatial Studio:  Fast and Easy Spatial Analytics and MapsOracle Spatial Studio:  Fast and Easy Spatial Analytics and Maps
Oracle Spatial Studio: Fast and Easy Spatial Analytics and Maps
 
Graphql
GraphqlGraphql
Graphql
 
Scala and spark
Scala and sparkScala and spark
Scala and spark
 
Oracle NoSQL
Oracle NoSQLOracle NoSQL
Oracle NoSQL
 
Why to Use an Oracle Database?
Why to Use an Oracle Database? Why to Use an Oracle Database?
Why to Use an Oracle Database?
 
JavaScript: Why Should I Care?
JavaScript: Why Should I Care?JavaScript: Why Should I Care?
JavaScript: Why Should I Care?
 
UNYOUG - APEX 19.2 New Features
UNYOUG - APEX 19.2 New FeaturesUNYOUG - APEX 19.2 New Features
UNYOUG - APEX 19.2 New Features
 
Primavera Gateway overview - Oracle Primavera P6 Collaborate 14
Primavera Gateway overview - Oracle Primavera P6 Collaborate 14Primavera Gateway overview - Oracle Primavera P6 Collaborate 14
Primavera Gateway overview - Oracle Primavera P6 Collaborate 14
 
Module 1: JavaScript Basics
Module 1: JavaScript BasicsModule 1: JavaScript Basics
Module 1: JavaScript Basics
 
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
 
Graphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docxGraphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docx
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETDelivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JET
 
REST API debate: OData vs GraphQL vs ORDS
REST API debate: OData vs GraphQL vs ORDSREST API debate: OData vs GraphQL vs ORDS
REST API debate: OData vs GraphQL vs ORDS
 
(Oracle) DBA and Other Skills Needed in 2020
(Oracle) DBA and Other Skills Needed in 2020(Oracle) DBA and Other Skills Needed in 2020
(Oracle) DBA and Other Skills Needed in 2020
 

Plus de Daniel McGhan

Dynamic Actions, the Hard Parts
Dynamic Actions, the Hard PartsDynamic Actions, the Hard Parts
Dynamic Actions, the Hard PartsDaniel McGhan
 
Module 3: Working with the DOM and jQuery
Module 3: Working with the DOM and jQueryModule 3: Working with the DOM and jQuery
Module 3: Working with the DOM and jQueryDaniel McGhan
 
Module 2: Adding JavaScript to APEX Apps
Module 2: Adding JavaScript to APEX AppsModule 2: Adding JavaScript to APEX Apps
Module 2: Adding JavaScript to APEX AppsDaniel McGhan
 
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...Daniel McGhan
 
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...Daniel McGhan
 
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers - Module 1: JavaScript BasicsIntroduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers - Module 1: JavaScript BasicsDaniel McGhan
 
JSON and Oracle Database: A Brave New World
 JSON and Oracle Database: A Brave New World JSON and Oracle Database: A Brave New World
JSON and Oracle Database: A Brave New WorldDaniel McGhan
 

Plus de Daniel McGhan (7)

Dynamic Actions, the Hard Parts
Dynamic Actions, the Hard PartsDynamic Actions, the Hard Parts
Dynamic Actions, the Hard Parts
 
Module 3: Working with the DOM and jQuery
Module 3: Working with the DOM and jQueryModule 3: Working with the DOM and jQuery
Module 3: Working with the DOM and jQuery
 
Module 2: Adding JavaScript to APEX Apps
Module 2: Adding JavaScript to APEX AppsModule 2: Adding JavaScript to APEX Apps
Module 2: Adding JavaScript to APEX Apps
 
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
 
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
 
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers - Module 1: JavaScript BasicsIntroduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
 
JSON and Oracle Database: A Brave New World
 JSON and Oracle Database: A Brave New World JSON and Oracle Database: A Brave New World
JSON and Oracle Database: A Brave New World
 

Dernier

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 

Dernier (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Intro to GraphQL for Database Developers

  • 1.
  • 2. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Intro to GraphQL for Database Developers Dan McGhan Developer Advocate @Oracle May 16, 2019
  • 3. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation.
  • 4. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | About me • Dan McGhan – Developer Advocate @Oracle – Focus on JavaScript and Oracle Database • Contact Info – dan.mcghan@oracle.com – @dmcghan – jsao.io 4
  • 5. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Agenda Overview of GraphQL Type system and query language Demo 1 2 3 5
  • 6. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Agenda Overview of GraphQL Type system and query language Demo 1 2 3 6
  • 7. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | What is GraphQL? • A query language for APIs created by Facebook – Designed to make APIs more flexible and efficient • Consists of – Type system – Query language and execution semantics – Static validation – Type introspection
  • 8. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | GraphQL history • Internal Facebook project since 2012 • First specification released publicly in 2015 – Regular updates since then • 2019: One of the hottest buzzwords in tech 8
  • 9. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Spec vs. implementation • Facebook publishes a spec and a reference implementation – The spec describes how a GraphQL implementation should work – GraphQL.js is the reference implementation in JavaScript
  • 10. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Primary benefits of GraphQL • Addresses under fetching – Can get many resources in a single request • Addresses over fetching – Can project only what’s needed for the app • Organization is based on types and fields rather than URL endpoints – GraphQL servers have a single “smart” endpoint • Evolve APIs without versions
  • 11. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | REST vs GraphQL REST GraphQL Can send over HTTP Can send over HTTP Can return JSON Can return JSON Endpoint is the object identity Object identity is part of the query Resource is determined by the server Server declares what is available, client requests what it needs May require loading from multiple URLs Gets all the data in a single request GET or POST to same URL query{} and mutation{} use same URL Calls are stateless Query and mutation operations are stateless 11
  • 12. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 12 Web Browser Web Server Database SQL
  • 13. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 13 Web Browser Web Server Database SQLGraphQL
  • 14. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Agenda Overview of GraphQL Type system and query language Demo 1 2 3 14
  • 15. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Type system • Describes the objects that can be returned – Schema Definition Language expresses the GraphQL schema shape and types • Default scalar types – ID, Int, Float, String, Boolean • Other types – Object, Interface, Union, Enum, Input Object, List, Directive
  • 16. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Operation types • Query – Think: SELECT or Data Query Language (DQL) • Mutation – Think: Data Manipulation Language (DMLP • Subscription – Think: Continuous Query Notification (CQN)
  • 17. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Let’s start with something we know…
  • 18. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | EMP and DEPT DDL
  • 19. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | EMP and DEPT as GraphQL schema language
  • 20. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Adding a root object
  • 21. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Rolling the query root into a schema
  • 22. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | REST request/response REST GET /departments/1 22 REST Response { "deptno": 1, "dname": "ACCOUNTING", "loc": "NEW YORK" }
  • 23. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | GraphQL query/response GraphQL Query { department(id: 1) { deptno dname loc } } 23 Response { "data": { "department": { "deptno": 1, "dname": "ACCOUNTING", "loc": "NEW YORK" } } }
  • 24. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | GraphQL query/response GraphQL Query 2 { department(id: 1) { deptno dname } } 24 Response 2 { "data": { "department": { "deptno": 1, "dname": "ACCOUNTING" } } }
  • 25. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Agenda Overview of GraphQL Type system and query language Demo 1 2 3 25
  • 26. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 26 GraphQL Demo Technologies ‘GraphiQL’ UI express, express-graphql, graphql, and node-oracledb modules Oracle Database Queries and responses GraphQL requests over HTTP Persistence
  • 27. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Closing thoughts • REST isn’t going away anytime soon – And it still has some advantages over GraphQL • But GraphQL is like giving SQL to front-end developers – We all know how powerful SQL is! • Keep GraphQL on your radar – Front-end devs will likely be asking for it soon…
  • 28. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Where to go from here • https://graphql.org/ – The “home” for GraphQL; great learning material • https://www.howtographql.com – Another excellent learning resource with videos • https://graphql.github.io/graphql-spec/ – Specification • https://goodapi.co/blog/rest-vs-graphql – Fair, unbiased comparison of REST and GraphQL

Notes de l'éditeur

  1. Adoption has been rapid since first public spec released in 2015 Specification unlike REST. Spec is Royalty free - Open Web Foundation Agreement (OWFa) v1.0 Regular spec updates. Current is June 2018 and no longer a ‘Draft RFC’. Contains the Schema Definition Language GraphQL is used in other languages, but this talk is about Node.js I’ve grabbed a few logos of companies using GraphQL from the graphql.org site and other public sources. Oracle is included – I know of at least one product group inside Oracle seriously using GraphQL internally.
  2. Gets all data....: Performance benefits from requiring a single request Stateless allows scaling via cloning of GraphQL server instances
  3. To set the scene of where we’ve come from, let’s look at a REST example A GET call is made to our endpoint for resource 2 <Click> Typically most new APIs give a JSON response If you’ll forgive my nursery tune joke and accept that AGE is a string, in this example we get ‘Old MacDonald’ as the payload I promise no more bad jokes.
  4. Let's look at GraphQL the 'graph query language'. Here we have a declarative query that is submitted, typically over HTTP This query with the root field ‘farmer' asks for the farmer with id of 2. Specifically it asks for the id, the name and the age of that farmer to be returned. <click> The GraphQL specification doesn’t say JSON has to be returned but in-line with REST usage, it typically is.
  5. Let's look at GraphQL the 'graph query language'. Here we have a declarative query that is submitted, typically over HTTP This query with the root field ‘farmer' asks for the farmer with id of 2. Specifically it asks for the id, the name and the age of that farmer to be returned. <click> The GraphQL specification doesn’t say JSON has to be returned but in-line with REST usage, it typically is.
  6. This is what the demo will do. We’ll make some GraphQL queries from a browser using the fantastic GraphiQL (pronounced Graphical) interface. These queries talk to our GraphQL server running in Node.js. The npm eco system has some excellent packages to work with GraphQL. Node.js uses Oracle’s open source node-oracledb module to query Oracle Database. In this particular example I’m using Oracle’s newish Document storage APIs “Simple Oracle Document Acces" or SODA. By default SODA documents are JSON, making it perfect for working with GraphQL (or REST for that matter). I’ll talk a bit more about SODA in a few slides. Note I could easily have used Oracle DB 12.1.0.2’s native JSON functionality, or even manually constructed JSON strings by using standard SQL.