r-dbi / odbc

Connect to ODBC databases (using the DBI interface)
https://odbc.r-dbi.org/
Other
392 stars 107 forks source link

dbWriteTable uses `BIT` datatype instead of `BOOL` #849

Closed metanoid closed 1 month ago

metanoid commented 1 month ago

When the dbms.name is NetezzaSQL then dbWriteTable should write a logical TRUE/FALSE data column as type BOOL as per this list of supported data types: https://www.ibm.com/docs/en/netezza?topic=vc-data-types-aliases

Instead, it seems to be trying to use the BIT datatype, which is not supported by Netezza.

Example:

a = data.frame(Test = runif(100) > 0.5)
dbWriteTable(n_con, "TEST_DELETE", a)

results in

Error in `dbWriteTable()`:
! ODBC failed with error HY000 from .
✖ ERROR: transformColumnType: error reading type 'BIT'
• <SQL> 'CREATE TABLE "TEST_DELETE" (
•  "Test" BIT
• )
• '
detule commented 1 month ago

Thanks!

Would you be willing, once again to help us test?

https://github.com/detule/odbc/tree/netezza/odbcDataType_bool

Thanks again

metanoid commented 1 month ago

Working, thank you!