3. Percona Live Europe - Dublin 2017
MySQL Document Store - demo
when SQL & NoSQL live together... in peace !
Frédéric Descamps - MySQL Community Manager - Oracle
3 / 33
4.
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purpose 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 up in
making purchasing decisions. The development, release and timing of any features or
functionality described for Oracle´s product remains at the sole discretion of Oracle.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
4 / 33
6. Frédéric Descamps
@lefred
MySQL Evangelist
Hacking MySQL since 3.23
devops believer
MySQL Community Manager since May
2016
living in Belgium 🇧🇪
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
6 / 33
13. Connect and create your first schema
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
13 / 33
14. We need data !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
14 / 33
15. Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
15 / 33
16. Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
We need to dump the data to a file and we will use MySQL Shell with the Python
interpreter to load the data.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
16 / 33
17. Dump and load using MySQL Shell & Python
this example is inspired by @datacharmer's work:
https://www.slideshare.net/datacharmer/mysql-documentstore
$ mongo --quiet --eval 'DBQuery.shellBatchSize=30000;
db.restaurants. nd().shellPrint()'
| perl -pe 's/(?:ObjectId|ISODate)(("[^"]+"))/ $1/g' > all_recs.json
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
17 / 33
18. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
18 / 33
19. Let´s play and query some data !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
19 / 33
20. Syntax slightly different than MongoDB
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
20 / 33
21. Syntax slightly different than MongoDB
> db.restaurants. nd({"cuisine": "French",
"borough": { $not: /^Manhattan/} },
{"_id":0, "name": 1,"cuisine": 1, "borough": 1}).limit(2)
{ "borough" : "Queens", "cuisine" : "French",
"name" : "La Baraka Restaurant" }
{ "borough" : "Queens", "cuisine" : "French",
"name" : "Air France Lounge" }
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
21 / 33
22. Let´s try other CRUD operations
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
22 / 33
23. And what about my old friend SQL ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
23 / 33
27. what do I gain ?
Conclusion
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
27 / 33
28. schemaless
flexible data structure
easy to start (CRUD)
Conclusion
This is the best of the two worlds in one product !
Data integrity
ACID Compliant
SQL
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
28 / 33
29. Do we have still time for something cool ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
29 / 33
30. Let´s do it !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
30 / 33
31. The Challenge
Create a collection of books and add some books with all their data in +/- 5 minutes !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
31 / 33
32. The Challenge
Create a collection of books and add some books with all their data in +/- 5 minutes !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
32 / 33
33. Thank you !
Any Questions ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
33 / 33