cp .env.example .envPython 3.10 or newer is required.
Please follow the steps on their website: https://python-poetry.org/docs/#installation
poetry installThere is two ways to run the project:
Via Poetry CLI
poetry run python src/main.pyVia virtual env
Activate virtual env (only once per terminal):
source .venv/bin/activateThen use python directly:
python src/main.pySetup local database (optional)
# Create the database using docker compose
make
# Apply migrations
alembic upgrade headIt'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
start.gg addrState in France
Auvergne-Rhône-AlpesBourgogne-Franche-ComtéBretagneCentre-Val de LoireGrand EstHauts-de-FranceÎle-de-France,IDFNormandieNouvelle-AquitaineOccitaniePays de la LoireProvence-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 --allAlembic
# Get information
alembic current/history
# Create a new migration
alembic revision --autogenerate -m "message"
# Apply migration
alembic upgrade head
# Downgrade migration
alembic downgrade -1