ClickHouse/tests/queries/0_stateless/02473_infile_progress.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.4 KiB
Python
Raw Normal View History

2022-10-26 05:20:34 +00:00
#!/usr/bin/env python3
# Tags: no-replicated-database, no-parallel, no-fasttest
import os
import sys
import signal
CURDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
from client import client, prompt, end_of_block
log = None
# uncomment the line below for debugging
# log=sys.stdout
2022-12-16 16:55:50 +00:00
with client(
2022-12-16 17:03:55 +00:00
name="client>",
log=log,
command=os.environ.get("CLICKHOUSE_BINARY", "clickhouse")
2022-12-27 15:41:26 +00:00
+ " client --storage_file_read_method=pread",
2022-12-16 16:55:50 +00:00
) as client1:
2022-10-26 05:20:34 +00:00
filename = os.environ["CLICKHOUSE_TMP"] + "/infile_progress.tsv"
client1.expect(prompt)
client1.send("DROP TABLE IF EXISTS test.infile_progress")
client1.expect(prompt)
client1.send(f"SELECT number FROM numbers(5) INTO OUTFILE '{filename}'")
client1.expect(prompt)
client1.send(
"CREATE TABLE test.infile_progress (a Int32) Engine=MergeTree order by tuple()"
)
client1.expect(prompt)
client1.send(f"INSERT INTO test.infile_progress FROM INFILE '{filename}'")
2023-06-23 14:22:38 +00:00
client1.expect("Progress: 5.00 rows, 10.00 B.*\)")
2022-10-26 05:20:34 +00:00
client1.expect(prompt)
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)
client1.send("DROP TABLE test.infile_progress")
client1.expect(prompt)
os.remove(filename)