mpope9 / nba-sql

:basketball: An application to build an NBA database backed by MySQL, Postgres, or SQLite
Apache License 2.0
171 stars 20 forks source link

Updating with current season mode #104

Open data-rob opened 5 months ago

data-rob commented 5 months ago

I hope someone can point out an error I am making but at the moment when I try to refresh the current season using current-season-mode, I get the error message that I am trying to use it on an uninitialized database.

"Error: option '--current-season-mode' passed on an uninitialized database. First load a season using the '--default-mode' flag!"

I am able to access the database and run queries perfectly fine so I don't understand why it is telling me my database is uninitialized. When I keep all the same info and switch to default-mode, I get an error that there are duplicate keys (because the database already exists). This is the first SQL database that I have created on my own computer so I'm not sure what issue I am having.

mpope9 commented 5 months ago

Did you load all of the tables or just a subset when you ran default season mode?

-------- Original Message -------- On 4 Apr 2024, 3:29 am, data-rob wrote:

I hope someone can point out an error I am making but at the moment when I try to refresh the current season using current-season-mode, I get the error message that I am trying to use it on an uninitialized database.

"Error: option '--current-season-mode' passed on an uninitialized database. First load a season using the '--default-mode' flag!"

I am able to access the database and run queries perfectly fine so I don't understand why it is telling me my database is uninitialized. When I keep all the same info and switch to default-mode, I get an error that there are duplicate keys (because the database already exists). This is the first SQL database that I have created on my own computer so I'm not sure what issue I am having.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

data-rob commented 5 months ago

Did you load all of the tables or just a subset when you ran default season mode?

When I first built the database I didn't skip any tables and I just selected the 2023-2024 season. When I tried to refresh using current-season-mode I tried including every table as well as skipping every table except for player_game_log but both times it told me I was passing it on an uninitialized database. I also tried every table and just the player_game_log with the default-mode but that's when I got the duplicate error message.

mpope9 commented 5 months ago

I am able to successfully refresh my database (SQLite) using:

> DB_NAME="nba" DB_HOST="localhost" DB_USER=nba_sql DB_PASSWORD=nba_sql python stats/nba_sql.py --default-mode --seasons 2023-24 --skip-tables pgtt shot_chart_detail play_by_play player_game_log

> DB_NAME="nba" DB_HOST="localhost" DB_USER=nba_sql DB_PASSWORD=nba_sql python stats/nba_sql.py --current-season-mode
  1. The way we check that a database is already initialized is by querying the season table and getting the latest season. It is possible that this isn't working for you for some reason. Can you run a SELECT * FROM season; and add what it returns?
  2. Are you using the GUI or the commandline?
data-rob commented 5 months ago

I am able to successfully refresh my database (SQLite)

For added context I am using postgres.

  1. The way we check that a database is already initialized is by querying the season table and getting the latest season. It is possible that this isn't working for you for some reason. Can you run a SELECT * FROM season; and add what it returns?

It returns just the season_id as 2023.

2. Are you using the GUI or the commandline?

I am using the GUI from the nba_sql_v0.0.12_windows.exe file.