tortoise / tortoise/tortoise-orm

Is it possible to put NULLS at the end for descending ordering?

Open
#788 0 comments 3 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

Hi guys!

is it possible to ORDER BY DESC NULLS LAST with Tortoise?
I'm using Postresql and it places NULLS at the beginning of a descending sort order.
Unfortunately, I need another behaviour but didn't find how to that with Tortoise.

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

No file, test, or entry point is named. Start by reproducing descending ordering with NULL values in PostgreSQL, then trace how Tortoise expresses ordering and generates SQL. Done means Tortoise can request descending order with NULLS LAST and the behavior is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.