tortoise / tortoise/tortoise-orm

json_contains NotImplementedError with SQLite - only works with PostgreSQL

Open
#1,961 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

Describe the bug
Using field__contains on JSONField with SQLite throws NotImplementedError: must be overridden in each executor. Works fine with PostgreSQL but SQLite just crashes.

To Reproduce
https://gist.github.com/zkanda/b6151db1bbe984772be037e431a14604

Expected behavior
Either implement it for SQLite or give a proper error message saying "JSON contains not supported with SQLite". Right now it's just a confusing NotImplementedError.

Additional context

  • Error happens in filters.py:230 where json_contains isn't implemented for SQLite
  • Makes it impossible to write db-agnostic code with JSON fields
  • No docs mention this limitation

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 at filters.py:230 and reproduce the JSONField __contains failure using the linked gist. Determine whether SQLite support or a clear unsupported-feature error is intended, then verify that SQLite no longer exposes the confusing NotImplementedError and that PostgreSQL behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python, sqlite
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.