Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate primary key entry in template_copies #65

Open
JosephSemrai opened this issue Dec 26, 2019 · 0 comments
Open

Duplicate primary key entry in template_copies #65

JosephSemrai opened this issue Dec 26, 2019 · 0 comments

Comments

@JosephSemrai
Copy link
Contributor

Upon trying to upload a CSV file under 50 lines and viewing it using visualizedata, I encounter the following error involving a duplicate primary key entry in the template_copies table.

This was reproduced by following the directions on the README file and restoring the database dump.

Traceback

MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry '1' for key 'PRIMARY'")

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

Traceback (most recent call last):
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\josep\Anaconda3\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\josep\Documents\GitHub\TensorMap\tensormap-server\app\resources\template_manipulation.py", line 358, in createExperiment
    db.session.commit()
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\scoping.py", line 162, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\session.py", line 1027, in commit
    self.transaction.commit()
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\session.py", line 494, in commit
    self._prepare_impl()
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\session.py", line 473, in _prepare_impl
    self.session.flush()
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\session.py", line 2470, in flush
    self._flush(objects)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\session.py", line 2608, in _flush
    transaction.rollback(_capture_exception=True)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\util\langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py", line 153, in reraise
    raise value
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\session.py", line 2568, in _flush
    flush_context.execute()
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 422, in execute
    rec.execute(self)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 589, in execute
    uow,
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\persistence.py", line 245, in save_obj
    insert,
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\orm\persistence.py", line 1084, in _emit_insert_statements
    c = cached_connections[connection].execute(statement, multiparams)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute
    return meth(self, multiparams, params)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\sql\elements.py", line 287, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py", line 1107, in _execute_clauseelement
    distilled_params,
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py", line 1253, in _execute_context
    e, statement, parameters, cursor, context
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py", line 1473, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py", line 398, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py", line 152, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py", line 1249, in _execute_context
    cursor, statement, parameters, context
  File "C:\Users\josep\Anaconda3\lib\site-packages\sqlalchemy\engine\default.py", line 580, in do_execute
    cursor.execute(statement, parameters)
  File "C:\Users\josep\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 209, in execute
    res = self._query(query)
  File "C:\Users\josep\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 315, in _query
    db.query(q)
  File "C:\Users\josep\Anaconda3\lib\site-packages\MySQLdb\connections.py", line 239, in query
    _mysql.connection.query(self, query)
sqlalchemy.exc.IntegrityError: (MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry '1' for key 'PRIMARY'")
[SQL: INSERT INTO template_copies (id, `fileName`, data) VALUES (%s, %s, %s)]
[parameters: ('1', 'user_keras_temp.py', b'import tensorflow as tf\r\nfrom tensorflow import keras\r\nfrom tensorflow.keras import layers\r\nimport numpy as np\r\nfrom sklearn.metrics import  ... (837 characters truncated) ... nt("MAE: ",mae)\r\n\r\nwith open("results.csv", "w") as f:\r\n    writer = csv.writer(f)\r\n    writer.writerows(zip(y_test,predictions))\r\n\r\n\r\n')]
(Background on this error at: http://sqlalche.me/e/gkpj)```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant