https://github.com/zizaco/zsql
Run SQL queries directly on CSV files
https://github.com/zizaco/zsql
cli csv sql
Last synced: about 1 month ago
JSON representation
Run SQL queries directly on CSV files
- Host: GitHub
- URL: https://github.com/zizaco/zsql
- Owner: Zizaco
- License: mit
- Created: 2021-10-10T19:41:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-13T22:03:58.000Z (over 3 years ago)
- Last Synced: 2025-04-30T04:39:12.766Z (about 1 month ago)
- Topics: cli, csv, sql
- Language: Rust
- Homepage:
- Size: 29.3 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `zsql` run SQL queries on csv files
A terminal utility to easily run SQL queries on CSV files. `zsql` is shipped as a _[small single binary](https://github.com/Zizaco/zsql/releases)_ powered by rust and C.
## Key features
```bash
# Select lines from csv
zsql "SELECT * from ./path/to/oscar_age.csv WHERE Year > 2015" > selection.csv# Select specific columns from csv
zsql "SELECT Age, Name from './name with spaces.csv'" | more# Join files
zsql "SELECT O.OrderID, C.CustomerName, O.OrderDate
FROM orders.csv AS O
INNER JOIN customers.csv AS C ON O.CustomerID=C.CustomerID"# Choose separator
zsql -s "|" "SELECT Name, Age from ./separated_by_pipe.csv"# Runs on windows 🟦
zsql.exe "SELECT COUNT(*) FROM .\file_on_windows.csv"
```## How to use
```yaml
Runs SQL queries on csv files Example: zsql "SELECT * from 'my csv file.csv'"USAGE:
zsql [FLAGS] [OPTIONS]ARGS:
SQL query to be executed.FLAGS:
-h, --help Print help information
-v, --verbose A level of verbosity. Can be used multiple times: -v -vv -vvv
-V, --version Print version informationOPTIONS:
-s Set csv the separator character to be used [default: ,]
```## Instalation
### Download binaries
Please check out the [Release page](https://github.com/Zizaco/zsql/releases) for prebuilt versions of zsql for **linux**, **mac** and **windows**.
### Build from source
To build zsql from source you need Rust 1.55 or higher.
```bash
make install
```