red-4 / curious-moon

The Repository for the book, A Curious Moon, which you can purchase from https://bigmachine.io.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

csvsql --overwrite option invalid & typo

Thomascountz opened this issue · comments

pg. 155 in the PDF

csvsql 2005/048/200504800_L1A_05.CSV -i postgresql --tables "import.inms" --no-constraints –overwrite  | sed 's/VARCHAR/text/g' > import.sql

produces the following error with csvkit 1.0.5

csvsql: error: unrecognized arguments: -overwrite

I believe the argument is meant to be --overwrite (NB: two - instead of one)

However, updating the command to use --overwrite, the following error is produced with csvkit 1.0.5

csvsql: error: The --overwrite option is only valid if --insert is also specified.

This new constraint has been added between version 1.0.2 and 1.0.3 as evidenced by the change in documentation, although this does not appear in the changelog.

1.0.2 - https://csvkit.readthedocs.io/en/1.0.2/scripts/csvsql.html
1.0.3 - https://csvkit.readthedocs.io/en/1.0.3/scripts/csvsql.html

I'm unable to provide a fix as I'm unaware of Dee's original intention in using the -overwrite [sic] flag.

Currently working through this bit, did anyone find out the original intention? I've got around this by using 1.0.2 instead such as:
pip3 install -Iv csvsql==1.0.2

Ran into this as I was proofing things last month... evidently something changed. Sigh.