标题: [文本处理] dsq:用于针对JSON,CSV,Excel,Parquet等运行SQL查询的命令行工具 [打印本页]
作者: CrLf 时间: 2023-7-29 00:59 标题: dsq:用于针对JSON,CSV,Excel,Parquet等运行SQL查询的命令行工具
本帖最后由 CrLf 于 2023-7-29 01:04 编辑
来源:GitHub - multiprocessio/dsq:用于针对JSON,CSV,Excel,Parquet等运行SQL查询的命令行工具。
计算数量- type testdata.parquet | dsq -s parquet "SELECT COUNT(1) FROM {}"
- +----------+
- | count(*) |
- +----------+
- | 1000 |
- +----------+
复制代码
展示第一行- cat testdata.csv | dsq -s csv "SELECT * FROM {} LIMIT 1"
复制代码
连接多表- dsq testdata/join/users.csv testdata/join/ages.json "select {0}.name, {1}.age from {0} join {1} on {0}.id = {1}.id"
- [{"age":88,"name":"Ted"},
- {"age":56,"name":"Marjory"},
- {"age":33,"name":"Micah"}]
复制代码
排序- dsq --pretty api-results.json 'SELECT * FROM {0, "data.data"} ORDER BY id DESC'
- +----+-------+
- | id | name |
- +----+-------+
- | 3 | Minh |
- | 1 | Corah |
- +----+-------+
复制代码
已收录到 http://bcn.bathome.net/s/tool/index.html?key=dsq
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |