SlideShare a Scribd company logo
PHP,
The X DevAPI,
and the
MySQL Document Store
Dave Stokes
@Stoker
David.Stokes@Oracle.com
https://elephantdolphin.blogspot.com/
https://slideshare.net/davidmstokes
Safe Harbor Agreement
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, AND TIMING OF ANY FEATURES OR
FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE
SOLE DISCRETION OF ORACLE.
2
Small History Lesson Here
3
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
4
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro
services, etc.
○ Main language &
Framework
○ 7 or 8 JavaScript
Frameworks
○ Data Store (SQL & NoSQL) 5
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro services,
etc.
○ Main language & Framework
○ 7 or 8 JavaScript Frameworks
○ Data Store (SQL & NoSQL)
○ JSON
○ SSH/TLS
○ Encryption
○ Bash & Powershell
○ Markdown
○ Cloud
6
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro services, etc.
○ Main language & Framework
○ 7 or 8 JavaScript Frameworks
○ Data Store (SQL & NoSQL)
○ JSON
○ SSH/TLS
○ Encryption
○ Bash & Powershell
○ Markdown
○ Cloud
○ Debugger
○ Multiple Browsers
○ Multiple IDEs
○ Documentation (still low priority)
○ Mentoring (giving or receiving)
○ More frameworks
○ More third party libraries
○ Embedded, Android, IOS, etc.
○ Key management
○ Slack
○ Repository tools
○ * as a Service (*aaS)
○ Whatever the latest craze is from The Register, Inforworld, Slashdot
7
Programmers Tasks
● 20 years ago
○ Editor - vi, vim, emacs
○ Compiler - 1 or two
languages
○ Debugger
○ Browser (maybe)
○ XML (maybe)
○ HTML (growing need)
○ Source Control System
○ IDE (you wish!)
○ Documentation (low priority)
● Today
○ GIT
○ Tests
○ CI
○ Small(er) stuff
■ Containers, VMs, micro services, etc.
○ Main language & Framework
○ 7 or 8 JavaScript Frameworks
○ Data Store (SQL & NoSQL)
○ JSON
○ SSH/TLS
○ Encryption
○ Bash & Powershell
○ Markdown
○ Cloud
○ Debugger
○ Multiple Browsers
○ Multiple IDEs
○ Documentation (still low priority)
○ Mentoring (giving or receiving)
○ More frameworks
○ More third party libraries
○ Embedded, Android, IOS, etc.
○ Key management
○ Slack
○ Repository tools
○ * as a Service (*aaS)
○ Whatever the latest craze is from The Register, Inforworld, Slashdot
○ YAML and other markup file syntax
○ The newest Google tool
○ etc
8
9
BTW This was the big concern of 1999!
Constantly Increasing Learning Curve
10
2%
In my not so scientific study over the past eight years using informal informational
gathering techniques, roughly TWO PERCENT of developers receive any formal
training in Structured Query Language (SQL), Relational Calculus, Data
Normalization, or other database technologies.
And 100% of that 2% wonder why their queries stink! 11
Impedance Mismatch
12
Declarative Language Buried in a OO/Procedural
A big problem for many
developers is that they
are used to Object
Oriented and/or
Procedural programming
languages.
SQL is declarative
programming language
and embedding SQL in
PHP is an object-
relational impedance
mismatch.
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM
friends
WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
// Perform Query
$result = mysql_query($query);
http://us1.php.net/manual/en/function.mysql-query.php
13
Note: the ‘mysql’ connector has
been deprecated and is not
supported in PHP 7 and was
replaced by ‘mysqli’ but there is still
a lot of code with ‘mysql’ around
Other Issues
1. UGLY
2. Hard to have help from your IDE
3. Extra level of complexity / opportunity to fail
4. Badly organized data & queries
And Yet More Issues
● Relational tables need to be set up
● Indexes
● Data mutability
● Need to rely on a DBA (or someone who has that role)
● Can’t start coding much of project before data format is know
● ORMs -- more complexity and another layer to maintain
15
X DevAPI &
The MySQL Document Store
16
So what if there was a way to ...
● Use schemaless JSON documents so you do not have to normalize data and
code before you know the complete schema
● Not have to embed SQL strings in your code
● Use a modern programming style API
● Be able to use the JSON data from SQL or NoSQL -
○ Best of both worlds
17
18
The X DevAPI wraps powerful concepts in a simple API.
A new high-level session concept enables you to write code that can transparently scale from single MySQL
Server to a multiple server environment.
→Read operations are simple and easy to understand.
→Non-blocking, asynchronous calls follow common host language patterns.
→The X DevAPI introduces a new, modern and easy-to-learn way to work with your data.
Documents are stored in Collections and have their dedicated CRUD operation set.
→Work with your existing domain objects or generate code based on structure definitions for
strictly typed languages.
→Focus is put on working with data via CRUD operations.
→Modern practices and syntax styles are used to get away from traditional SQL-String-Building.
19
Scale from Single Server to Cluster w/o Code Change
The code that is needed to connect to a MySQL document store looks a lot like
the traditional MySQL connection code, but now applications can establish logical
sessions to MySQL server instances running the X Plugin. Sessions are produced
by the mysqlx factory, and the returned Sessions can encapsulate access to one
or more MySQL server instances running X Plugin. Applications that use Session
objects by default can be deployed on both single server setups and database
clusters with no code changes.
20
var mysqlx = require('mysqlx');
// Connect to server on localhost
var mySession = mysqlx.getSession( {
host: 'localhost', port: 33060,
user: 'user', password: 'password' } );
var myDb = mySession.getSchema('test');
// Use the collection 'my_collection'
var myColl = myDb.getCollection('my_collection');
// Specify which document to find with Collection.find() and
// fetch it from the database with .execute()
var myDocs = myColl.find('name like :param').limit(1).
bind('param', 'S%').execute();
// Print document
print(myDocs.fetchOne());
mySession.close();
21
PECL MySQl X DevAPI
http://php.net/manual/en/book.mysql-xdevapi.php
22
Installation (Ubuntu 18.04 & PHP 7.2)
Note: The MySQL X DevAPI PECL extension is not bundled with PHP.
// Dependencies
$ apt install build-essential libprotobuf-dev libboost-dev openssl protobuf-
compiler
// PHP with the desired extensions; php7.2-dev is required to compile
$ apt install php7.2-cli php7.2-dev php7.2-mysql php7.2-pdo php7.2-xml
// Compile the extension
$ pecl install mysql_xdevapi
// Use the 'phpenmod' command
$ phpenmod -v 7.2 -s ALL mysql_xdevapi 23
A JAON document is a data structure composed of
key-value pairs and is the fundamental structure for using
MySQL as document store.
This document shows that the values of keys can be
simple data types, such as integers or strings, but can also
contain other documents, arrays, and lists of documents.
For example, the geography key's value consists of
multiple key-value pairs. A JSON document is represented
internally using the MySQL binary JSON object, through
the JSON MySQL datatype.
The most important differences between a document and
the tables known from traditional relational databases are
that the structure of a document does not have to be
defined in advance, and a collection can contain multiple
documents with different structures. Relational tables on
the other hand require that their structure be defined, and
all rows in the table must contain the same columns.
{
"GNP": .6,
"IndepYear": 1967,
"Name": "Sealand",
"_id": "SEA",
"demographics": {
"LifeExpectancy": 79,
"Population": 27
},
"geography": {
"Continent": "Europe",
"Region": "British Islands",
"SurfaceArea": 193
},
"government": {
"GovernmentForm": "Monarchy",
"HeadOfState": "Michael Bates"
}
}
24
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 25
An Example
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 26
The URI specifies the details of the connection
- Protocol
- Username
- Authentication String
- Lost
- Port
The X Plugin listens at port 33060
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 27
1. Connect to the schema ‘testxx’
2. Create a collection for JSON documents
named ‘example1’
3. Use the collection ‘example1’
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 28
Add records to the collection
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("testxx");
$collection = $schema->createCollection("example1");
$collection = $schema->getCollection("example1");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 29
Find the record where the name = ‘Mike’
The Emphasis is on CRUD
30
Operation form Description
db.name.add()
The add() method inserts one document or more documents into the named
collection.
db.name.find() The find() method returns some or all documents in the named collection.
db.name.modify() The modify() method updates documents in the named collection.
db.name.remove()
The remove() method deletes one document or a list of documents from the
named collection.
CRUD EBNF Definitions - https://dev.mysql.com/doc/x-devapi-userguide/en/mysql-x-
crud-ebnf-definitions.html
find()
31
No more messy strings
$SQLQuery = “SELECT * FROM people WHERE job
LIKE “ . $job . “AND age > $age”;
Versus
$collection = $schema-
>getCollection("people");
$result = $collection
->find('job like :job and age > :age')
->bind(['job' => 'Butler', 'age' => 16])
->execute(); 32
Easier to read/comprehend than SQL
$result = $collection
->remove('age > :age_from and age < :age_to')
->bind(['age_from' => 20, 'age_to' => 50])
->limit(2)
->execute();
33
Easy to add filters like SORT, LIMIT, HAVING GROUP BY
Indexes on collections
$collection->createIndex(
'myindex1',
'{"fields": [{
"field": "$.name",
"type": "TEXT(25)",
"required": true}],
"unique": false}'
);
34
Got Tables?
You can also use the MySQL Document Store with Relational Tables
35
Quick Example using a table
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
print_r($row);
36
The URI Connection for a Session
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
$row = $result->fetchAll();
print_r($row);
37
Get schema and table
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
print_r($row);
38
The Query
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("world");
$table = $schema->getTable("city");
$row = $table->select('Name','District')
->where('District like :district')
->bind(['district' => 'Texas'])
->limit(25)
->execute()->fetchAll();
;
print_r($row);
39
What if I Don’t Want to Rewrite old queries?
$session->sql("CREATE DATABASE addressbook")->execute();
40
Okay I can use Collections and Tables
BUT WHAT
ABOUT
BOTH!?!?!?! 41
You can also use a Collection as a table!
$collection = $schema->getCollection("people");
$table = $schema->getCollectionAsTable("people");
42
#!/bin/php
<?php
$session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060");
if ($session === NULL) {
die("Connection could not be established");
}
$schema = $session->getSchema("nyeats");
$table = $schema->getTable("restaurants");
$sqlx =
"WITH cte1 AS (SELECT doc->>"$.name" AS 'name',
doc->>"$.cuisine" AS 'cuisine',
(SELECT AVG(score) FROM
JSON_TABLE(doc, "$.grades[*]"
COLUMNS (score INT PATH "$.score")) as r ) AS avg_score
FROM restaurants)
SELECT *, rank() OVER
(PARTITION BY cuisine ORDER BY avg_score) AS `rank`
FROM cte1
ORDER by `rank`, avg_score DESC limit 10";
$row->sql($sqlx)->execute()-fetchAll();
print_r($row);
43
You can also use
Windowing Functions
for Advanced
Analytics
One of the advantages
of using MySQL as a
NoSQL Document
store is that you can
use SQL analytics on
your data!
44
Combine CTEs, Windowing Functions, & JSON_TABLE
WITH cte1 AS (SELECT doc->>"$.name"
AS 'name',
doc->>"$.cuisine" AS 'cuisine',
(SELECT AVG(score) FROM
JSON_TABLE(doc, "$.grades[*]"
COLUMNS (score INT PATH
"$.score")) as r ) AS avg_score
FROM restaurants)
SELECT *, rank() OVER
(PARTITION BY cuisine ORDER BY
avg_score) AS `rank`
FROM cte1
ORDER by `rank`, avg_score DESC limit 10
JSON_TABLE turns unstructured
JSON documents in to temporary
relational tables that can be
processed with SQL
Windowing Function for analytics
Common Table Expression make it
easy to write sub-queries
45
46
The X Plugin
… is a shared object that is installed by default in MySQL 8.0 and must be loaded
in 5.7
mysqlsh -u user -h localhost --classic --dba enableXProtocol
Or
mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so';
It listens on port 33060 so make sure you open firewall for 3306 (old MySQL) and
33060 (X Plugin).
And it supports SSL/TLS!!!
47
The New MySQL Shell
48
Built In JavaScript and
Python interpreters let
you work with you data
in the MySQL Shell.
Plus you get command
completion, great help
facilities, the ability to
check for server
upgrades, and the
ability to administrate a
InnoDB Clusters.
And you can also use
SQL
Built in JSON Bulk Loader
49
50
InnoDB Cluster
MySQL InnoDB cluster provides a complete high availability
solution for MySQL. Each MySQL server instance runs MySQL
Group Replication, which provides the mechanism to replicate
data within InnoDB clusters, with built-in failover.
AdminAPI removes the need to work directly with Group
Replication in InnoDB clusters MySQL Router can automatically
configure itself based on the cluster you deploy, connecting client
applications transparently to the server instances.
Multiple secondary server instances are replicas of the primary. If
the primary fails, a secondary is automatically promoted to the
role of primary. MySQL Router detects this and forwards client
applications to the new primary. Advanced users can also
configure a cluster to have multiple-primaries.
Questions and Answers plus Additional Resources
● More Info on MySQL Document Store
○ PHP PECL Extension for X DevAPI
■ http://php.net/manual/en/book.mysql-xdevapi.php
○ MySQL Document Store
■ https://dev.mysql.com/doc/refman/8.0/en/document-store.html
○ X DevAPI User Guide
■ https://dev.mysql.com/doc/x-devapi-userguide/en/
○ Dev.MySQL.com for Downloads and Other Doces
○ X DevAPI Tutorial for Sunshine PHP
■ https://github.com/davidmstokes/PHP-X-DevAPI
● David.Stokes@Oracle.com
○ https://elephantdolphin.blogspot.com/
○ Slides at https://slideshare.net/davidmstokes
○ @Stoker
○ MySQL & JSON - A Practical Programming Guide
51

