louking / rrwebapp

Race Results Web Application
0 stars 1 forks source link

import results: load empty file integrity error #500

Closed louking closed 3 years ago

louking commented 3 years ago

to reproduce:

2021-07-06 16:11:10,984 ERROR:Traceback (most recent call last):
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1687, in _execute_context
    cursor, statement, parameters, context
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\dialects\mysql\mysqldb.py", line 148, in do_executemany
    rowcount = cursor.executemany(statement, parameters)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 239, in executemany
    self.rowcount = sum(self.execute(query, arg) for arg in args)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 239, in <genexpr>
    self.rowcount = sum(self.execute(query, arg) for arg in args)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
    res = self._query(query)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
    db.query(q)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\connections.py", line 259, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`scoretilitytest`.`managedresult`, CONSTRAINT `managedresult_ibfk_3` FOREIGN KEY (`runnerid`) REFERENCES `runner` (`id`))')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\rrwebapp\views\admin\results.py", line 1315, in post
    db.session.flush()
  File "<string>", line 2, in flush
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3255, in flush
    self._flush(objects)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3395, in _flush
    transaction.rollback(_capture_exception=True)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
    with_traceback=exc_tb,
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\util\compat.py", line 211, in raise_
    raise exception
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3355, in _flush
    flush_context.execute()
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 453, in execute
    rec.execute(self)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 667, in execute
    uow,
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 345, in delete_obj
    delete,
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 1441, in _emit_delete_statements
    statement, del_objects, execution_options=execution_options
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1521, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\sql\elements.py", line 314, in _execute_on_connection
    self, multiparams, params, execution_options
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1400, in _execute_clauseelement
    cache_hit=cache_hit,
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1750, in _execute_context
    e, statement, parameters, cursor, context
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1931, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\util\compat.py", line 211, in raise_
    raise exception
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1687, in _execute_context
    cursor, statement, parameters, context
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\sqlalchemy\dialects\mysql\mysqldb.py", line 148, in do_executemany
    rowcount = cursor.executemany(statement, parameters)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 239, in executemany
    self.rowcount = sum(self.execute(query, arg) for arg in args)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 239, in <genexpr>
    self.rowcount = sum(self.execute(query, arg) for arg in args)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
    res = self._query(query)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
    db.query(q)
  File "c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\lib\site-packages\MySQLdb\connections.py", line 259, in query
    _mysql.connection.query(self, query)
sqlalchemy.exc.IntegrityError: (MySQLdb._exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`scoretilitytest`.`managedresult`, CONSTRAINT `managedresult_ibfk_3` FOREIGN KEY (`runnerid`) REFERENCES `runner` (`id`))')
[SQL: DELETE FROM runner WHERE runner.id = %s]
[parameters: ((4603,), (4606,), (4607,), (4608,), (4612,), (4613,), (4616,), (4617,)  ... displaying 10 of 26 total bound parameter sets ...  (4642,), (4643,))]
(Background on this error at: http://sqlalche.me/e/14/gkpj)