Skip to content

I Could not register for a new user. It is giving me a integrity error. Could you please help me out? #2

@SnehaMadhuriPulagam

Description

@SnehaMadhuriPulagam

Image

IntegrityError
MySQLdb.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (malaria_db.user, CONSTRAINT user_ibfk_1 FOREIGN KEY (user_type) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE)')

Traceback (most recent call last)
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\flask\app.py", line 1536, in call
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\flask\app.py", line 1514, in wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\flask\app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\flask\app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\flask\app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\flask\app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\app.py", line 118, in register
cur.execute("INSERT INTO user(name,cnic,speciality,email,username,password) VALUES(%s,%s,%s,%s,%s,%s)",(name,cnic,speciality,email,username,password))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
^^^^^^^^^^^
File "C:\Users\Dell\Malaria-Identification-System\venv\Lib\site-packages\MySQLdb\connections.py", line 265, in query
_mysql.connection.query(self, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MySQLdb.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (malaria_db.user, CONSTRAINT user_ibfk_1 FOREIGN KEY (user_type) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE)')
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions