Skip to content

Commit 2637c03

Browse files
yunyuauxten
authored andcommitted
Add test for executemany fallback path
1 parent a2bd81c commit 2637c03

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_dbapi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ def test_insert_and_read_data(self):
3333
CREATE TABLE rate (
3434
day Date,
3535
value Int32
36-
) ENGINE = Log""")
36+
) ENGINE = ReplacingMergeTree ORDER BY day""")
3737

3838
# Insert single value
3939
cur.execute("INSERT INTO rate VALUES (%s, %s)", ("2021-01-01", 24))
4040
# Insert multiple values
41-
cur.executemany("INSERT INTO rate VALUES (%s, %s)", [("2021-01-02", 72), ("2021-01-03", 96)])
41+
cur.executemany("INSERT INTO rate VALUES (%s, %s)", [("2021-01-02", 128), ("2021-01-03", 256)])
42+
# Test executemany outside optimized INSERT/REPLACE path
43+
cur.executemany("ALTER TABLE rate UPDATE value = %s WHERE day = %s", [(72, "2021-01-02"), (96, "2021-01-03")])
4244

4345
# Test fetchone
4446
cur.execute("SELECT value FROM rate ORDER BY day DESC LIMIT 2")

0 commit comments

Comments
 (0)