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

Cannot order by multiple columns

Open justinsunyt opened this issue 10 months ago • 0 comments

Bug report

Describe the bug

When trying to order multiple columns by using multiple .order() modifiers on a select function, the result only orders by the first column specified.

To Reproduce

Here is my code to get some rows from a table, which is then ordered first by last_chatted and then by created_at.

response = (
    supabase.table("clones")
    .select("*")
    .eq("owner", uid)
    .order("last_chatted", desc=True)
    .order("created_at", desc=True)
    .execute()
)

Expected behavior

The response should be ordered by last_chatted, and then created_at. However, this is not the case and the result is only ordered by last_chatted. I have confirmed that when I only order by last_chatted and created_at separately the code works as expected. I have also confirmed using the sort by visualization on my Supabase dashboard that the chained ordering is different from the result I get.

System information

  • OS: macOS
  • supabase: 2.4.2

Additional context

The same issue was reported in Discord in December, but no GitHub issue was created.

justinsunyt avatar Apr 17 '24 23:04 justinsunyt