djrscally / pubg_reporting

Tools to create and maintain a reporting db syncing to the pubg API
GNU General Public License v3.0
2 stars 1 forks source link

missing database/create_db.sql #4

Closed TTAbwill closed 4 years ago

TTAbwill commented 4 years ago

There is no file called database/create_db.sql.

djrscally commented 4 years ago

@TTAbwill this went through a significant number of changes, including now using an ORM rather than raw SQL. Unfortunately I haven't gotten round to tidying up the documentation to explain that yet; I'll try and get round to it. If you want to use it, you now need to create the following environment variables:

PUBGDB_CONFIG_PATH holding a path to config.json (NOT including the file name, so for example C:\Users\dscally\Documents\dev\pubg_reporting\) defining which players you want to sync, in this format:

{
    "players":["player1_name", "player2_name"]
}

PUBG_API_KEY holding your API key PUBGDB_HOST holding the address to a MySQL server PUBGDB_DATABASE holding the name of the db you want to use on the MySQL server PUBGDB_USERNAME holding the username of the MySQL user to connect to the DB PUBGDB_PASSWORD holding the password for the above MySQL user

You should then be able to just run python sync.py - that script will automatically create the database tables, which is why create_db.sql no longer exists.

TTAbwill commented 4 years ago

@djrscally Thanks for explaning. I got the database schema.

Running sync.py results in a set of xbox seasons in database. After i changed shard in pubg_api.py from "xbox-eu" to "pc-eu" i got the pc seasons. The script still runs without any log in sync.log or output in console.

Is it because of API restrictions and i only need to wait?

Thanks in advance!

djrscally commented 4 years ago

@TTAbwill Yeah the chap this was designed for is playing on xbox. I should make the shard come from the config file too really. I'll stick that on the list.

The script doesn't log anything by default because the log level is set to WARNING. If you want output to sync.log, run with python sync.py --log-level INFO (or DEBUG if you want to see absolutely freaking everything, it gets very verbose). If you want the output to console, run python sync.py --echo. The options can be combined if you want both.

djrscally commented 4 years ago

OK, tidied up the README so it's clear how this is currently working.

TTAbwill commented 4 years ago

Pretty awesome how fast you reply. Thank you so much.

There is a little mistake in api.py line 45: logging.debug("upsert_players: upserting {0]".format(player['attributes']['name'])) after replacing with: logging.debug("upsert_players: upserting {0}".format(player['attributes']['name'])) it works for me.

djrscally commented 4 years ago

No problem, and good spot; thank you - I fixed it.