I get the following when appending boolean data to an existing table.
> dbWriteTable(conn, "myTable", myData, overwrite = F, append = T, csvdump = T)
Error in .local(conn, statement, ...) : Unable to execute statement 'COPY 1292 RECORDS INTO myTable FROM 'C:\Path\to\AppData\Local\Temp\Rtmp80mc5L\file3e24401f42a.cs...'.
Server says '!value 'TRUE' from line 1 field 20 not inserted, expecting type boolean'.
I've taken some code of the connector which deals with this:
> tmp <- tempfile(fileext = ".csv")
> write.table(myData, tmp, sep = ",", quote = TRUE,row.names = FALSE, col.names = FALSE,na="")
> tmp
[1] "C:\Path\to\AppData\Local\Temp\Rtmp80mc5L\file3e24401f42a.csv"
When changing TRUE to 1 and FALSE to 0 and run the following SQL code:
COPY 1292 RECORDS INTO myTable FROM 'C:\Path\to\AppData\Local\Temp\Rtmp80mc5L\file3e24401f42a.csv' USING DELIMITERS ',','\n','"' NULL AS '' LOCKED;
then all data is inserted.
myData
with thedput
function? thanks :) – Anthony Damico