More Related Content

What's hot

Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Guatemala User Group
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationDave Stokes
 
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015Dave Stokes
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015Dave Stokes
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Dave Stokes
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational databaseDave Stokes
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLDave Stokes
 
common_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLcommon_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLShlomi Noach
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesDave Stokes
 
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)dpc
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary logFrederic Descamps
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redisjimbojsb
 
Create a Database Application Development Environment with Docker
Create a Database Application Development Environment with DockerCreate a Database Application Development Environment with Docker
Create a Database Application Development Environment with DockerBlaine Carter
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
MySQL Without the SQL -- Oh My!  Longhorn PHP ConferenceMySQL Without the SQL -- Oh My!  Longhorn PHP Conference
MySQL Without the SQL -- Oh My! Longhorn PHP ConferenceDave Stokes
 

What's hot (20)

Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Best Features of Multitenant 12c
Best Features of Multitenant 12cBest Features of Multitenant 12c
Best Features of Multitenant 12c
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
 
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQL
 
common_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQLcommon_schema 2.0: DBA's Framework for MySQL
common_schema 2.0: DBA's Framework for MySQL
 
MySQL JSON Functions
MySQL JSON FunctionsMySQL JSON Functions
MySQL JSON Functions
 
Oracle Essentials Oracle Database 11g
Oracle Essentials   Oracle Database 11gOracle Essentials   Oracle Database 11g
Oracle Essentials Oracle Database 11g
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
 
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary log
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
 
