Baseball and Databases

Converting the MySQL dump to SQLite3 file

Here are two scripts:
runme.sh
mysql2sqlite.sh

The scripts:

REQUIRES: sqlite3, perl, curl, unzip, bash

USAGE:
./runme.sh

Be sure to chmod these files to make them executable

chmod +x runme.sh
chmod +x mysql2solite.sh

Basically the runme.sh shell script fetches the data from the web and unzips it, and then passes it off to the script that does the conversion.

curl -O http://www.baseball-databank.org/files/BDB-sql-2008-03-28.sql.zip
unzip BDB-sql-2008-03-28.sql.zip
./mysql2sqlite.sh BDB-sql-2008-03-28.sql | sqlite3 baseball.db

The conversion script uses perl to modify the format of the files from mysql to sqlite3.