Skip to content

Commit cfd24c8

Browse files
committed
Tests: Fix PGCompiler SQL renderer anomaly on limit clauses
4532ef7 started using the `PGCompiler` for generating limit clauses, to be more compatible with CrateDB on edge cases. Apparently, the SQL renderer of `PGCompiler` was slightly changed with SQLAlchemy 1.4, which removes a redundant space character between table name and limit clause. This slipped through because CI did not test on SA13 appropriately at the time the change was added.
1 parent 412d9b7 commit cfd24c8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/crate/client/sqlalchemy/tests/compiler_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import sqlalchemy as sa
2727
from sqlalchemy.sql import update, text
2828

29+
from crate.client.sqlalchemy.sa_version import SA_VERSION, SA_1_4
2930
from crate.client.sqlalchemy.types import Craty
3031

3132

@@ -77,7 +78,10 @@ def test_select_with_offset(self):
7778
self.metadata.bind = self.crate_engine
7879
selectable = self.mytable.select().offset(5)
7980
statement = str(selectable.compile())
80-
self.assertEqual(statement, "SELECT mytable.name, mytable.data \nFROM mytable\n LIMIT ALL OFFSET ?")
81+
if SA_VERSION >= SA_1_4:
82+
self.assertEqual(statement, "SELECT mytable.name, mytable.data \nFROM mytable\n LIMIT ALL OFFSET ?")
83+
else:
84+
self.assertEqual(statement, "SELECT mytable.name, mytable.data \nFROM mytable \n LIMIT ALL OFFSET ?")
8185

8286
def test_select_with_limit(self):
8387
"""

0 commit comments

Comments
 (0)