csvsql

Generate SQL statements for a CSV file or execute those statements directly on a database. Included in csvkit. More information: <https://csvkit.readthedocs.io/en/latest/scripts/csvsql.html>.

Install

All systems
curl cmd.cat/csvsql.sh
Debian Debian
apt-get install csvkit
Ubuntu
apt-get install csvkit
image/svg+xml Kali Linux
apt-get install csvkit
Fedora
dnf install python3-csvkit
Windows (WSL2)
sudo apt-get update sudo apt-get install csvkit
OS X
brew install csvkit
Raspbian
apt-get install python3-csvkit

Generate SQL statements for a CSV file or execute those statements directly on a database. Included in csvkit. More information: <https://csvkit.readthedocs.io/en/latest/scripts/csvsql.html>.

  • Generate a `CREATE TABLE` SQL statement for a CSV file:
    csvsql path/to/data.csv
  • Import a CSV file into an SQL database:
    csvsql --insert --db "mysql://user:password@host/database" data.csv
  • Run an SQL query on a CSV file:
    csvsql --query "select * from 'data'" data.csv

© tl;dr; authors and contributors