Create a Database Application Development Environment with Docker
Create a Database Application Development Environment with DockerCreate a Database Application Development Environment with Docker
Create a Database Application Development Environment with Docker
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
MySQL Without the SQL -- Oh My!  Longhorn PHP ConferenceMySQL Without the SQL -- Oh My!  Longhorn PHP Conference
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
 

Similar to PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 2019 at Benelux PHP Conference

Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Dave Stokes
 
Develop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPIDevelop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPIDave Stokes
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Dave Stokes
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1Ivan Ma
 
MySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIMySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIRui Quelhas
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsOlivier DASINI
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDave Stokes
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...Olivier DASINI
 
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...Dave Stokes
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming LanguagesS.Shayan Daneshvar
 
MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!Data Con LA
 
Normalizing x pages web development
Normalizing x pages web development Normalizing x pages web development
Normalizing x pages web development Shean McManus
 
Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ishDave Stokes
 
MySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersMySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersFrederic Descamps
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesChristopher Jones
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreOlivier DASINI
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationDave Stokes
 
Crash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesUdita Plaha
 
What should or not be programmed on the web
What should or not be programmed on the  webWhat should or not be programmed on the  web
What should or not be programmed on the webMohammad Kamrul Hasan
 
MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!Dave Stokes
 

