Book Image

Mastering RethinkDB

By : Shaikh
Book Image

Mastering RethinkDB

By: Shaikh

Overview of this book

RethinkDB has a lot of cool things to be excited about: ReQL (its readable,highly-functional syntax), cluster management, primitives for 21st century applications, and change-feeds. This book starts with a brief overview of the RethinkDB architecture and data modeling, and coverage of the advanced ReQL queries to work with JSON documents. Then, you will quickly jump to implementing these concepts in real-world scenarios, by building real-time applications on polling, data synchronization, share market, and the geospatial domain using RethinkDB and Node.js. You will also see how to tweak RethinkDB's capabilities to ensure faster data processing by exploring the sharding and replication techniques in depth. Then, we will take you through the more advanced administration tasks as well as show you the various deployment techniques using PaaS, Docker, and Compose. By the time you have finished reading this book, you would have taken your knowledge of RethinkDB to the next level, and will be able to use the concepts in RethinkDB to develop efficient, real-time applications with ease.
Table of Contents (11 chapters)

Data import and export in RethinkDB


RethinkDB provides the facility to dump existing data either coming from traditional databases such as MySQL and MSSQL in a suitable format, that is, CSV or JSON, or freshly generated JSON documents.

In Chapter 3, Data Exploration Using RethinkDB, we used the import utility to dump a JSON file consisting of 1,000 documents directly into a table. In this section, we are going to refresh the import utility.

Here is the command:

rethinkdb import -f <file path> --table <Database name>.<table name>

You can also specify the port options and other configuration; for more information, please visit Chapter 3, Data Exploration Using RethinkDB.

Let's look at a few use cases where we can really make use of the import utility.

Importing data from MySQL to RethinkDB

MySQL is no doubt one of the most popular and widely used SQL database engines, and is used by giants such as Facebook and Google. If you want to switch your stack from MySQL to RethinkDB, you...