From e44480dea337690d2c8c40550289cace140ff038 Mon Sep 17 00:00:00 2001 From: sundyli <543950155@qq.com> Date: Thu, 3 Jul 2025 19:53:02 +0800 Subject: [PATCH 1/3] temp table tests --- .../python/tests/blocking/steps/binding.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/bindings/python/tests/blocking/steps/binding.py b/bindings/python/tests/blocking/steps/binding.py index 4f8f7f9b..1341ef49 100644 --- a/bindings/python/tests/blocking/steps/binding.py +++ b/bindings/python/tests/blocking/steps/binding.py @@ -181,11 +181,28 @@ def _(context): @then("Temp table should work with cluster") -async def _(context): +def _(context): context.conn.exec("create or replace temp table temp_1(a int)") context.conn.exec("INSERT INTO temp_1 VALUES (1),(2)") rows = context.conn.query_iter("SELECT * FROM temp_1") ret = [row.values() for row in rows] - expected = [(1), (2)] + expected = [(1, ), (2, )] assert ret == expected, f"ret: {ret}" context.conn.exec("DROP TABLE temp_1") + + context.conn.exec(""" + CREATE OR REPLACE TEMP TABLE temp_2 ( + i64 Int64, + u64 UInt64, + f64 Float64, + s String, + s2 String, + d Date, + t DateTime + ) as select 1, number + 1,3, '4', '5', today(), now() from numbers(3) +""") + rows = context.conn.query_iter("SELECT i64, u64 FROM temp_2") + ret = [row.values() for row in rows] + expected = [(1, 1, ), (1, 2, ), (1, 3, )] + assert ret == expected, f"ret: {ret}" + context.conn.exec("DROP TABLE temp_2") From 8e29705e1d1cb1acdf960c8aed5514cfa2c61dc3 Mon Sep 17 00:00:00 2001 From: sundyli <543950155@qq.com> Date: Thu, 3 Jul 2025 19:53:53 +0800 Subject: [PATCH 2/3] temp table tests --- bindings/python/tests/asyncio/steps/binding.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bindings/python/tests/asyncio/steps/binding.py b/bindings/python/tests/asyncio/steps/binding.py index 5426d280..a72a9d04 100644 --- a/bindings/python/tests/asyncio/steps/binding.py +++ b/bindings/python/tests/asyncio/steps/binding.py @@ -203,3 +203,20 @@ async def _(context): expected = [(1), (2)] assert ret == expected, f"ret: {ret}" await context.conn.exec("DROP TABLE temp_1") + + await context.conn.exec(""" + CREATE OR REPLACE TEMP TABLE temp_2 ( + i64 Int64, + u64 UInt64, + f64 Float64, + s String, + s2 String, + d Date, + t DateTime + ) as select 1, number + 1,3, '4', '5', today(), now() from numbers(3) +""") + rows = await context.conn.query_iter("SELECT i64, u64 FROM temp_2") + ret = [row.values() for row in rows] + expected = [(1, 1, ), (1, 2, ), (1, 3, )] + assert ret == expected, f"ret: {ret}" + await context.conn.exec("DROP TABLE temp_2") From 8da249025688bf2f78cc6699d2e5c02064ee961c Mon Sep 17 00:00:00 2001 From: sundyli <543950155@qq.com> Date: Thu, 3 Jul 2025 19:56:13 +0800 Subject: [PATCH 3/3] temp table tests --- bindings/python/tests/asyncio/steps/binding.py | 15 ++++++++++++++- bindings/python/tests/blocking/steps/binding.py | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/bindings/python/tests/asyncio/steps/binding.py b/bindings/python/tests/asyncio/steps/binding.py index a72a9d04..dea02924 100644 --- a/bindings/python/tests/asyncio/steps/binding.py +++ b/bindings/python/tests/asyncio/steps/binding.py @@ -217,6 +217,19 @@ async def _(context): """) rows = await context.conn.query_iter("SELECT i64, u64 FROM temp_2") ret = [row.values() for row in rows] - expected = [(1, 1, ), (1, 2, ), (1, 3, )] + expected = [ + ( + 1, + 1, + ), + ( + 1, + 2, + ), + ( + 1, + 3, + ), + ] assert ret == expected, f"ret: {ret}" await context.conn.exec("DROP TABLE temp_2") diff --git a/bindings/python/tests/blocking/steps/binding.py b/bindings/python/tests/blocking/steps/binding.py index 1341ef49..1a6ea175 100644 --- a/bindings/python/tests/blocking/steps/binding.py +++ b/bindings/python/tests/blocking/steps/binding.py @@ -186,7 +186,7 @@ def _(context): context.conn.exec("INSERT INTO temp_1 VALUES (1),(2)") rows = context.conn.query_iter("SELECT * FROM temp_1") ret = [row.values() for row in rows] - expected = [(1, ), (2, )] + expected = [(1,), (2,)] assert ret == expected, f"ret: {ret}" context.conn.exec("DROP TABLE temp_1") @@ -203,6 +203,19 @@ def _(context): """) rows = context.conn.query_iter("SELECT i64, u64 FROM temp_2") ret = [row.values() for row in rows] - expected = [(1, 1, ), (1, 2, ), (1, 3, )] + expected = [ + ( + 1, + 1, + ), + ( + 1, + 2, + ), + ( + 1, + 3, + ), + ] assert ret == expected, f"ret: {ret}" context.conn.exec("DROP TABLE temp_2")