Getting a SQL Table Definition From a CSV File
Talles L

Talles L @tallesl

About: nothing to see here, move along

Location:
Brazil
Joined:
Jul 12, 2020

Getting a SQL Table Definition From a CSV File

Publish Date: Nov 30 '24
0 0

Make sure you have sqlite3 available:

$ sudo apt install sqlite3
Enter fullscreen mode Exit fullscreen mode

Also, make sure your .csv file has a header.

Then:

$ sqlite3 <<EOF \
.mode csv \
.import "~/my_data.csv" my_table \
.schema my_table \
EOF
Enter fullscreen mode Exit fullscreen mode

Kudos to this Stack Overflow answer.

Comments 0 total

    Add comment