Ted Lawless

Now Publishing Complete Lahman Baseball Database with Datasette

12-03-17

Summary: The Datasette API available at https://baseballdb.lawlesst.net now contains the full Lahman Baseball Database.

In a previous post, I described how I'm using Datasette to publish a subset of the Lahman Baseball Database. At that time, I only published three of the 27 tables available in the database. I've since expanded that Datasette API to include the complete Baseball Database.

The process for this was quite straightforward. I ran the MySQL dump Lahman helpfully provides through this mysql2sqlite tool to provide an import file for sqlite. Importing into sqlite for publishing with Datasette was as simple as:

$ ./mysql2sqlite lahman2016.sql | sqlite3 baseball.db

The complete sqlite version of the Lahman database is 31 megabytes.

Querying

With the full database now loaded, there are many more interesting queries that can be run. Including:

Happy querying. If you are using this in a project or interested in learning more, leave a comment below or contact me directly.