learningequality / learningequality/studio

IntegrityError: FOREIGN KEY constraint failed

Open
#3,234 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P1 - important TODO: needs reproduced
Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

Sentry Issue: STUDIO-ED1

IntegrityError: FOREIGN KEY constraint failed
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/backends/sqlite3/base.py", line 423, in execute
    return Database.Cursor.execute(self, query, params)

IntegrityError: FOREIGN KEY constraint failed
(14 additional frame(s) were not displayed)
...
  File "django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/backends/sqlite3/base.py", line 423, in execute
    return Database.Cursor.execute(self, query, params)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Django SQLite execution path in django/db/backends/sqlite3/base.py and the wrapper in django/db/backends/utils.py. The report does not identify the application operation or foreign-key relationship involved, so trace the caller beyond these frames and reproduce the failure. Done means the violating operation is identified and covered by a verified fix or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python, sqlite
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.