Skip to content

Commit 2eec36c

Browse files
joshthowardfindepi
authored andcommitted
Fixed casing issues in SQL queries
1 parent 17dd0e6 commit 2eec36c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

integration_tests/test_dbapi.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def trino_connection_with_transaction(run_trino):
4747

4848
def test_select_query(trino_connection):
4949
cur = trino_connection.cursor()
50-
cur.execute("select * from system.runtime.nodes")
50+
cur.execute("SELECT * FROM system.runtime.nodes")
5151
rows = cur.fetchall()
5252
assert len(rows) > 0
5353
row = rows[0]
@@ -62,11 +62,11 @@ def test_select_query(trino_connection):
6262

6363
def test_select_query_result_iteration(trino_connection):
6464
cur0 = trino_connection.cursor()
65-
cur0.execute("select custkey from tpch.sf1.customer LIMIT 10")
65+
cur0.execute("SELECT custkey FROM tpch.sf1.customer LIMIT 10")
6666
rows0 = cur0.genall()
6767

6868
cur1 = trino_connection.cursor()
69-
cur1.execute("select custkey from tpch.sf1.customer LIMIT 10")
69+
cur1.execute("SELECT custkey FROM tpch.sf1.customer LIMIT 10")
7070
rows1 = cur1.fetchall()
7171

7272
assert len(list(rows0)) == len(rows1)
@@ -76,15 +76,15 @@ def test_select_query_result_iteration_statement_params(trino_connection):
7676
cur = trino_connection.cursor()
7777
cur.execute(
7878
"""
79-
select * from (
79+
SELECT * FROM (
8080
values
8181
(1, 'one', 'a'),
8282
(2, 'two', 'b'),
8383
(3, 'three', 'c'),
8484
(4, 'four', 'd'),
8585
(5, 'five', 'e')
8686
) x (id, name, letter)
87-
where id >= ?
87+
WHERE id >= ?
8888
""",
8989
params=(3,) # expecting all the rows with id >= 3
9090
)
@@ -227,18 +227,18 @@ def test_int_query_param(trino_connection):
227227
def test_select_query_invalid_params(trino_connection, params):
228228
cur = trino_connection.cursor()
229229
with pytest.raises(AssertionError):
230-
cur.execute('select ?', params=params)
230+
cur.execute('SELECT ?', params=params)
231231

232232

233233
def test_select_cursor_iteration(trino_connection):
234234
cur0 = trino_connection.cursor()
235-
cur0.execute("select nationkey from tpch.sf1.nation")
235+
cur0.execute("SELECT nationkey FROM tpch.sf1.nation")
236236
rows0 = []
237237
for row in cur0:
238238
rows0.append(row)
239239

240240
cur1 = trino_connection.cursor()
241-
cur1.execute("select nationkey from tpch.sf1.nation")
241+
cur1.execute("SELECT nationkey FROM tpch.sf1.nation")
242242
rows1 = cur1.fetchall()
243243

244244
assert len(rows0) == len(rows1)
@@ -247,7 +247,7 @@ def test_select_cursor_iteration(trino_connection):
247247

248248
def test_select_query_no_result(trino_connection):
249249
cur = trino_connection.cursor()
250-
cur.execute("select * from system.runtime.nodes where false")
250+
cur.execute("SELECT * FROM system.runtime.nodes WHERE false")
251251
rows = cur.fetchall()
252252
assert len(rows) == 0
253253

@@ -282,7 +282,7 @@ def test_select_query_stats(trino_connection):
282282
def test_select_failed_query(trino_connection):
283283
cur = trino_connection.cursor()
284284
with pytest.raises(trino.exceptions.TrinoUserError):
285-
cur.execute("select * from catalog.schema.do_not_exist")
285+
cur.execute("SELECT * FROM catalog.schema.do_not_exist")
286286
cur.fetchall()
287287

288288

@@ -295,7 +295,7 @@ def test_select_tpch_1000(trino_connection):
295295

296296
def test_cancel_query(trino_connection):
297297
cur = trino_connection.cursor()
298-
cur.execute("select * from tpch.sf1.customer")
298+
cur.execute("SELECT * FROM tpch.sf1.customer")
299299
cur.fetchone() # TODO (https://github.com/trinodb/trino/issues/2683) test with and without .fetchone
300300
cur.cancel() # would raise an exception if cancel fails
301301

@@ -368,7 +368,7 @@ def test_invalid_query_throws_correct_error(trino_connection):
368368
with pytest.raises(TrinoQueryError):
369369
cur.execute(
370370
"""
371-
select * FRMO foo WHERE x = ?;
371+
SELECT * FRMO foo WHERE x = ?;
372372
""",
373373
params=(3,),
374374
)

0 commit comments

Comments
 (0)