I just learned that MySQL has a native CSV storage engine which stores data in a Comma-Separated-Value file per table.
Is it possible to create a table directly from a uploaded CSV file, something like:
CREATE TABLE USERS < PATH/USERS.CSV
where users.csv
is uploaded by the user?
I just discovered csvkit, which is a set of Unix command-line tools for CSV files. I installed it on my Mac with pip install csvkit
. The command was:
csvsql --dialect mysql --snifflimit 100000 bigdatafile.csv > maketable.sql
You can alternatively provide a DB connection string and it can load the table directly.