duckdb
duckdb copied to clipboard
[CLI] import of quotes values where the first column name is missing.
What happens?
import fails on specific csv
To Reproduce
Example csv file band_members.csv
"","name","band"
"1","Mick","Stones"
"2","John","Beatles"
"3","Paul","Beatles"
duckdb csv.db
D .import data/band_members.csv band_members --csv
data/band_members.csv:1: expected 1 columns but found 3 - extras ignored
data/band_members.csv:2: expected 1 columns but found 3 - extras ignored
data/band_members.csv:3: expected 1 columns but found 3 - extras ignored
data/band_members.csv:4: expected 1 columns but found 3 - extras ignored
D select * from band_members;
┌────────────────────┐
│ ","name","band │
├────────────────────┤
│ 1","Mick","Stones │
│ 2","John","Beatles │
│ 3","Paul","Beatles │
│ │
│ 1 │
│ 2 │
│ 3 │
└────────────────────┘
Environment (please complete the following information):
- OS: (e.g. iOS): ubuntu
- DuckDB Version:
duckdb --version
v0.4.0 da9ee490d
Identity Disclosure:
- Full Name: alexhallam
- Affiliation: None
Before Submitting
Strictly CLI API only.
. import
uses the shells' built-in CSV reader, which comes from SQLite. It seems to fail because a column name is empty:
CREATE TABLE band_members(...) failed: Parser Error: zero-length delimited identifier at or near """"
LINE 2: "" TEXT,
This works in SQLite because SQLite supports empty column names in tables.
Perhaps we should switch the .import
to use DuckDB's own CSV reader in the first place.
In a sense, this is a dup of #1603.
Also facing this issue @onefact with @stockdaleb108
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stale for 30 days with no activity.