2016-12-21 20:04:27 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-02-07 09:53:48 +00:00
|
|
|
|
2017-12-15 19:34:19 +00:00
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
. $CURDIR/../shell_config.sh
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.csv";
|
|
|
|
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.csv (s String, n UInt64, d Date) ENGINE = Memory";
|
2016-02-07 09:53:48 +00:00
|
|
|
|
|
|
|
echo '"Hello, world", 123, "2016-01-01"
|
2016-02-07 10:23:02 +00:00
|
|
|
"Hello, ""world""", "456", 2016-01-02,
|
2017-04-05 11:52:23 +00:00
|
|
|
Hello "world", 789 ,2016-01-03
|
2016-02-07 09:53:48 +00:00
|
|
|
"Hello
|
2017-12-15 19:34:19 +00:00
|
|
|
world", 100, 2016-01-04,' | $CLICKHOUSE_CLIENT --query="INSERT INTO test.csv FORMAT CSV";
|
2016-02-07 09:53:48 +00:00
|
|
|
|
2017-12-15 19:34:19 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.csv ORDER BY d";
|
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE test.csv";
|
2017-08-15 10:20:05 +00:00
|
|
|
|
2018-12-27 15:39:41 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.csv (t DateTime('Europe/Moscow'), s String) ENGINE = Memory";
|
2017-08-15 10:20:05 +00:00
|
|
|
|
|
|
|
echo '"2016-01-01 01:02:03","1"
|
|
|
|
2016-01-02 01:02:03, "2"
|
|
|
|
1502792101,"3"
|
2017-12-15 19:34:19 +00:00
|
|
|
99999,"4"' | $CLICKHOUSE_CLIENT --query="INSERT INTO test.csv FORMAT CSV";
|
2017-08-15 10:20:05 +00:00
|
|
|
|
2017-12-15 19:34:19 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.csv ORDER BY s";
|
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE test.csv";
|