New football-to-psql build tool - load / read football.txt match datafiles (e.g. English Premier League, German Bundesliga, Spanish La Liga, etc.) into a postgreSQL database

24 views
Skip to first unread message

Gerald Bauer

unread,
Oct 28, 2020, 8:04:53 AM10/28/20
to open...@googlegroups.com
Hello,

inspired by the football-to-sqlite tool [1] I have put together
the big brother / sister football-to-psql [2] 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.

Usage. Try:

```
$ football-to-psql --help
```

printing:

```
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 postgreSQL. Cheers. Prost.


[1] https://github.com/sportdb/football.db/tree/master/football-to-sqlite
[2] https://github.com/sportdb/football.db/tree/master/football-to-psql
Reply all
Reply to author
Forward
0 new messages