Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m7shapan/querycsv
QueryCSV enables you to load CSV files and manipulate them using SQL queries then after you finish you can export the new values to a CSV file
https://github.com/m7shapan/querycsv
csv generator sql
Last synced: 21 days ago
JSON representation
QueryCSV enables you to load CSV files and manipulate them using SQL queries then after you finish you can export the new values to a CSV file
- Host: GitHub
- URL: https://github.com/m7shapan/querycsv
- Owner: m7shapan
- License: mit
- Created: 2021-01-07T21:56:31.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-25T00:47:32.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T17:36:31.113Z (6 months ago)
- Topics: csv, generator, sql
- Language: Go
- Homepage:
- Size: 161 KB
- Stars: 101
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - m7shapan/querycsv - QueryCSV enables you to load CSV files and manipulate them using SQL queries then after you finish you can export the new values to a CSV file (Go)
README
# QueryCSV
enable you to load CSV files and manipulate them using SQL queries then after you finish you can export the new values to CSV file## Why
it's started with this task that I need to merge 30 CSV file into one file and group it by day instead of the hour, I wrote a couple of lines of code to do that, but I knew it is not going to be the last task that I will need to manipulate the CSV files, so wrote this cmd app to help me on this kind of tasks, I hope that could help too.## Install
```bash
go get github.com/m7shapan/querycsv
```
or download [Binaries from releases page](https://github.com/m7shapan/querycsv/releases)## How to use
```
➜ firstgroup = load group_a.csv
- loading file group_a.csv
+---------+-----+
| name | age |
+---------+-----+
| Mohamed | 26 |
| Asma | 26 |
| Ahmed | 23 |
+---------+-----+
➜ secondgroup = load group_b.csv
- loading file group_b.csv
+---------+-----+
| name | age |
+---------+-----+
| mahmoud | 24 |
| sara | 22 |
| khaled | 23 |
+---------+-----+
➜ groups = select * from firstgroup
➜ groups += select name, age from secondgroup
➜ show groups 10
+---------+-----+
| name | age |
+---------+-----+
| Mohamed | 26 |
| Asma | 26 |
| Ahmed | 23 |
| mahmoud | 24 |
| sara | 22 |
| khaled | 23 |
+---------+-----+
➜ group_by_age = select age, count(*) as count from groups group by age
➜ show group_by_age
error: wrong number of command parameters expected 2, found 1
➜ show group_by_age 10
+-----+-------+
| age | count |
+-----+-------+
| 22 | 1 |
| 23 | 2 |
| 24 | 1 |
| 26 | 2 |
+-----+-------+
➜ export group_by_age final_group.csv
file exported
```### Commands
```
load [file.csv] load only one file or all directory files in case of directory all files should be of the same csv structureexample:
testtable = load path/to/file.csv
testtable = load path/to/fileslist list all existed tables name
show [tablename] [limit] print table data use the limit to limit rows number
example:
show testtable 10export [tablename] [path/to/exported/file.csv]
example:
export testtable testtable.csv```
## Contact
Mohamed Shapan [@m7shapan](https://twitter.com/M7Shapan)