Saberizing a Mac #4: Pitch f/x Database
A few weeks ago, vivaelpujols posted an article with the goal of getting a Pitch f/x database set up on a Mac. Since then, there have been over 150 comments added to the discussion and it appears we're pretty close to succeeding. A big thanks goes to Mike Fast, who's solved and defined a lot of the problems, but a number of newbies have been slaving away with testing, too.
Anyways, if you know anything about scripts, databases, or Macs, we could use your help. And if you're looking to try your hand at pitch f/x, the entire thread is worth a read, as a growing resource.
2 months ago
Sky Kalkman
11 comments
1 recs |
Comments
I don't have a Mac...
…but all of the components needed to run the Baseball on a Stick software (Python, MySQL) are available on that platform. The documentation and some of the ancilliary things are Windows-specific, but something could probably be worked out.
by cwyers on Sep 9, 2009 11:57 AM EDT reply actions 0 recs
I have a Mac...
…and I’ve downloaded BOS onto my Mac and I’ve gone ahead and downloaded Python 2.5.2 as well. I have followed along with Sky’s tutorial and I’m running MAMP and Sequel Pro.
With BOS downloaded, I got very excited. I could see the light. Since I have little to no idea what I’m doing from here, I opened up the Install.txt file located in the bos/doc directory. Looks like there are some useful directions here but they are for the Windows platform.
I have a few questions:
- Do I need to download and install mySQLdb for Python 2.5 if I already have Sequel Pro and MAMP running? Furthermore, it says I can run another mySQL server if I’m not running on Windows (which I’m not) so I figure that is what MAMP is for, correct?
- How do I
Prepare the database to hold game information by running \BBOS\bin\install.batI am assuming I need to either use my Terminal or Python. Not sure which Python icon I need to run if that’s the way to go.
Basically, I need a translator who can speak Mac-anese or understands the nuts and bolts to point me in the right direction. It seems as if I’m really really close. Colin, what do you think?
by habetw4 on Sep 9, 2009 12:37 PM EDT up reply actions 0 recs
The batch files won't work.
Which is fine, because they don’t actually do anything but execute command prompt commands.
You’re going to have to edit the config file, is the big thing – I’d like to help walk you through it, but I’m not at home so I can’t actually look at the config file.
by cwyers on Sep 9, 2009 12:49 PM EDT up reply actions 0 recs
So thats what bat means
Okay. I wonder if we can convert the command prompt commands into Terminal commands.
Which one is the config file?
by habetw4 on Sep 9, 2009 12:55 PM EDT up reply actions 0 recs
I'm following along, trying to get my PFX stuff together and I'd like to thank you guys for all your work and patience.
"Of course Kolby Rasmus was going deep! That’s what Kolby Rasmus does! You don’t give Kolby Rasmus second chances!" -Kolby Rasmus
by hazel on Sep 10, 2009 11:42 AM EDT reply actions 0 recs
Question/Help -- Retrosheet data on the Apple
My brother and I made a .sql download of the entire retrosheet database (and daily downloads of Pitch F/X). We had someone download .sql of the retrosheet data and they are running into memory issues. The entire retrosheet dataset it ~10 gigs when it expands and he claims there is plenty of room on his computer. Can someone test the download on a Mac and see if it works for them. If it does or doesn’t can you let us know the error and .sql gui/interface you are using. Thanks.
Jeff Zimmerman - Protecting the world from RBI's and Wins from my mom's guest house.
by Jeff Zimmerman (TucsonRoyal) on Sep 10, 2009 1:42 PM EDT reply actions 0 recs
What is he doing when he gets memory issues? Those are large tables and when running queries it wouldn’t surprise me to see it eat up lots of memory.
by cwyers on Sep 10, 2009 2:04 PM EDT up reply actions 0 recs
installing the .sql
Here is the exact comment from user:
After downloading the retrosheet.sql.gz onto my Mac, it decompressed the file, and I tried to import it into my Sequel Pro but it reads “The file "retrosheet.sql" could not be opened because it is too large.” How should I solve this problem?
Jeff Zimmerman - Protecting the world from RBI's and Wins from my mom's guest house.
by Jeff Zimmerman (TucsonRoyal) on Sep 10, 2009 2:35 PM EDT up reply actions 0 recs
I don't know how Sequel Pro handles it...
…but there should be an option called something like “Restore from SQL Dump” or somesuch that should work instead.
by cwyers on Sep 10, 2009 3:07 PM EDT up reply actions 0 recs
Sequel Pro
The way I typically bring in a database is selecting “Add Database” from the Database menu, name it, and then click on “Import…” from the file menu. I have a GameDay database that I got from Tango’s wiki and BB databank in there already using that import method. Those are smaller, I believe, than the Retrosheet 4.59 GB file I’m trying to import.
I don’t see another way to bring in a database but someone may be using another method that I don’t know about.
I’m curious if anyone has successfully imported Jeff’s Retrosheet database into Sequel Pro.
by habetw4 on Sep 10, 2009 4:29 PM EDT reply actions 0 recs
Sequel Pro is just a front end, right?
You should be able to talk to MySQL directly, to wit:
/Users/caledonia> ls-l retrosheet.sql.gz
-rw-r—r— 1 caledonia admin 416527259 17 Sep 17:51 retrosheet.sql.gz
/Users/caledonia> gunzip retrosheet.sql.gz
/Users/caledonia> ls-l retrosheet.sql
-rw-r—r— 1 caledonia admin 4927743578 17 Sep 17:51 retrosheet.sql
/Users/caledonia> /usr/local/mysql/bin/mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.38-log Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> SHOW DATABASES;
-————————-
| Database |
-————————-
| information_schema |
| mysql |
| pbp |
| test |
-————————-
4 rows in set (0.42 sec)
mysql> CREATE DATABASE retrosheet;
Query OK, 1 row affected (0.13 sec)
mysql> USE retrosheet
Database changed
mysql> SOURCE /Users/caledonia/retrosheet.sql;
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.09 sec)
Query OK, 0 rows affected (0.03 sec)
Query OK, 0 rows affected (0.03 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.16 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 1818 rows affected (2.11 sec)
Records: 1818 Duplicates: 0 Warnings: 0
Query OK, 1820 rows affected (1.81 sec)
Records: 1820 Duplicates: 0 Warnings: 0
[Four hours later…]
Query OK, 1321 rows affected (0.09 sec)
Records: 1321 Duplicates: 0 Warnings: 0
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.06 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW TABLES;
-—————————————
| Tables_in_retrosheet |
-—————————————
| events |
| games |
| id |
| lkup_cd_bases |
| lkup_cd_battedball |
| lkup_cd_event |
| lkup_cd_fld |
| lkup_cd_h |
| lkup_cd_hand |
| lkup_cd_park_daynight |
| lkup_cd_park_field |
| lkup_cd_park_precip |
| lkup_cd_park_sky |
| lkup_cd_park_wind_direction |
| lkup_cd_recorder_method |
| lkup_cd_recorder_pitches |
| lkup_id_base |
| lkup_id_home |
| lkup_id_last |
| parkcode |
| rosters |
| teams |
-—————————————
22 rows in set (0.12 sec)
mysql> SELECT * FROM teams;
-———————--—————————--—————-
| YEAR_ID | TEAM_ID | LG_ID | LOC_TEAM_TX | NAME_TEAM_TX |
-———————--—————————--—————-
| 1911 | BOS | A | Boston | Red |
| 1911 | CHA | A | Chicago | White |
| 1911 | CLE | A | Cleveland | Indians |
| 1911 | DET | A | Detroit | Tigers |
| 1911 | NYA | A | New York | Highlanders |
| 1911 | PHA | A | Philadelphia | Athletics |
[Etc.]
1321 rows in set (0.10 sec)
It wouldn’t surprise me if there were a much better way to go about this, but it did work. I presume that from this point there’s a way to make Sequel Pro aware of the new database.
Case studies quote patients reporting a sensation of "giving way," a "bursting noise" or "sudden explosion."
by Caledonia on Sep 17, 2009 10:44 PM EDT up reply actions 0 recs









BtB on Facebook

















