dolthub / dolt

Dolt – Git for Data
Apache License 2.0
17.74k stars 504 forks source link

Allow importing CSVs without column names. #7831

Open nicktobey opened 4 months ago

nicktobey commented 4 months ago

Both MySQL and SQLite have an option when importing data to skip the first N rows of the source file:

MySQL: LOAD DATA INFILE ... IGNORE 1 ROWS SQLite: .import --skip 1 ...

This is often used to skip the first row in a csv if it contains column names instead of data, but the skip value can also be deliberately omitted in order to treat the first row as data.

Dolt behaves differently: it always assumes that the first row contains column names, and there doesn't appear to be a way to force Dolt to treat the first row of a csv as data. This makes it impossible for Dolt to import csvs if they don't contain column names.

There should be a way to import these csvs into Dolt, whether it's via a --no-column-names flag, or by adding the --skip flag that matches SQLite (and implies no column names)

vhespanha commented 2 months ago

Can i take this one?

timsehn commented 2 months ago

Yes. Definitely