cockroachdb / cockroachdb/cockroach
simplify copy/import row termination handling
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
IMPORT ... CSV DATA assumes that data ends with the delimiter. IMPORT DELIMITED and COPY assumes they don't. This makes for a poor user experience where you have to play games with editing files or adding dummy rows to the schema if you want to use the same CSV's for import and copy.
Ie:
```
cr sql --insecure -e "IMPORT INTO lineitem DELIMITED DATA ('userfile://defaultdb.public.userfiles_root/lineitem.tbl.1') WITH fields_terminated_by='|'";
ERROR: userfile://defaultdb.public.userfiles_root/lineitem.tbl.1: error parsing row 1: too many columns, got 17 expected 16 (row: 1|155190|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|egular courts above the|)
Failed running "sql"
```
Doesn't work but:
```
..achdb/cockroach [copy-pipe|✚1…44] ❯❯❯ cr sql --insecure -e "IMPORT INTO lineitem CSV DATA ('userfile://defaultdb.public.userfiles_root/lineitem.tbl.1') WITH delimiter='|'";
job_id | status | fraction_completed | rows | index_entries | bytes
---------------------+-----------+--------------------+--------+---------------+------------
871414994431836161 | succeeded | 1 | 750594 | 6004752 | 181335334
(1 row)
Time: 13.059s
```
Works.
Jira issue: CRDB-28493
Contributor guide
Assessment
This issue has not been assessed yet.