The application provides REPL with SQL-like language to query CSV located in filesystem.
MacOS
brew install raymank26/tools/csvsh
Usage: cmd [OPTIONS]
Options:
-c, --cmd CMD SQL statement to run
-v, --version Show version
-h, --help Show this message and exit
- Get count of all rows in CSV:
csvsh>> SELECT COUNT(*) FROM '/path/to/csv'
╔══════════╗
║ count(*) ║
╠══════════╣
║ 7 ║
╚══════════╝
WHERE
conditions evaluation:
csvsh>> SELECT * FROM '/test/input.csv' WHERE a IN ('bazz', 'баз') AND c IN (-1.0) AND b NOT IN (2)
╔══════╤══════╤══════╗
║ a │ b │ c ║
╠══════╪══════╪══════╣
║ bazz │ null │ -1.0 ║
╚══════╧══════╧══════╝
- More complicated query with
GROUP BY
,ORDER BY
,LIMIT
csvsh>> SELECT city, COUNT(*) FROM '/test/input2.csv' GROUP BY city WHERE city <> '' ORDER BY city LIMIT 5
╔══════════════╤══════════╗
║ city │ count(*) ║
╠══════════════╪══════════╣
║ Acton │ 3 ║
╟──────────────┼──────────╢
║ Agoura Hills │ 2 ║
╟──────────────┼──────────╢
║ Alameda │ 1 ║
╟──────────────┼──────────╢
║ Albuquerque │ 3 ║
╟──────────────┼──────────╢
║ Aliso Viejo │ 2 ║
╚══════════════╧══════════╝
-
SELECT
query withGROUP BY
,ORDER BY
andLIMIT
statements. - Aggregates:
COUNT
,MIN
,MAX
,SUM
. -
DESCRIBE
query forSELECT
and CSV data. - Data types: string, double and long.
-
INDEXES
for any datatype above. - Full-featured REPL (history, autocomplete, etc..) and one-shot execution mode.
- Fork the repo.
- Run build via
./gradlew build
- Add a feature/fix a bug, add tests.
- Make a pull request.