sportdb-readers - sport.db readers for leagues, seasons, clubs, match schedules and results, and more
- home :: github.com/sportdb/sport.db
- bugs :: github.com/sportdb/sport.db/issues
- gem :: rubygems.org/gems/sportdb-readers
- rdoc :: rubydoc.info/gems/sportdb-readers
- forum :: opensport
Setup the (SQL) database. Let's use and build a single-file SQLite database (from scratch), as an example:
require 'sportdb/readers' SportDb.connect( adapter: 'sqlite3', database: './england.db' ) SportDb.create_all ## build database schema (tables, indexes, etc.)
Let's read in some leagues, seasons, clubs, and match schedules and results.
Let's use the public domain football.db datasets for England (see
openfootball/england), as an example:
## turn on logging to console ActiveRecord::Base.logger = Logger.new( STDOUT ) ## assumes football.db datasets for England in ./england directory ## see github.com/openfootball/england SportDb::ConfReaderV2.read( './england/2015-16/.conf.txt' ) SportDb::MatchReaderV2.read( './england/2015-16/1-premierleague-i.txt' ) SportDb::MatchReaderV2.read( './england/2015-16/1-premierleague-ii.txt' ) ## let's try another season SportDb::ConfReaderV2.read( './england/2019-20/.conf.txt' ) SportDb::MatchReaderV2.read( './england/2019-20/1-premierleague.txt' )
All leagues, seasons, clubs, match days and rounds, match fixtures and results, and more are now in your (SQL) database of choice.
Or as an alternative use the
read convenience all-in-one shortcut helper:
## assumes football.db datasets for England in ./england directory ## see github.com/openfootball/england SportDb.read( './england/2015-16/.conf.txt' ) SportDb.read( './england/2015-16/1-premierleague-i.txt' ) SportDb.read( './england/2015-16/1-premierleague-ii.txt' ) ## let's try another season SportDb.read( './england/2019-20/.conf.txt' ) SportDb.read( './england/2019-20/1-premierleague.txt' )
Or as an alternative pass in the "package" directory and let
out what datafiles to read:
## assumes football.db datasets for England in ./england directory ## see github.com/openfootball/england SportDb.read( './england' )
sportdb-readers scripts are dedicated to the public domain.
Use it as you please with no restrictions whatsoever.
Send them along to the Open Sports & Friends Forum/Mailing List. Thanks!