SlideShare a Scribd company logo
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

More Related Content

What's hot

Oracle apex training
Oracle apex trainingOracle apex training
Oracle apex training
Vasudha India
 
NkSIP: The Erlang SIP application server
NkSIP: The Erlang SIP application serverNkSIP: The Erlang SIP application server
NkSIP: The Erlang SIP application server
Carlos González Florido
 
JSON and PL/SQL: A Match Made in Database
JSON and PL/SQL: A Match Made in DatabaseJSON and PL/SQL: A Match Made in Database
JSON and PL/SQL: A Match Made in Database
Steven Feuerstein
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web Services
Jeff Smith
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
Simona Cotin
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Appier
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Sangeeta Ashrit
 
Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...
Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...
Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...
Edureka!
 
Graphql presentation
Graphql presentationGraphql presentation
Graphql presentation
Vibhor Grover
 
Oracle Fleet Patching and Provisioning Deep Dive Webcast Slides
Oracle Fleet Patching and Provisioning Deep Dive Webcast SlidesOracle Fleet Patching and Provisioning Deep Dive Webcast Slides
Oracle Fleet Patching and Provisioning Deep Dive Webcast Slides
Ludovico Caldara
 
Oracle APEX Introduction (release 18.1)
Oracle APEX Introduction (release 18.1)Oracle APEX Introduction (release 18.1)
Oracle APEX Introduction (release 18.1)
Michael Hichwa
 
GraphQL Basics
GraphQL BasicsGraphQL Basics
GraphQL Basics
LeanIX GmbH
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
Muhilvarnan V
 
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Hafiz Ismail
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
Serge Huber
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
Josh Price
 
Error Management Features of PL/SQL
Error Management Features of PL/SQLError Management Features of PL/SQL
Error Management Features of PL/SQL
Steven Feuerstein
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
Rafael Wilber Kerr
 
Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)
Postman
 
All About PL/SQL Collections
All About PL/SQL CollectionsAll About PL/SQL Collections
All About PL/SQL Collections
Steven Feuerstein
 

What's hot (20)

Oracle apex training
Oracle apex trainingOracle apex training
Oracle apex training
 
NkSIP: The Erlang SIP application server
NkSIP: The Erlang SIP application serverNkSIP: The Erlang SIP application server
NkSIP: The Erlang SIP application server
 
JSON and PL/SQL: A Match Made in Database
JSON and PL/SQL: A Match Made in DatabaseJSON and PL/SQL: A Match Made in Database
JSON and PL/SQL: A Match Made in Database
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web Services
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...
Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...
Apache Spark Training | Spark Tutorial For Beginners | Apache Spark Certifica...
 
Graphql presentation
Graphql presentationGraphql presentation
Graphql presentation
 
Oracle Fleet Patching and Provisioning Deep Dive Webcast Slides
Oracle Fleet Patching and Provisioning Deep Dive Webcast SlidesOracle Fleet Patching and Provisioning Deep Dive Webcast Slides
Oracle Fleet Patching and Provisioning Deep Dive Webcast Slides
 
Oracle APEX Introduction (release 18.1)
Oracle APEX Introduction (release 18.1)Oracle APEX Introduction (release 18.1)
Oracle APEX Introduction (release 18.1)
 
GraphQL Basics
GraphQL BasicsGraphQL Basics
GraphQL Basics
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
 
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
 
Error Management Features of PL/SQL
Error Management Features of PL/SQLError Management Features of PL/SQL
Error Management Features of PL/SQL
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)
 
All About PL/SQL Collections
All About PL/SQL CollectionsAll About PL/SQL Collections
All About PL/SQL Collections
 

Similar to Intro to GraphQL for Database Developers

How To Visualize Graphs
How To Visualize GraphsHow To Visualize Graphs
How To Visualize Graphs
Jean Ihm
 
Intro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersIntro to JavaScript for APEX Developers
Intro to JavaScript for APEX Developers
Daniel 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 APEX
DavidPeake15
 
GraphQL research summary
GraphQL research summaryGraphQL research summary
GraphQL research summary
Objectivity
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQL
Georgi Kodinov
 
High performing Salesforce Data Connectors
High performing Salesforce Data ConnectorsHigh performing Salesforce Data Connectors
High performing Salesforce Data Connectors
Nishanth 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 Maps
Jean Ihm
 
Graphql
GraphqlGraphql
Graphql
Niv Ben David
 
Scala and spark
Scala and sparkScala and spark
Scala and spark
Janu Jahnavi
 
Oracle NoSQL
Oracle NoSQLOracle NoSQL
Oracle NoSQL
Oracle Korea
 
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 Features
msewtz
 
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
p6academy
 
Module 1: JavaScript Basics
Module 1: JavaScript BasicsModule 1: JavaScript Basics
Module 1: JavaScript Basics
Daniel 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.docx
ssuser5583681
 
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
Simon 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 ORDS
Sumit 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 2020
Markus Michalewicz
 

Similar to 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
 

More from Daniel McGhan

Dynamic Actions, the Hard Parts
Dynamic Actions, the Hard PartsDynamic Actions, the Hard Parts
Dynamic Actions, the Hard Parts
Daniel 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 jQuery
Daniel 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 Apps
Daniel 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 Basics
Daniel 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 World
Daniel McGhan
 

More from 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
 

Recently uploaded

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 

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

Editor's Notes

  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.