The document provides an overview of the MySQL Document Store, which allows storing and querying JSON documents within MySQL tables without requiring SQL. It is built on the MySQL JSON data type and X DevAPI. Key features highlighted include the ability to work with both relational tables and document collections together using various programming languages, transactions, and casting collections as tables. The document store is available in MySQL 5.7 and 8 via a plug-in.
MySQL Without the SQL -- Oh My! Longhorn PHP ConferenceDave Stokes
You can now use MySQL without needing to know Structured Query Language (SQL) with the MySQL Document Store. Access JSON documents and/or relational tables using the new X DevAPI
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Dave Stokes
Speeding up queries on a MySQL server with indexes and histograms is not a mysterious art but simple engineering. This presentation is an indepth introduction that was presented on March 30th to the Quest Insynch and Open Source 101 conferences
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
The MySQL Shell has a JavaScript mode where you can use JS libraries to access you data and you can also write (and save) your own custom reports (or programs) for future use.
MySQL Without the SQL -- Oh My! Longhorn PHP ConferenceDave Stokes
You can now use MySQL without needing to know Structured Query Language (SQL) with the MySQL Document Store. Access JSON documents and/or relational tables using the new X DevAPI
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Dave Stokes
Speeding up queries on a MySQL server with indexes and histograms is not a mysterious art but simple engineering. This presentation is an indepth introduction that was presented on March 30th to the Quest Insynch and Open Source 101 conferences
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
The MySQL Shell has a JavaScript mode where you can use JS libraries to access you data and you can also write (and save) your own custom reports (or programs) for future use.
Use Your MySQL Knowledge to Become a MongoDB GuruTim Callaghan
Leverage all of your MySQL knowledge and experience to get up to speed quickly with MongoDB.
Presented at Percona Live London 2013 with Robert Hodges of Continuent.
Tech Talk: Best Practices for Data ModelingScyllaDB
When we think about database performance, data modeling shouldn't be overlooked; the way data is written and retrieved dictates how fast your system can operate. Because Scylla is a non-relational database, its data model focuses on application queries to build the most efficient data structure. Adapting to a new data modeling mindset can be done pragmatically by understanding new database concepts and how they apply to Scylla.
In this webinar you will learn about:
- Scylla data model and basic CQL concepts
- Primary and Clustering key selection
- Collections and User-Defined Types
- Problem finding techniques
Security Best Practice: Oracle passwords, but secure!Stefan Oehrli
Authentication is an integral part of database security. If authentication or passwords are insufficient or inadequate, all further security measures are generally useless. But how do you ensure that passwords are complex and authentication is secure? In this presentation, the password hashes will be explained and it will be shown how to make sure passwords and authentication are state of the art. Focusing on the current versions of the Oracle database, the following topics will be discussed:
- Oracle database authentication
- Password verification and hashes
- Where can I find password hashes?
- Check and password hashes.
- Discussion of various risks related to authentication.
- Discussion of password policies and strong passwords.
- Customer Use Case in the DB Vault environment "ups we have forgotten the passwords".
The presentation will be supplemented by corresponding examples and live demos.
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
Slow query? Add an index or two! But things are suddenly even slower! Indexes are great tools to speed data lookup but have overhead issues. Histograms don’t have that overhead but may not be suited. And how you lock rows also effects performance. So what do you do to speed up queries smartly? This is a clear, detailed look at what you can do to really speed up your queries in a logical, orthogonal process. Updated Presentation for Longhorn PHP Conference October 14th, 2021
This presentation is an overview of things all IT management team needs to consider before upgrading to Oracle Database 12c and were presented in a webinar: bit.ly/1yzSdsd
Oracle ACE Director Dan Morgan was a 12c beta tester and is intimately familiar with changes in architecture and how they will impact existing infrastructure and planning and budgeting considerations.
In 2015, most organizations will begin to migrate to the latest version of Oracle Database 12c, but few are aware of the challenges to management, planning and budgeting that need to be addressed before executing such a project. Dan Morgan presents what needs to be considered and shares a few tips about 12c new features.
If you have any questions regarding your future Oracle migrations and upgrades, feel free to visit Performance Tuning Corporation at www.perftuning.com
Validating JSON -- Percona Live 2021 presentationDave Stokes
JSON is a free form data exchange format which can cause problems when combined with a strictly typed relational database. Thanks to the folks at https://json-schema.org and the MySQL engineers at Oracle we can no specify required fields, type checks, and range checks.
Couchbase Overview - Monterey Bay Information Technologists Meetup 02.15.17Aaron Benton
Couchbase Server is a NoSQL document database with a distributed architecture for performance, scalability, and availability. It enables developers to build applications easier and faster by leveraging the power of SQL with the flexibility of JSON.
Aaron Benton is an Applications Architect at SHOP.COM. He has used Couchbase in a number of different applications and will share his experience with the product.
SwanseaCon 2017 presentation on Making MySQL Agile-ish. Relational Databases are not usually considered part of the Agile Programming movement but there are many new features in MySQL to make it easier to include it. This presentation covers how MySQL is moving to help support agile development while maintaining the traditional 'non agile' stability expected from a database.
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...Dave Stokes
MySQL Document Store allows you to use MySQL as a JSON Document Databases without needing to set up relational tables, normalize data, or use Structured Query Language.
Use Your MySQL Knowledge to Become a MongoDB GuruTim Callaghan
Leverage all of your MySQL knowledge and experience to get up to speed quickly with MongoDB.
Presented at Percona Live London 2013 with Robert Hodges of Continuent.
Tech Talk: Best Practices for Data ModelingScyllaDB
When we think about database performance, data modeling shouldn't be overlooked; the way data is written and retrieved dictates how fast your system can operate. Because Scylla is a non-relational database, its data model focuses on application queries to build the most efficient data structure. Adapting to a new data modeling mindset can be done pragmatically by understanding new database concepts and how they apply to Scylla.
In this webinar you will learn about:
- Scylla data model and basic CQL concepts
- Primary and Clustering key selection
- Collections and User-Defined Types
- Problem finding techniques
Security Best Practice: Oracle passwords, but secure!Stefan Oehrli
Authentication is an integral part of database security. If authentication or passwords are insufficient or inadequate, all further security measures are generally useless. But how do you ensure that passwords are complex and authentication is secure? In this presentation, the password hashes will be explained and it will be shown how to make sure passwords and authentication are state of the art. Focusing on the current versions of the Oracle database, the following topics will be discussed:
- Oracle database authentication
- Password verification and hashes
- Where can I find password hashes?
- Check and password hashes.
- Discussion of various risks related to authentication.
- Discussion of password policies and strong passwords.
- Customer Use Case in the DB Vault environment "ups we have forgotten the passwords".
The presentation will be supplemented by corresponding examples and live demos.
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
Slow query? Add an index or two! But things are suddenly even slower! Indexes are great tools to speed data lookup but have overhead issues. Histograms don’t have that overhead but may not be suited. And how you lock rows also effects performance. So what do you do to speed up queries smartly? This is a clear, detailed look at what you can do to really speed up your queries in a logical, orthogonal process. Updated Presentation for Longhorn PHP Conference October 14th, 2021
This presentation is an overview of things all IT management team needs to consider before upgrading to Oracle Database 12c and were presented in a webinar: bit.ly/1yzSdsd
Oracle ACE Director Dan Morgan was a 12c beta tester and is intimately familiar with changes in architecture and how they will impact existing infrastructure and planning and budgeting considerations.
In 2015, most organizations will begin to migrate to the latest version of Oracle Database 12c, but few are aware of the challenges to management, planning and budgeting that need to be addressed before executing such a project. Dan Morgan presents what needs to be considered and shares a few tips about 12c new features.
If you have any questions regarding your future Oracle migrations and upgrades, feel free to visit Performance Tuning Corporation at www.perftuning.com
Validating JSON -- Percona Live 2021 presentationDave Stokes
JSON is a free form data exchange format which can cause problems when combined with a strictly typed relational database. Thanks to the folks at https://json-schema.org and the MySQL engineers at Oracle we can no specify required fields, type checks, and range checks.
Couchbase Overview - Monterey Bay Information Technologists Meetup 02.15.17Aaron Benton
Couchbase Server is a NoSQL document database with a distributed architecture for performance, scalability, and availability. It enables developers to build applications easier and faster by leveraging the power of SQL with the flexibility of JSON.
Aaron Benton is an Applications Architect at SHOP.COM. He has used Couchbase in a number of different applications and will share his experience with the product.
SwanseaCon 2017 presentation on Making MySQL Agile-ish. Relational Databases are not usually considered part of the Agile Programming movement but there are many new features in MySQL to make it easier to include it. This presentation covers how MySQL is moving to help support agile development while maintaining the traditional 'non agile' stability expected from a database.
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...Dave Stokes
MySQL Document Store allows you to use MySQL as a JSON Document Databases without needing to set up relational tables, normalize data, or use Structured Query Language.
Data Con LA 2020
Description
MySQL is an ubiquitous relational database that can also be used as a NoSQL JSON document store. That means you do not need a DBA to set up tables - just connect and start saving data. And you can access the NoSQL data from the SQL side or the SQL data from the NoSQL side which gives you the best of both the SQL and NoSQL worlds on the same server.
*Learn how to use the X DevAPI protocol for CRUD based operations
*See how to use JSON_TABLE() to turn unstructured data temporarily structured
*Understand how JSON really makes your relational database faster
*How to extract JSON data into a relational column
Speaker
Dave Stokes,Oracle, MySQL Community Manager
Polyglot Database - Linuxcon North America 2016Dave Stokes
Many Relation Databases are adding NoSQL features to their products. So what happens when you can get direct access to the data as a key/value pair, or you can store an entire document in a column of a relational table, and more
MySQL Document Store -- SCaLE 17x PresentationDave Stokes
The MySQL Document store is a way to use MySQL as a NoSQL JSON Document Store so that you do not need to make queries with SQL, avoid having to set up relational tables before using the data, or need to wait for a DBA to set up tab;es
MySQL Without the SQL - Oh My! -> MySQL Document Store -- Confoo.CA 2019Dave Stokes
MySQL an be used as a NoSQL JSON Document Store as well as its well known ability as a SQL Relational Data Base. This presentation covers why you would want to use NoSQL and JSON and how to combine it what the relational data you already have
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...Dave Stokes
This presentation from the January 2019 Benelux PHP conference and covers use of the MySQL Document Store via the X DevAPI so that MySQL can used as a NoSQL JSON Document store as wells as a relational database, providing the best of both works
Python And The MySQL X DevAPI - PyCaribbean 2019Dave Stokes
This presentation covers how to use the MySQL X DevAPI with the Python Programming Language, presented at the first PyCaribbean Conference, Santo Domino February 16th 2019
All Things Open 2016 -- Database Programming for NewbiesDave Stokes
This presentation covers much a new developer needs to know about working WITH a database instead of against it. Plus there is much on what goes on behind the scenes when you submit a query and hints on how to avoid the big problems that can ruin your data
Starting with MySQL 5.7.12 we introduced a new plugin to use MySQL as a Document Store. This presentation gives an overview of current features and plans going forward.
MySQL Document Store - A Document Store with all the benefts of a Transactona...Olivier DASINI
MySQL Document Store allows developers to work with SQL relational tables and schema-less JSON collections. To make that possible MySQL has created the X Dev API which puts a strong focus on CRUD by providing a fluent API allowing you to work with JSON documents in a natural way. The X Protocol is a highly extensible and is optimized for CRUD as well as SQL API operations.
Couchbase Data Platform | Big Data DemystifiedOmid Vahdaty
Couchbase is a popular open source NoSQL platform used by giants like Apple, LinkedIn, Walmart, Visa and many others and runs on-premise or in a public/hybrid/multi cloud.
Couchbase has a sub-millisecond K/V cache integrated with a document based DB, a unique and many more services and features.
In this session we will talk about the unique architecture of Couchbase, its unique N1QL language - a SQL-Like language that is ANSI compliant, the services and features Couchbase offers and demonstrate some of them live.
We will also discuss what makes Couchbase different than other popular NoSQL platforms like MongoDB, Cassandra, Redis, DynamoDB etc.
At the end we will talk about the next version of Couchbase (6.5) that will be released later this year and about Couchbase 7.0 that will be released next year.
Database basics for new-ish developers -- All Things Open October 18th 2021Dave Stokes
Do you wonder why it takes your database to find the top five of your fifty six million customers? Do you really have a good idea of what NULL is and how to use it? And why are some database queries so quick and others frustratingly slow? Relational databases have been around for over fifty years and frustrating developers for at least forty nine of those years. This session is an attempt to explain why sometimes the database seems very fast and other times not. You will learn how to set up data (normalization) to avoid redundancies into tables by their function, how to join two tables to combine data, and why Structured Query Language is so very different than most other languages. And you will see how thinking in sets over records can greatly improve your life with a database.
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
MySQL 8.0 has many new features that you probably need to know about but don't. Like default security, window functions, CTEs, CATS (not what you think), JSON_TABLE(), and UTF8MB4 support.
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDave Stokes
Slides from the 2021 Dutch PHP Conference on MySQL Indexes, histograms, and other things to speed up your database queries. Speeding up your database queries is mainly learning how to efficiently give the query optimizer what is needs to provide the best query plan for your data.
Data Love Conference - Window Functions for Database AnalyticsDave Stokes
16 April 2021 presentation for the Data Love Conference on Window Functions for Data Base Analytics. Examples are on MySQL but will work for other RDMS's with window functions. Assumes no user background on window functions or analytics
Confoo.ca conference talk February 24th 2021 on MySQL new features found in version 8.0 including server and supporting utility updates for those who may have missed some really neat new features
Confoo 2021 - MySQL Indexes & HistogramsDave Stokes
Confoo 2021 presentation on MySQL Indexes, Histograms, and other ways to speed up your queries. This slide deck has slides that may not have been included in the presentation that were omitted due to time constraints
A Step by Step Introduction to the MySQL Document StoreDave Stokes
Looking for a fast, flexible NoSQL document store? And one that runs with the power and reliability of MySQL. This is an intro on how to use the MySQL Document Store
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...Dave Stokes
Slow query? Add an index or two! But things are suddenly even slower! Indexes are great tools to speed data lookup but have overhead issues. Histograms don’t have that overhead but may not be suited. And how you lock rows also effects performance. So what do you do to speed up queries smartly?
MySQL New Features -- Sunshine PHP 2020 PresentationDave Stokes
MySQL has moved to a quarterly release cycle and it can be hard to keep up with the new features. For instance, there are now multi-valued indexes for things like JSON arrays to allow for fast searches of embedded data. And there is a bulk loaded for JSON, CSV, and TSV data that works in parallel. Or support for JSON-Schame.org's JSON schema validation. Plus you no longer need to run mysql_upgrade after an upgrade as that is all automated. In addition, you can now clone InnoDB tablespaces for fast initialization of replicate data. So if you need to catch up on the latest and greatest from MySQL you need to be in this session.
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBrad Spiegel Macon GA
Brad Spiegel Macon GA’s journey exemplifies the profound impact that one individual can have on their community. Through his unwavering dedication to digital inclusion, he’s not only bridging the gap in Macon but also setting an example for others to follow.
Gen Z and the marketplaces - let's translate their needsLaura Szabó
The product workshop focused on exploring the requirements of Generation Z in relation to marketplace dynamics. We delved into their specific needs, examined the specifics in their shopping preferences, and analyzed their preferred methods for accessing information and making purchases within a marketplace. Through the study of real-life cases , we tried to gain valuable insights into enhancing the marketplace experience for Generation Z.
The workshop was held on the DMA Conference in Vienna June 2024.
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC
Ellisha Heppner, Grant Management Lead, presented an update on APNIC Foundation to the PNG DNS Forum held from 6 to 10 May, 2024 in Port Moresby, Papua New Guinea.
Instagram has become one of the most popular social media platforms, allowing people to share photos, videos, and stories with their followers. Sometimes, though, you might want to view someone's story without them knowing.
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfFlorence Consulting
Quattordicesimo Meetup di Milano, tenutosi a Milano il 23 Maggio 2024 dalle ore 17:00 alle ore 18:30 in presenza e da remoto.
Abbiamo parlato di come Axpo Italia S.p.A. ha ridotto il technical debt migrando le proprie APIs da Mule 3.9 a Mule 4.4 passando anche da on-premises a CloudHub 1.0.
Understanding User Behavior with Google Analytics.pdfSEO Article Boost
Unlocking the full potential of Google Analytics is crucial for understanding and optimizing your website’s performance. This guide dives deep into the essential aspects of Google Analytics, from analyzing traffic sources to understanding user demographics and tracking user engagement.
Traffic Sources Analysis:
Discover where your website traffic originates. By examining the Acquisition section, you can identify whether visitors come from organic search, paid campaigns, direct visits, social media, or referral links. This knowledge helps in refining marketing strategies and optimizing resource allocation.
User Demographics Insights:
Gain a comprehensive view of your audience by exploring demographic data in the Audience section. Understand age, gender, and interests to tailor your marketing strategies effectively. Leverage this information to create personalized content and improve user engagement and conversion rates.
Tracking User Engagement:
Learn how to measure user interaction with your site through key metrics like bounce rate, average session duration, and pages per session. Enhance user experience by analyzing engagement metrics and implementing strategies to keep visitors engaged.
Conversion Rate Optimization:
Understand the importance of conversion rates and how to track them using Google Analytics. Set up Goals, analyze conversion funnels, segment your audience, and employ A/B testing to optimize your website for higher conversions. Utilize ecommerce tracking and multi-channel funnels for a detailed view of your sales performance and marketing channel contributions.
Custom Reports and Dashboards:
Create custom reports and dashboards to visualize and interpret data relevant to your business goals. Use advanced filters, segments, and visualization options to gain deeper insights. Incorporate custom dimensions and metrics for tailored data analysis. Integrate external data sources to enrich your analytics and make well-informed decisions.
This guide is designed to help you harness the power of Google Analytics for making data-driven decisions that enhance website performance and achieve your digital marketing objectives. Whether you are looking to improve SEO, refine your social media strategy, or boost conversion rates, understanding and utilizing Google Analytics is essential for your success.
Italy Agriculture Equipment Market Outlook to 2027harveenkaur52
Agriculture and Animal Care
Ken Research has an expertise in Agriculture and Animal Care sector and offer vast collection of information related to all major aspects such as Agriculture equipment, Crop Protection, Seed, Agriculture Chemical, Fertilizers, Protected Cultivators, Palm Oil, Hybrid Seed, Animal Feed additives and many more.
Our continuous study and findings in agriculture sector provide better insights to companies dealing with related product and services, government and agriculture associations, researchers and students to well understand the present and expected scenario.
Our Animal care category provides solutions on Animal Healthcare and related products and services, including, animal feed additives, vaccination
2. Safe
Harbor
Agreement
2
"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."
6. Developers
and DBAs
see data
differently
6
mysql-js> db.countryinfo.find("_id='USA'")
[
{
"GNP": 8510700,
"IndepYear": 1776,
"Name": "United States",
"_id": "USA",
"demographics": {
"LifeExpectancy": 77.1,
"Population": 278357000
},
"geography": {
"Continent": "North America",
"Region": "North America",
"SurfaceArea": 9363520
},
"government": {
"GovernmentForm": "Federal Republic",
"HeadOfState": "George W. Bush"
}
}
]
1 document in set (0.01 sec)
mysql-js>
7. Developers Developers have a much more complex job compared to a
decade ago
7
▪ Start coding first, design later (ready, fire, aim!)
▪ Scope Creep, Mission Creep
▪ New flashy tech pushed down from Management
▪ New flashy tech pushed to keep resume current
▪ Legacy code
▪ Learning curve (ever steepening)
▪ Continuous fire fighting
8. DBAs
(& Devops)
DBAs have a much more complex job compared to a decade
ago
8
▪ Keep data safe
▪ Stability
▪ CI
▪ Flexibility
▪ Regulations & policies for data retention
▪ Maximize uptime (no window for maintenance)
▪ Ripple changes that never end
▪ More demands , less $$$
▪ Relational model fits so many business needs
9. Structed Query
Language
1. Descriptive Language
2. DML and DDL
3. Requires:
a. Knowledge of sets
b. Knowledge of the data
4. Hard to tell if a query is
good just by looking at it
1. No ‘gut feeling’ about query
2. EXPLAIN
9
SQL was designed in the 1970s to
minimize data duplication (disks were
very expensive) and allows the access
of many records in one command
without have to specify how to get to
it.
10. 10
Roughly 2% of
developers have
formal training in
SQL, Relational
Theory, or sets(my survey)
And 100%
of the rest
wonder
why their
queries
stink!
11. ORMs
Developers might
use a Object
Relation Mapper
to map between
RDMS and
objects in code.
Extra layer of
confusion.
Extra inclination
on learning
curve.
11
12. How do you
provide for both sets
of needs?
12
What if there was a
way to provide both
SQL and NoSQL
on one stable
platform that has
proven stability on
well known
technology?
14. Built on the
MySQL
JSON Data
type
and
Proven
MySQL
Server
Technology
Provides a schema flexible JSON document store
No SQL required
No need to define all possible attributes, tables, etc.
Uses new X DevAPI
MySQL 5.7 & 8
Can leverage generated columns to extract JSON values into
materialized columns that can be indexed for fast SQL searches.
Documents can be ~1GB
It is a column in a row of a table
Allows use of modern programming styles
No more embedded strings of SQL in your code
Easy to read
Also works with relational tables
Proven MySQL Technology
14
15. X DevAPI • Connectors for
• C++, Java, .Net, Node.JS, Python, JavaScript,
PHP
• More on the way
• New MySQL Shell
• Command Completion
• Python, JavaScript & SQL modes
• Admin functions
• A new high-level session concept that can scale
from single MySQL Server to a multiple server
environment.
• Non-blocking, asynchronous calls follow common
language patterns
• Modern practices and syntax styles are used to get away
from traditional SQL-String-Building
15
16. MySQL
Document
Store
Installation
mysqlsh -u user -h localhost --classic --dba enableXProtocol
OR
$mysql –u root –p
mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so‘ ; *
16* .dll for windows instead of .so
17. mysqlsh
17
▪ New command line
client built on X
DevAPI (old client is
not going away
anytime soon).
▪ Visually appealing
▪ Command
Completion
▪ Three modes
- Python
- JavaScript
- SQL
18. Login with
MySQL
Shell
18
MySQL Shell 8.0.5
Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help' or '?' for help; 'quit' to exit.
MySQL JS> connect root@localhost/world_x
Creating a session to 'root@localhost/world_x'
Enter password: ******
Your MySQL connection id is 4 (X protocol)
Server version: 5.7.21-log MySQL Community Server (GPL)
Default schema `world_x` accessible through db.
Fetching schema names for auto-completion... Press ^C to stop.
MySQL [localhost+/world_x] JS>
27. Python
import mysqlx
# Connect to server on localhost
session = mysqlx.get_session({
'host': 'localhost',
'port': 33060,
'user': 'dave',
'password': 'S3cR3T!',
'ssl-mode' : mysqlx.SSLMode.DISABLED #Remove this line if SSL enabled
})
schema = session.get_schema('world_x')
# Use the collection 'countryinfo'
collection = schema.get_collection('countryinfo')
# Specify which document to find with Collection.find()
result = collection.find('_id like :param').bind('param',
'USA').execute()
# Print document
docs = result.fetch_all()
print('id: {0}'.format(docs[0]['Name']))
27
28. Node.JS
// Simple example to grab one record and print it
const mysqlx = require('@mysql/xdevapi');
const options = {
host: 'localhost', port: 33060, dbUser: 'dave', dbPassword:
'S3cR3t!!'
};
mysqlx
.getSession(options)
.then (session => {
var schema = session.getSchema('world_x');
//equivalent of SELECT doc FROM countryinfo where _id = 'USA'
var coll = schema.getCollection('countryinfo');
var query = "$._id == 'USA'";
// Print doc
return Promise.all([
coll.find(query).execute(function (doc) {
console.log(doc);
}),
session.close()
]);
})
.catch(err => {
console.log(err.message);
console.log(err.stack);
});
28
29. PHP
#!/usr/bin/php
<?PHP
// Connection parameters
$user = 'dave';
$passwd = 'S3cR3t!';
$host = 'localhost';
$port = '33060';
$connection_uri = 'mysqlx://'.$user.':'.$passwd.'@'.
$host.':'.$port;
echo $connection_uri . "n";
// Connect as a Node Session
$nodeSession =
mysql_xdevapigetNodeSession($connection_uri);
// "USE world_x"
$schema = $nodeSession->getSchema("world_x");
// Specify collection to use
$collection = $schema->getCollection("countryinfo");
// Query the Document Store
$result = $collection->find('_id = "USA"')->fields(['Name
as Country','geography as Geo','geography.Region'])-
>execute();
// Fetch/Display data
$data = $result->fetchAll();
var_dump($data);
?>
29
31. What does a
collection
look like on
the server?
mysql> DESC countryinfo;
+-------+-------------+------+-----+---------+------------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+------------------+
| doc | json | YES | | NULL | |
| _id | varchar(32) | NO | PRI | NULL | STORED GENERATED |
+-------+-------------+------+-----+---------+------------------+
2 rows in set (0.02 sec)
mysql> show create table countryinfoG
*************************** 1. row ***************************
Table: countryinfo
Create Table: CREATE TABLE `countryinfo` (
`doc` json DEFAULT NULL,
`_id` varchar(32) GENERATED ALWAYS AS
(json_unquote(json_extract(`doc`,'$._id))) STORED NOT
NULL,
PRIMARY KEY (`_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
31
32. Every document has a unique identifier called the document
ID, which can be thought of as the equivalent of a tables'
primary key. The document ID value can be manually
assigned when adding a document. If no value is assigned, a
document ID is generated and assigned to the document
automatically!
Use getDocumentId() or getDocumentIds() to get _id(s)
32
_id
33. You can also
use the
JavaScript or
Python
modes to
process code
// Connecting to MySQL and working with a Session
var mysqlx = require('mysqlx');
// Connect to a dedicated MySQL server using a connection URL
var mySession = mysqlx.getSession(‘acct:spE!@localhost');
// Get a list of all available schemas
var schemaList = mySession.getSchemas();
print('Available schemas in this session:n');
// Loop over all available schemas and print their name
for (index in schemaList) {
print(schemaList[index].name + 'n');
}
mySession.close();
33
35. Yes, the
MySQL
Document
Store can
work with
relational
tables too!
# Working with Relational Tables
import mysqlx
# Connect to server using a connection URL
mySession = mysqlx.get_session( {
'host': 'localhost', 'port': 33060,
'dbUser': ‘joe', 'dbPassword': ‘ZipL1p!'} )
myDb = mySession.get_schema('test')
# Accessing an existing table
myTable = myDb.get_table('my_table')
# Insert SQL Table data
myTable.insert(['name','birthday','age'])
.values('Sakila', mysqlx.date_value(2000, 5, 27), 16).execute()
# Find a row in the SQL Table
myResult = myTable.select(['_id', 'name', 'birthday'])
.where('name like :name AND age < :age')
.bind('name', 'S%')
.bind('age', 20).execute()
# Print result
print myResult.fetch_all()
35
36. But what about relational tables and
collections together? Eh, Dave?
Huh, huh, huh?
36
37. But what about relational tables and
collections together? Eh, Dave?
Huh, huh, huh?
37
38. // Get the customers collection as a table
var customers = db.getCollectionAsTable('customers');
customers.insert('doc').values('{"_id":"001", "name": "mike"}').execute();
38
You can cast a collection as a table
39. import com.mysql.cj.api.xdevapi.*;
import com.mysql.cj.xdevapi.*;
// Connect to server
Session mySession = new SessionFactory().getSession("mysqlx://10.10.10.192:33060/test?user=betty12;password=Hush!");
Schema db = mySession.getSchema("test");
// Create a new collection
Collection myColl = db.createCollection("my_collection");
// Start a transaction
this.session.startTransaction();
try {
myColl.add("{"name":"Jack", "age":15}", "{"name":"Susanne", "age":24}",
"{"name":"Mike", "age":39}");
this.session.commit();
System.out.println("Data inserted successfully.");
} catch (Exception err) {
// Rollback the transaction in case of an error
this.session.rollback();
// Printing the error message
System.out.println("Data could not be inserted: " + err.getMessage());
}
39
Transactions!
41. Hello!
Nice to meet you
41
Contact info:
▪ www.mysql.com
▪ David.Stokes@Oracle.com
▪ @Stoker
▪ Slides:slideshare.net/davidmstokes
▪ Blog: Elephantdolphin.blogspot.com
▪ Book in preperation now