mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 13:22:57 +00:00
* feat: impl COPY a query resultset to external file * chore: add more tests for parse `copy_table_to` * chore: add more tests for parse `copy_table_to`
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
CREATE TABLE demo(host string, cpu DOUBLE, memory DOUBLE, ts TIMESTAMP TIME INDEX);
|
|
|
|
Affected Rows: 0
|
|
|
|
insert into demo(host, cpu, memory, ts) values ('host1', 66.6, 1024, 1655276557000), ('host2', 88.8, 333.3, 1655276558000);
|
|
|
|
Affected Rows: 2
|
|
|
|
COPY demo TO '${SQLNESS_HOME}/export/demo.parquet' WITH (start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:38');
|
|
|
|
Affected Rows: 1
|
|
|
|
COPY demo TO '${SQLNESS_HOME}/export/demo.csv' WITH (format='csv', start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:38');
|
|
|
|
Affected Rows: 1
|
|
|
|
COPY demo TO '${SQLNESS_HOME}/export/demo.json' WITH (format='json', start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:38');
|
|
|
|
Affected Rows: 1
|
|
|
|
COPY (select host, cpu, ts from demo where host = 'host2') TO '${SQLNESS_HOME}/export/demo.parquet';
|
|
|
|
Affected Rows: 1
|
|
|
|
COPY (select host, cpu, ts from demo where host = 'host2') TO '${SQLNESS_HOME}/export/demo.csv' WITH (format='csv');
|
|
|
|
Affected Rows: 1
|
|
|
|
COPY (select host, cpu, ts from demo where host = 'host2') TO '${SQLNESS_HOME}/export/demo.json' WITH (format='json');
|
|
|
|
Affected Rows: 1
|
|
|
|
drop table demo;
|
|
|
|
Affected Rows: 0
|
|
|