Update import_players.py
Fix error handling for player import
This commit is contained in:
parent
e1ce3ceed5
commit
2c8d13d357
@ -19,7 +19,7 @@ def main(argv):
|
||||
all_players = []
|
||||
|
||||
for row in reader:
|
||||
if row[0] != 'sba-id':
|
||||
if 'sba' not in row[0]:
|
||||
all_players.append({
|
||||
'name': clean_name(row[3]),
|
||||
'fg_id': row[2],
|
||||
@ -29,7 +29,7 @@ def main(argv):
|
||||
'hand': row[5]
|
||||
})
|
||||
|
||||
# TODO: will want to update this to check for existing reocrd; get_or_create ?
|
||||
# TODO: will want to update this to check for existing record; get_or_create ?
|
||||
with db.atomic():
|
||||
for batch in chunked(all_players, 50):
|
||||
Player.insert_many(batch).on_conflict_ignore().execute()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user