Skip to content

There doesn't seem to be a way to check the difference between null and 'null' in the is() filter #557

@AdamGEmerson

Description

@AdamGEmerson

Describe the bug

It seems that when using .is(), there is no way to query for string literals that say "null".

In the supabase js library, this is the given example for is():

DB

create table
  countries (id int8 primary key, name text);

insert into
  countries (id, name)
values
  (1, 'null'),
  (2, null);

Query

const { data, error } = await supabase
  .from('countries')
  .select()
  .is('name', null)

Response

{
  "data": [
    {
      "id": 1,
      "name": "null"
    }
  ],
  "status": 200,
  "statusText": "OK"
}

This behavior cannot be replicated in the python library because rather than substituting None for the js keyword null, the python library uses the string 'null' to check for nullness in the database.

Replicating this in the python library gives a different result, row 2.

data, count = supabase.table('countries') \
  .select('*') \
  .is_('name', 'null') \
  .execute()
('data', [{'id': 2, 'name': None}])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions