Skip to content

About

Fetches sets from start.gg and saves them into a postgreSQL database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SmashGG Exporter

Start the project

Create and populate .env file

cp .env.example .env

Install dependencies

Install Python

Python 3.10 or newer is required.

Install Poetry

Please follow the steps on their website: https://python-poetry.org/docs/#installation

Install project dependencies with Poetry

poetry install

Run the project

There is two ways to run the project:

Via Poetry CLI
poetry run python src/main.py
Via virtual env

Activate virtual env (only once per terminal):

source .venv/bin/activate

Then use python directly:

python src/main.py

Usage

Setup local database (optional)
# Create the database using docker compose
make

# Apply migrations
alembic upgrade head

It's ready on url: postgresql+psycopg2://postgres:postgres@localhost:5555/smashgg-exporter

main.py
$ python src/main.py --help

usage: main.py [-h] [--startDate STARTDATE] [--endDate ENDDATE] [--countryCode COUNTRYCODE] [--addrState ADDRSTATE] [--gameId GAMEID]

Fetches sets from start.gg and saves them into a postgres database

options:
  -h, --help            show this help message and exit
  --startDate STARTDATE
                        fetch from startDate DD-MM-YYYY (default: 01-01-2025)
  --endDate ENDDATE     fetch up to endDate DD-MM-YYYY (default: 01-04-2025)
  --countryCode COUNTRYCODE
                        CountryCode of the tournament, can be set to `None` (default: FR)
  --addrState ADDRSTATE
                        AddrState of the tournament, can be set to `None` (default: IDF)
  --gameId GAMEID       ID of the game (default: 1386, i.e. Smash Ultimate)
export_db_to_csv.py
$ python src/export_db_to_csv.py --help

usage: export_db_to_csv.py [-h] [--startDate STARTDATE] [--endDate ENDDATE] [--countryCode COUNTRYCODE] [--addrState ADDRSTATE] [--outSuffix OUTSUFFIX] [--gameId GAMEID]

Fetches sets from database and saves them in a local csv

options:
  -h, --help            show this help message and exit
  --startDate STARTDATE
                        fetch from startDate DD-MM-YYYY (default: 01-01-2025)
  --endDate ENDDATE     fetch up to endDate DD-MM-YYYY (default: 01-04-2025)
  --countryCode COUNTRYCODE
                        CountryCode of the tournament, can be set to `None` (default: FR)
  --addrState ADDRSTATE
                        AddrState of the tournament, can be set to `None` (default: IDF)
  --outSuffix OUTSUFFIX
                        csv output filename to `output/{timestamp}-{outSuffix}.csv` (default: `output/{timestamp}.csv`)
  --gameId GAMEID       ID of the game (default: 1386, i.e. Smash Ultimate)
find_game_id.py
$ python src/find_game_id.py --help

usage: find_game_id.py [-h] gameName

Take a string and search for GameID in start.gg database

positional arguments:
  gameName    Game name to search for (e.g. "Smash Ultimate", "Tekken", ...)

options:
  -h, --help  show this help message and exit

Misc

start.gg addrState in France
  • Auvergne-Rhône-Alpes
  • Bourgogne-Franche-Comté
  • Bretagne
  • Centre-Val de Loire
  • Grand Est
  • Hauts-de-France
  • Île-de-France, IDF
  • Normandie
  • Nouvelle-Aquitaine
  • Occitanie
  • Pays de la Loire
  • Provence-Alpes-Côte d'Azur

⚠️ IDF and Île-de-France behave like two different addrState and have to be fetched separately

Poetry
# Clear Poetry cache
poetry cache clear --all .

# Delete all virtual environments
poetry env remove --all
Alembic
# Get information
alembic current/history

# Create a new migration
alembic revision --autogenerate -m "message"

# Apply migration
alembic upgrade head

# Downgrade migration
alembic downgrade -1

About

Fetches sets from start.gg and saves them into a postgreSQL database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages