Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Checking null on nullable Json fields does not work as expected #1074

@cbelsole

Description

@cbelsole

Bug description

Where not null does not work on json fields as you would expect.

How to reproduce

prisma.TestJson.find_many(
  where={"jsonField": {"not": None}},
)

This function throws an error:

Task run failed with exception: MissingRequiredValueError('Unable to match input value to any allowed input type for the field. Parse errors: [`where.jsonField.not`: A value is required but not set, `where.jsonField.not`: A value is required but not set, `where.jsonField.not`: A value is required but not set]')

Additionally, this where clause will not work {"jsonField": {"not": {"equals": None}}}.

This is the only where clause we found to work: {"jsonField": {"not": Json(None)}}.

Expected behavior

I expect when you say {"jsonField": None} or {"jsonField": {"not": None}} in Prisma that it acts accordingly.

Prisma information

model TestJson {
    id        Int @id @default(autoincrement())
    jsonField Json?
}

Environment & setup

  • OS: Mac: 14.5 (23F79)
  • Database: Postgres 16
  • Python version: 3.12
  • Prisma version:
prisma                  : 5.17.0
prisma client python    : 0.15.0
platform                : darwin
expected engine version : 393aa359c9ad4a4bb28630fb5613f9c281cde053
installed extras        : []
install path            : `~/projects/project/package/.venv/lib/python3.12/site-packages/prisma
binary cache dir        : ~/.cache/prisma-python/binaries/5.17.0/393aa359c9ad4a4bb28630fb5613f9c281cde053

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