supabase-py icon indicating copy to clipboard operation
supabase-py copied to clipboard

maybe_single throws error on zero rows

Open FFX3 opened this issue 7 months ago • 1 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

if the query returns zero rows I'd expect the result to be None not an error otherwise I'd use "single" instead.

To Reproduce

run a query that returns no rows with maybe_single()

    response = (
        supabase.schema('infra')
        .rpc('claim_pdf_job', { "worker_token": worker_token })
        .maybe_single()
        .execute()
    )

Expected behavior

I expect to get a None value

Screenshots

Image

System information

  • OS: NixOS
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-py: 2.13.0
  • Version of Node.js: v22.14.0

Additional context

Issue is mentioned here. https://github.com/supabase/supabase-py/issues/511

FFX3 avatar Apr 22 '25 17:04 FFX3

This won't be rectified until a breaking change version of 3.0 of this library as the behavior was changed before and it would be breaking to change it again. You can follow this issue on the postgrest-py repo https://github.com/supabase/supabase-py/issues/1207.

silentworks avatar Apr 22 '25 20:04 silentworks

Hi, I noticed this issue has been assigned for a while. Is it still in progress? I’d be happy to help fix it if available.

manosfaso avatar Jun 25 '25 12:06 manosfaso

@manosfaso read the comment I left above yours. It won't be fixed until we are working on version 3 of this library. This is a long way off.

silentworks avatar Jun 25 '25 13:06 silentworks

Closing this one out as #1207 now lives in this repo.

silentworks avatar Aug 21 '25 15:08 silentworks