mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-19 04:42:37 +00:00
fix clickhouse_driver inserts
This commit is contained in:
parent
5902f3058d
commit
0a85fc6524
@ -37,6 +37,7 @@
|
|||||||
#include <Poco/Net/NetException.h>
|
#include <Poco/Net/NetException.h>
|
||||||
#include <Poco/Net/SocketAddress.h>
|
#include <Poco/Net/SocketAddress.h>
|
||||||
#include <Poco/Util/LayeredConfiguration.h>
|
#include <Poco/Util/LayeredConfiguration.h>
|
||||||
|
#include "Common/StackTrace.h"
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <Common/CurrentMetrics.h>
|
#include <Common/CurrentMetrics.h>
|
||||||
#include <Common/CurrentThread.h>
|
#include <Common/CurrentThread.h>
|
||||||
@ -1110,8 +1111,13 @@ void TCPHandler::processInsertQuery(QueryState & state)
|
|||||||
startInsertQuery(state);
|
startInsertQuery(state);
|
||||||
|
|
||||||
while (receivePacketsExpectDataConcurrentWithExecutor(state))
|
while (receivePacketsExpectDataConcurrentWithExecutor(state))
|
||||||
|
{
|
||||||
executor.push(std::move(state.block_for_insert));
|
executor.push(std::move(state.block_for_insert));
|
||||||
|
|
||||||
|
sendLogs(state);
|
||||||
|
sendInsertProfileEvents(state);
|
||||||
|
}
|
||||||
|
|
||||||
state.read_all_data = true;
|
state.read_all_data = true;
|
||||||
|
|
||||||
executor.finish();
|
executor.finish();
|
||||||
|
15
tests/queries/0_stateless/03279_with_clickhouse_driver.py
Normal file
15
tests/queries/0_stateless/03279_with_clickhouse_driver.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import sys
|
||||||
|
from clickhouse_driver import Client
|
||||||
|
|
||||||
|
|
||||||
|
def run(database):
|
||||||
|
client = Client("localhost",user="default",password="")
|
||||||
|
client.execute(f"CREATE TABLE IF NOT EXISTS {database}.test (x Int32) ENGINE = Memory")
|
||||||
|
client.execute(f"INSERT INTO {database}.test (x) VALUES", [{"x": 100}])
|
||||||
|
result = client.execute(f"SELECT * FROM {database}.test")
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
database = sys.argv[1]
|
||||||
|
run(database)
|
@ -0,0 +1 @@
|
|||||||
|
[(100,)]
|
8
tests/queries/0_stateless/03279_with_clickhouse_driver.sh
Executable file
8
tests/queries/0_stateless/03279_with_clickhouse_driver.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Tags: no-fasttest
|
||||||
|
|
||||||
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
# shellcheck source=../shell_config.sh
|
||||||
|
. "$CURDIR"/../shell_config.sh
|
||||||
|
|
||||||
|
python3 03279_with_clickhouse_driver.py $CLICKHOUSE_DATABASE
|
Loading…
Reference in New Issue
Block a user