Skip to content

Commit 31660a1

Browse files
committed
Test for FINAL with JOIN
1 parent 0330e13 commit 31660a1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_execute.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,35 @@ async def test_final_hint(conn, table_test3):
303303
assert rows[0]['value'] == 45
304304

305305

306+
@pytest.mark.parametrize('alised', [False, True])
307+
async def test_join_final_hint(conn, table_test1, table_test3, alised):
308+
await conn.execute(
309+
table_test1.insert(),
310+
{'id': 12, 'name': 'name12'},
311+
{'id': 23, 'name': 'name23'},
312+
)
313+
await conn.execute(
314+
table_test3.insert(),
315+
*[{'key': 12, 'value': i} for i in range(10)]
316+
)
317+
318+
if alised:
319+
table_test3 = table_test3.alias()
320+
query = (
321+
sa.select([table_test1.c.name, table_test3.c.value])
322+
.select_from(
323+
table_test3.join(
324+
table_test1,
325+
table_test1.c.id == sa.func.toUInt64(table_test3.c.key),
326+
)
327+
)
328+
.with_hint(table_test3, 'FINAL')
329+
)
330+
rows = await conn.fetch(query)
331+
assert len(rows) == 1
332+
assert rows[0]['name'] == 'name12'
333+
334+
306335
async def test_aggregate_function(conn, table_test4):
307336
await conn.execute('INSERT INTO test4 SELECT 1, sumState(123)')
308337
value = await conn.fetchval(

0 commit comments

Comments
 (0)