Loading from RDBMS

As the final recipe on loading, let's try to load data from an RDBMS data source, which is MySQL in our case. This recipe assumes that you have already installed MySQL in your machine.

How to do it…

Let's go through the prerequisite steps first. If you already have a MySQL table to play with, you can safely ignore this step. We are just going to create a new database and a table and load some sample data into it.

The prerequisite step (optional):

  1. Creating a database and a table: This is achieved in MySQL by using the create database and the create table DDL:
    create database scalada;
    
    use scalada
    CREATE TABLE student (
    id varchar(20),
    `name` varchar(200),
    phone varchar(50),
    email varchar(200),
    PRIMARY KEY (id));
  2. Loading data into the ...

Get Scala Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.