sabersql是一个工具,用于从各种源中收集棒球数据并将其导入mysql数据库。
sabersql的Python项目详细描述
sabersql
sabersql是一个软件工具,可以帮助从Retrosheet(可以追溯到 到1903年)和BaseballSavant,以及关于球员、裁判员和经理的信息 (通过Chadwick Baseball Bureau Register)。这些数据可以是 导入到mysql数据库,允许您对超过一个世纪的数据进行自定义查询。
安装
要求
要使sabersql工作,您必须已经安装了MySQL Community Server 以及Chadwick。mysql的安装非常简单,而且 安装chadwick的优秀指南 here。
安装sabersql
要安装:
pip3 install sabersql
用法
要下载所有数据并将其导入数据库,只需使用以下命令:
sabersql [path] -u [username] -p [password] -a [address] -s [schema]
其中:
- path是计算机上应存储下载数据的目录(截至2019年5月,所有数据 总共约18GB)
- username是mysql数据库的用户
- password是用户对mysql数据库的密码
- address是mysql数据库的网络地址
可选参数
--download
-只从web下载数据而不导入它(mysql数据库信息可以
然后省略)
--import
-仅导入数据(假设数据已下载)
-y [year]
-仅下载和/或导入特定年份的数据
--retrosheet
-仅下载和/或导入追溯表数据
--statcast
-仅下载和/或导入BaseBallSavant数据
--people
-仅下载和/或导入播放器、裁判员和管理器数据
--undo
-撤消命令
注释
- 如果命令多次运行,则不会重新下载或导入数据。此外,一个进程将恢复
如果重新启动,则从它停止的位置开始。
- 这些过程并不快。下载和导入所有数据需要很多小时。
模式
--download
-只从web下载数据而不导入它(mysql数据库信息可以
然后省略)
--import
-仅导入数据(假设数据已下载)
-y [year]
-仅下载和/或导入特定年份的数据
--retrosheet
-仅下载和/或导入追溯表数据
--statcast
-仅下载和/或导入BaseBallSavant数据
--people
-仅下载和/或导入播放器、裁判员和管理器数据
--undo
-撤消命令
数据库的结构是五个表:person,pitch,event,game,和 sub。
person
Each entry in this table represents someone who was a player, umpire, and/or manager.
pitch
Each entry in this table represents a pitch recorded by BaseballSavant. Descriptions of each field can be found here。
event
Each entry in this table represents an event that Chadwick processed from Retrosheet data. Descriptions of each field can be found here。
game
Each entry in this table represents a game that Chadwick processed from Retrosheet data. Descriptions of each field can be found here。
sub
Each entry in this table represents a substitution in a game that Chadwick processed from Retrosheet data. Descriptions of each field can be found here。
许可证
版权所有2019 William Stevenson
兹免费向任何获得本软件及相关软件副本的人授予许可 文档文件(“软件”),无限制地处理软件,包括但不限于 使用、复制、修改、合并、发布、分发、再授权和/或销售软件副本的权利,以及 在满足以下条件的情况下,向其提供软件的人员:
上述版权通知和本许可通知应包含在 软件。
软件按“原样”提供,无任何明示或暗示的保证,包括但不限于 保证适销性,适合特定用途和不侵权。在任何情况下,作者或 无论是在合同诉讼、侵权诉讼或 否则,由本软件或本软件的使用或其他交易引起的,由本软件引起的,或与本软件有关的。