Similar to PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 2019 at Benelux PHP Conference (20)

Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019
 
Develop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPIDevelop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPI
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
 
MySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIMySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPI
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern Applications
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQL
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
 
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 
MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!MySQL Without the SQL -- Oh My!
MySQL Without the SQL -- Oh My!
 
Normalizing x pages web development
Normalizing x pages web development Normalizing x pages web development
Normalizing x pages web development
 
Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ish
 
MySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersMySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python Developers
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x Presentation
 
Crash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails Slides
 
What should or not be programmed on the web
What should or not be programmed on the  webWhat should or not be programmed on the  web
What should or not be programmed on the web
 
MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!MySQL Without the MySQL -- Oh My!
MySQL Without the MySQL -- Oh My!
 

More from Dave Stokes

Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021Dave Stokes
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDave Stokes
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationDave Stokes
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesDave Stokes
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsDave Stokes
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesDave Stokes
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsDave Stokes
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturesDave Stokes
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreDave Stokes
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetDave Stokes
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...Dave Stokes
 
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationMySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationDave Stokes
 
MySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database MeetupMySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database MeetupDave Stokes
 
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019Dave Stokes
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Dave Stokes
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Dave Stokes
 
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0Dave Stokes
 

More from Dave Stokes (18)

Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database Analytics
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & Histograms
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
 
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationMySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
 
MySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database MeetupMySQL 8.0 from December London Open Source Database Meetup
MySQL 8.0 from December London Open Source Database Meetup
 
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019
 
Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0Oracle CodeOne Foreign Keys Support in MySQL 8.0
Oracle CodeOne Foreign Keys Support in MySQL 8.0
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobus
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsGlobus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptxGeorgi Kodinov
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 

Recently uploaded (20)

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 

PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 2019 at Benelux PHP Conference

  • 1. PHP, The X DevAPI, and the MySQL Document Store Dave Stokes @Stoker David.Stokes@Oracle.com https://elephantdolphin.blogspot.com/ https://slideshare.net/davidmstokes
  • 2. Safe Harbor Agreement 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, AND TIMING OF ANY FEATURES OR FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE SOLE DISCRETION OF ORACLE. 2
  • 4. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) 4
  • 5. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) 5
  • 6. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) ○ JSON ○ SSH/TLS ○ Encryption ○ Bash & Powershell ○ Markdown ○ Cloud 6
  • 7. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) ○ JSON ○ SSH/TLS ○ Encryption ○ Bash & Powershell ○ Markdown ○ Cloud ○ Debugger ○ Multiple Browsers ○ Multiple IDEs ○ Documentation (still low priority) ○ Mentoring (giving or receiving) ○ More frameworks ○ More third party libraries ○ Embedded, Android, IOS, etc. ○ Key management ○ Slack ○ Repository tools ○ * as a Service (*aaS) ○ Whatever the latest craze is from The Register, Inforworld, Slashdot 7
  • 8. Programmers Tasks ● 20 years ago ○ Editor - vi, vim, emacs ○ Compiler - 1 or two languages ○ Debugger ○ Browser (maybe) ○ XML (maybe) ○ HTML (growing need) ○ Source Control System ○ IDE (you wish!) ○ Documentation (low priority) ● Today ○ GIT ○ Tests ○ CI ○ Small(er) stuff ■ Containers, VMs, micro services, etc. ○ Main language & Framework ○ 7 or 8 JavaScript Frameworks ○ Data Store (SQL & NoSQL) ○ JSON ○ SSH/TLS ○ Encryption ○ Bash & Powershell ○ Markdown ○ Cloud ○ Debugger ○ Multiple Browsers ○ Multiple IDEs ○ Documentation (still low priority) ○ Mentoring (giving or receiving) ○ More frameworks ○ More third party libraries ○ Embedded, Android, IOS, etc. ○ Key management ○ Slack ○ Repository tools ○ * as a Service (*aaS) ○ Whatever the latest craze is from The Register, Inforworld, Slashdot ○ YAML and other markup file syntax ○ The newest Google tool ○ etc 8
  • 9. 9 BTW This was the big concern of 1999!
  • 11. 2% In my not so scientific study over the past eight years using informal informational gathering techniques, roughly TWO PERCENT of developers receive any formal training in Structured Query Language (SQL), Relational Calculus, Data Normalization, or other database technologies. And 100% of that 2% wonder why their queries stink! 11
  • 13. Declarative Language Buried in a OO/Procedural A big problem for many developers is that they are used to Object Oriented and/or Procedural programming languages. SQL is declarative programming language and embedding SQL in PHP is an object- relational impedance mismatch. // Formulate Query // This is the best way to perform an SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'", mysql_real_escape_string($firstname), mysql_real_escape_string($lastname)); // Perform Query $result = mysql_query($query); http://us1.php.net/manual/en/function.mysql-query.php 13 Note: the ‘mysql’ connector has been deprecated and is not supported in PHP 7 and was replaced by ‘mysqli’ but there is still a lot of code with ‘mysql’ around
  • 14. Other Issues 1. UGLY 2. Hard to have help from your IDE 3. Extra level of complexity / opportunity to fail 4. Badly organized data & queries
  • 15. And Yet More Issues ● Relational tables need to be set up ● Indexes ● Data mutability ● Need to rely on a DBA (or someone who has that role) ● Can’t start coding much of project before data format is know ● ORMs -- more complexity and another layer to maintain 15
  • 16. X DevAPI & The MySQL Document Store 16
  • 17. So what if there was a way to ... ● Use schemaless JSON documents so you do not have to normalize data and code before you know the complete schema ● Not have to embed SQL strings in your code ● Use a modern programming style API ● Be able to use the JSON data from SQL or NoSQL - ○ Best of both worlds 17
  • 18. 18
  • 19. The X DevAPI wraps powerful concepts in a simple API. A new high-level session concept enables you to write code that can transparently scale from single MySQL Server to a multiple server environment. →Read operations are simple and easy to understand. →Non-blocking, asynchronous calls follow common host language patterns. →The X DevAPI introduces a new, modern and easy-to-learn way to work with your data. Documents are stored in Collections and have their dedicated CRUD operation set. →Work with your existing domain objects or generate code based on structure definitions for strictly typed languages. →Focus is put on working with data via CRUD operations. →Modern practices and syntax styles are used to get away from traditional SQL-String-Building. 19
  • 20. Scale from Single Server to Cluster w/o Code Change The code that is needed to connect to a MySQL document store looks a lot like the traditional MySQL connection code, but now applications can establish logical sessions to MySQL server instances running the X Plugin. Sessions are produced by the mysqlx factory, and the returned Sessions can encapsulate access to one or more MySQL server instances running X Plugin. Applications that use Session objects by default can be deployed on both single server setups and database clusters with no code changes. 20
  • 21. var mysqlx = require('mysqlx'); // Connect to server on localhost var mySession = mysqlx.getSession( { host: 'localhost', port: 33060, user: 'user', password: 'password' } ); var myDb = mySession.getSchema('test'); // Use the collection 'my_collection' var myColl = myDb.getCollection('my_collection'); // Specify which document to find with Collection.find() and // fetch it from the database with .execute() var myDocs = myColl.find('name like :param').limit(1). bind('param', 'S%').execute(); // Print document print(myDocs.fetchOne()); mySession.close(); 21
  • 22. PECL MySQl X DevAPI http://php.net/manual/en/book.mysql-xdevapi.php 22
  • 23. Installation (Ubuntu 18.04 & PHP 7.2) Note: The MySQL X DevAPI PECL extension is not bundled with PHP. // Dependencies $ apt install build-essential libprotobuf-dev libboost-dev openssl protobuf- compiler // PHP with the desired extensions; php7.2-dev is required to compile $ apt install php7.2-cli php7.2-dev php7.2-mysql php7.2-pdo php7.2-xml // Compile the extension $ pecl install mysql_xdevapi // Use the 'phpenmod' command $ phpenmod -v 7.2 -s ALL mysql_xdevapi 23
  • 24. A JAON document is a data structure composed of key-value pairs and is the fundamental structure for using MySQL as document store. This document shows that the values of keys can be simple data types, such as integers or strings, but can also contain other documents, arrays, and lists of documents. For example, the geography key's value consists of multiple key-value pairs. A JSON document is represented internally using the MySQL binary JSON object, through the JSON MySQL datatype. The most important differences between a document and the tables known from traditional relational databases are that the structure of a document does not have to be defined in advance, and a collection can contain multiple documents with different structures. Relational tables on the other hand require that their structure be defined, and all rows in the table must contain the same columns. { "GNP": .6, "IndepYear": 1967, "Name": "Sealand", "_id": "SEA", "demographics": { "LifeExpectancy": 79, "Population": 27 }, "geography": { "Continent": "Europe", "Region": "British Islands", "SurfaceArea": 193 }, "government": { "GovernmentForm": "Monarchy", "HeadOfState": "Michael Bates" } } 24
  • 25. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 25 An Example
  • 26. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 26 The URI specifies the details of the connection - Protocol - Username - Authentication String - Lost - Port The X Plugin listens at port 33060
  • 27. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 27 1. Connect to the schema ‘testxx’ 2. Create a collection for JSON documents named ‘example1’ 3. Use the collection ‘example1’
  • 28. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 28 Add records to the collection
  • 29. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $marco = [ "name" => "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("testxx"); $collection = $schema->createCollection("example1"); $collection = $schema->getCollection("example1"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); 29 Find the record where the name = ‘Mike’
  • 30. The Emphasis is on CRUD 30 Operation form Description db.name.add() The add() method inserts one document or more documents into the named collection. db.name.find() The find() method returns some or all documents in the named collection. db.name.modify() The modify() method updates documents in the named collection. db.name.remove() The remove() method deletes one document or a list of documents from the named collection. CRUD EBNF Definitions - https://dev.mysql.com/doc/x-devapi-userguide/en/mysql-x- crud-ebnf-definitions.html
  • 32. No more messy strings $SQLQuery = “SELECT * FROM people WHERE job LIKE “ . $job . “AND age > $age”; Versus $collection = $schema- >getCollection("people"); $result = $collection ->find('job like :job and age > :age') ->bind(['job' => 'Butler', 'age' => 16]) ->execute(); 32
  • 33. Easier to read/comprehend than SQL $result = $collection ->remove('age > :age_from and age < :age_to') ->bind(['age_from' => 20, 'age_to' => 50]) ->limit(2) ->execute(); 33 Easy to add filters like SORT, LIMIT, HAVING GROUP BY
  • 34. Indexes on collections $collection->createIndex( 'myindex1', '{"fields": [{ "field": "$.name", "type": "TEXT(25)", "required": true}], "unique": false}' ); 34
  • 35. Got Tables? You can also use the MySQL Document Store with Relational Tables 35
  • 36. Quick Example using a table #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); print_r($row); 36
  • 37. The URI Connection for a Session #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); $row = $result->fetchAll(); print_r($row); 37
  • 38. Get schema and table #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); print_r($row); 38
  • 39. The Query #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://root:hidave@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("world"); $table = $schema->getTable("city"); $row = $table->select('Name','District') ->where('District like :district') ->bind(['district' => 'Texas']) ->limit(25) ->execute()->fetchAll(); ; print_r($row); 39
  • 40. What if I Don’t Want to Rewrite old queries? $session->sql("CREATE DATABASE addressbook")->execute(); 40
  • 41. Okay I can use Collections and Tables BUT WHAT ABOUT BOTH!?!?!?! 41
  • 42. You can also use a Collection as a table! $collection = $schema->getCollection("people"); $table = $schema->getCollectionAsTable("people"); 42
  • 43. #!/bin/php <?php $session = mysql_xdevapigetSession("mysqlx://myuser:mypass@localhost:33060"); if ($session === NULL) { die("Connection could not be established"); } $schema = $session->getSchema("nyeats"); $table = $schema->getTable("restaurants"); $sqlx = "WITH cte1 AS (SELECT doc->>"$.name" AS 'name', doc->>"$.cuisine" AS 'cuisine', (SELECT AVG(score) FROM JSON_TABLE(doc, "$.grades[*]" COLUMNS (score INT PATH "$.score")) as r ) AS avg_score FROM restaurants) SELECT *, rank() OVER (PARTITION BY cuisine ORDER BY avg_score) AS `rank` FROM cte1 ORDER by `rank`, avg_score DESC limit 10"; $row->sql($sqlx)->execute()-fetchAll(); print_r($row); 43 You can also use Windowing Functions for Advanced Analytics
  • 44. One of the advantages of using MySQL as a NoSQL Document store is that you can use SQL analytics on your data! 44
  • 45. Combine CTEs, Windowing Functions, & JSON_TABLE WITH cte1 AS (SELECT doc->>"$.name" AS 'name', doc->>"$.cuisine" AS 'cuisine', (SELECT AVG(score) FROM JSON_TABLE(doc, "$.grades[*]" COLUMNS (score INT PATH "$.score")) as r ) AS avg_score FROM restaurants) SELECT *, rank() OVER (PARTITION BY cuisine ORDER BY avg_score) AS `rank` FROM cte1 ORDER by `rank`, avg_score DESC limit 10 JSON_TABLE turns unstructured JSON documents in to temporary relational tables that can be processed with SQL Windowing Function for analytics Common Table Expression make it easy to write sub-queries 45
  • 46. 46
  • 47. The X Plugin … is a shared object that is installed by default in MySQL 8.0 and must be loaded in 5.7 mysqlsh -u user -h localhost --classic --dba enableXProtocol Or mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so'; It listens on port 33060 so make sure you open firewall for 3306 (old MySQL) and 33060 (X Plugin). And it supports SSL/TLS!!! 47
  • 48. The New MySQL Shell 48 Built In JavaScript and Python interpreters let you work with you data in the MySQL Shell. Plus you get command completion, great help facilities, the ability to check for server upgrades, and the ability to administrate a InnoDB Clusters. And you can also use SQL
  • 49. Built in JSON Bulk Loader 49
  • 50. 50 InnoDB Cluster MySQL InnoDB cluster provides a complete high availability solution for MySQL. Each MySQL server instance runs MySQL Group Replication, which provides the mechanism to replicate data within InnoDB clusters, with built-in failover. AdminAPI removes the need to work directly with Group Replication in InnoDB clusters MySQL Router can automatically configure itself based on the cluster you deploy, connecting client applications transparently to the server instances. Multiple secondary server instances are replicas of the primary. If the primary fails, a secondary is automatically promoted to the role of primary. MySQL Router detects this and forwards client applications to the new primary. Advanced users can also configure a cluster to have multiple-primaries.
  • 51. Questions and Answers plus Additional Resources ● More Info on MySQL Document Store ○ PHP PECL Extension for X DevAPI ■ http://php.net/manual/en/book.mysql-xdevapi.php ○ MySQL Document Store ■ https://dev.mysql.com/doc/refman/8.0/en/document-store.html ○ X DevAPI User Guide ■ https://dev.mysql.com/doc/x-devapi-userguide/en/ ○ Dev.MySQL.com for Downloads and Other Doces ○ X DevAPI Tutorial for Sunshine PHP ■ https://github.com/davidmstokes/PHP-X-DevAPI ● David.Stokes@Oracle.com ○ https://elephantdolphin.blogspot.com/ ○ Slides at https://slideshare.net/davidmstokes ○ @Stoker ○ MySQL & JSON - A Practical Programming Guide 51