inspired by the football-to-sqlite tool  I have put together
the big brother / sister football-to-psql  tool that - surprise,
surprise - lets you load / read football.txt match datafiles (e.g.
English Premier League, German Bundesliga, Spanish La Liga 2020/21,
etc.) into a postgreSQL database.
$ football-to-psql --help
Usage: football-to-psql [options] DATABASE PATHS... -u, --username USERNAME database username (default: postgres) -p, --password PASSWORD database password (default: postgres) -h, --host HOST database host (default: localhost)
Run this tool against match files in the Football.TXT format like so:
$ football-to-psql england.db 2020-21\1-premierleague.txt
or pass in more than one match file:
$ football-to-psql england.db 2020-21\1-premierleague.txt \ 2020-21\2-championship.txt \ 2020-21\3-league1.txt \ 2020-21\4-league2.txt \ 2020-21\5-nationalleague.txt
Note: If the PostgreSQL database (and its tables, views &
indices) do not (yet) exist, they get auto-created on the first run.
Note: You can use football2psq as an alias / alternate name.
**Pipes & Standard Input (STDIN)**
You can use any command line tool to download match files and pipe
(via stdin) into this tool like so:
$ curl https://raw.githubusercontent.com/openfootball/world-cup/master/2018--russia/cup.txt > football-to-psql worldcup.db
That's it for now. Enjoy the beautiful game with ruby (and
postgreSQL). Cheers. Prost.