Skip to content

Conversation

@jerrinot
Copy link
Contributor

@jerrinot jerrinot commented Dec 30, 2024

Implements QuestDB's LIMIT clause in SQLAlchemy dialect. Key features:

  • Standard LIMIT N syntax
  • LIMIT lower,upper range syntax (lower exclusive, upper inclusive)
  • Support for expressions and bind parameters
  • Automatic conversion of SQLAlchemy's LIMIT/OFFSET

Example:

select(table).limit(5)               # LIMIT 5
select(table).limit(3).offset(2)     # LIMIT 2,5
select(table).offset(8)              # LIMIT 8,BIGINT_MAX

This addressed the 2nd bullet from #25

@jerrinot jerrinot added the enhancement New feature or request label Dec 30, 2024
@jerrinot jerrinot changed the title Add support for QuestDB-style LIMIT clause and tests Add support for QuestDB's LIMIT clause in SQLAlchemy dialect Dec 30, 2024
@jerrinot jerrinot marked this pull request as draft December 30, 2024 12:50
Key features:
- Standard LIMIT N syntax
- LIMIT lower,upper range syntax (lower exclusive, upper inclusive)
- Support for expressions and bind parameters
- Automatic conversion of SQLAlchemy's LIMIT/OFFSET

Example:

select(table).limit(5)               # LIMIT 5
select(table).limit(3).offset(2)     # LIMIT 2,5
select(table).offset(8)              # LIMIT 8,BIGINT_MAX
@jerrinot jerrinot marked this pull request as ready for review December 30, 2024 12:56
@nwoolmer nwoolmer self-assigned this Jan 13, 2025
@raycardillo
Copy link

Anything I can to do help move this one along? I have a use-case where I need the OFFSET to work with Superset and I just noticed this PR. I might try to experiment with it myself and confirm it resolves that problem, but there is a very real need for translating OFFSET to LIMIT for QuestDB. In the case of Superset, they use it for more efficient server side pagination, and they use it for pagination with their "drill down" mode when exploring data behind a chart, etc.

@raycardillo
Copy link

Just to confirm, I installed this branch into my venv for my Superset installation, and it worked like a charm!! Now I am looking forward to see it merged. It has enabled server side pagination and drill down for me. :D

@cardilloscreations
Copy link

cardilloscreations commented Mar 7, 2025

@nwoolmer Is there anything I could do to help here? Not sure I have the bandwidth, but without a solution for OFFSET/LIMIT in the SQLAlchemy connector for QuestDB, we cannot make use of server side pagination and other features where Superset requires support for the LIMIT clause. See issue #29 for details.

@nwoolmer
Copy link
Contributor

nwoolmer commented Mar 7, 2025

I'll raise it!

@nwoolmer
Copy link
Contributor

nwoolmer commented Mar 7, 2025

@cardilloscreations Sorry for the delay on this one, aiming for a release Monday :)

@cardilloscreations
Copy link

@nwoolmer Awesome! Thanks! :D

@bluestreak01 bluestreak01 merged commit 8b4c81c into main Mar 10, 2025
3 checks passed
@bluestreak01 bluestreak01 deleted the jh_limit_offset branch March 10, 2025 12:26
@jerrinot
Copy link
Contributor Author

@cardilloscreations: just FYI - the newly released 1.1.4 contains this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants