Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 1.77 KB

README.md

File metadata and controls

76 lines (52 loc) · 1.77 KB

Running a MySQL Server Container with Test Data

This directory contains a Dockerfile that builds a Docker image derived the MySQL Server 8.0 image. It includes SQL programs that popularize the following datasets:

  1. Churn from Kaggle
  2. Irises classfication from TensorFlow

We can run a Docker container of it for unit testing.

Build the SQLFlow Data Image

cd example/datasets
docker build -t sqlflow:data .

Run a SQLFlow Data Container

docker run --rm -d --name sqlflowdata \
   -p 3306:3306 \
   -e MYSQL_ROOT_PASSWORD=root \
   -e MYSQL_ROOT_HOST=% \
   sqlflow:data

Popularize Datasets

Popularize the databases and tables with commands below:

docker exec -it sqlflowdata bash

To popularize the Churn dataset into churn:

cat /popularize_churn.sql | mysql -uroot -proot

To popularize the Irises dataset into iris:

cat /popularize_iris.sql | mysql -uroot -proot

To prepare database for storing machine learning models:

echo "CREATE DATABASE IF NOT EXISTS sqlflow_models;" | mysql -uroot -proot

Test a Query

In the container, run below command to test if tables exist.

echo "select count(*) from churn.test;" | mysql -uroot -proot

It should print the number of rows as the following:

count(*)
10

Troubleshooting

  1. It usually takes about 15 seconds to bring up the MySQL Server. If you try to connect it before that, you may see the following error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

After commands executes successfully and data are popularized, go back to Installation page.