csvsql --insert fails with null violation when there are no data rows
Created by: srstsavage
Using Postgres (surely other dbs too), running an insert command like the following
csvsql --db postgresql://user:pass@server/database --insert data.csv
using a CSV file with only header data and no data rows
hi,no_data_here
results in a NOT NULL violation (some sort of insert is apparently attempted by csvsql even though there are zero rows).
csvsql should check to see if there's any data to insert before trying. Obviously the user can leave off the --insert flag and just create the schema, but that doesn't work if you're running csvsql on a bunch of CSV files using a wildcard, some of which have data and some only header info.