This repository has been archived by the owner on May 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overwrite limit_clause in TrinoSQLCompiler (#37)
Overwrite limit_clause in TrinoSQLCompiler
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from sqlalchemy import Table, MetaData, Column, Integer, String, select | ||
|
||
from sqlalchemy_trino.dialect import TrinoDialect | ||
|
||
metadata = MetaData() | ||
table = Table( | ||
'table', | ||
metadata, | ||
Column('id', Integer, primary_key=True), | ||
Column('name', String), | ||
) | ||
|
||
|
||
def test_limit_offset(): | ||
statement = select(table).limit(10).offset(0) | ||
query = statement.compile(dialect=TrinoDialect()) | ||
assert str(query) == 'SELECT "table".id, "table".name \nFROM "table" OFFSET :param_1\n LIMIT :param_2' | ||
|
||
|
||
def test_limit(): | ||
statement = select(table).limit(10) | ||
query = statement.compile(dialect=TrinoDialect()) | ||
assert str(query) == 'SELECT "table".id, "table".name \nFROM "table"\n LIMIT :param_1' | ||
|
||
|
||
def test_offset(): | ||
statement = select(table).offset(0) | ||
query = statement.compile(dialect=TrinoDialect()) | ||
assert str(query) == 'SELECT "table".id, "table".name \nFROM "table" OFFSET :param_1' |