Crates.io | sql_csv |
lib.rs | sql_csv |
version | 0.2.0 |
source | src |
created_at | 2021-12-15 09:37:53.641567 |
updated_at | 2021-12-17 08:47:08.591235 |
description | A tool which query csv files use SQL syntax |
homepage | |
repository | |
max_upload_size | |
id | 498229 |
size | 41,744 |
A friendly query csv file use sql syntax
$ cargo install sql_csv
load
Load csv file
load /home/path/to/xxx.csv
store
Store last success SQL query result to csv file
store /path/to/xxx.csv
SQL
All SQL query support.
select * from user;
select count(*) from user;
select city,count(*) from user group by city;
$sql_csv.exe c:\temp\user.csv c:\temp\author.csv
read csv file c:\temp\user.csv to table user
read csv file c:\temp\author.csv to table author
>select * from user;
Result:
+----+-----------+------+---------+
| id | name | size | sport |
+----+-----------+------+---------+
| 1 | Xiaoputao | 3 | Hiking |
| 2 | Zgu | 3 | Running |
| 3 | Xiaopang | 2 | Walking |
+----+-----------+------+---------+
>
>load c:\temp\abc.csv
load csv file c:\temp\abc.csv to table abc
Load ok.
>select * from abc;
Result:
+----+-----------+------+---------+
| id | name | size | sport |
+----+-----------+------+---------+
| 1 | Xiaoputao | 3 | Hiking |
| 2 | Zgu | 3 | Running |
| 3 | Xiaopang | 2 | Walking |
+----+-----------+------+---------+
>store c:\temp\bar.csv
Store ok.
>