Archive for category Baseball Data

Pitch FX mysql database with pitch type

As always please help me with my bandwidth costs for this data. Just buy me a beer. Thanks,

2007-2009 Pitch FX database in mysql

I have went through this year and reworked the import scripts from Mike Fast and especially the mysql database to make the import faster much much much faster with indexes. It was taking over 5 minutes to import a game in 2009 with all the previous data in the database, and now it takes 30 seconds at most. I fixed games that had data errors, and made sure they imported. There is alot of time and effort that goes into this import with my brother bugging me to scripting it, to my brother bugging me, to testing, to my brother bugging me. It really isn’t that bad, but some times it feels like it. The import is up to 151MB compressed so we might have to look at splitting this up by year in the future or something. Ideas? I will only be releasing one file from now on for the Pitch fx MySQL database import is named pbp2.sql. Here is the reworked file that gets updated daily.

Please would also like to know when the 2009 data from retrosheet is out so I can import that data, and maybe rework the output. I have have hear people wanting it out by 10 or 20 years spans. I can do it I just would like to know that people will use it before I do it.

Download Pitch F/X Database here

Here is how it is all done. I have 4 scripts that run a night
1. hack_4day.pl

  • Downloads files from MLB for only the last 4 days to speed up the import.
  • Deletes files older then 4 days.

2. hack_pbp2.pl

  • Downloads all files from MLB to make sure I have a full set of xml files to use if needed.

3. 2009.pl

  • Imports the xml files that are downloaded by the hack_4day.pl script into the pitch fx mysql database.
  • Deletes each games xml files to keep the process clean as to only store one set of xml files and one set of records in the pitch fx mysql database

4. update_db_with_count.pl

  • Updates db with counts on the pitches. great script.

All the scripts are available on the downloads page

22 Comments

Mysql MLB Pitch FX data


Pitch FX data from 2007 to current.

Please help with bandwidth costs for this download by donating.


I have imported all the pitch f x data from mlb.com for 2007, to current date using Fastballs wordpress site.  It is available in a mysql export.  Please let me me know if you have any questions, or issues with this download. Please comment and I will get back with you.  If you are looking for game data please check out the retrosheet database I have made available for download  here.


UPDATE 10/23/2009

I have re-imported everything since 2007 up to today, and have it available for download. I will be removing the pbp.sql files, and only going forward with the pbp2.sql which is the pitchfx with pitch type. I should have this done by the time baseball is over. :( Let me know if you have any questions. I fixed a couple of games that had hit errors where a runner didn’t reach base the system didn’t know what to do with that, so I used a sledge hammer to get rid of the no base runner hit errors. It could also be data import errors but who knows.

Thanks,

Darrell

70 Comments

Retrosheet Baseball Mysql database download

2009 is out, and the database is disassembled by decade for the 1950′s, 1960′s, 1970′s, 1980′s, 1990′s, and 2000′s. You can also download the full thing also.  Check out the links below.

Please help me with my bandwidth costs or just buy me a beer.

I have compiled the Retrosheet Baseball Data into a mysql database using Tangotiger.net’s Wiki. I was asked to do this for my brother, and I figured that the rest of the baseball community might not want have a brother as technically savvy. Please feel free to download the 400 MB file in .gz format. I am a Linux man sorry all you people wanting zip there are plenty of programs that will allow you to extraxt .gz file. Once you unzip the file from it’s 400 MB size to it’s 4.9 GB flat file size you will need to import it with the following command.
mysql -uusername -ppassword -hlocalhost retrosheet < retrosheet.sql
Or something of that nature depending on your setup.

I am allowing you to download this database for free with the asking that you help my bandwidth cost by donating below.

Click Here to download the Full Retrosheet database .
Click Here to download the 1950′s Retrosheet database.
Click Here to download the 1960′s Retrosheet database.
Click Here to download the 1970′s Retrosheet database.
Click Here to download the 1980′s Retrosheet database.
Click Here to download the 1990′s Retrosheet database.
Click Here to download the 2000′s Retrosheet database.
Click Here to download the 2010′s Retrosheet database.
Click Here to download the last 10 years Retrosheet database.

Check out my Pitch FX download page also.

16 Comments