I wrote an R data frame to a Teradata table on a Mac
Here’s how I did it:
- On a new Mac running Mavericks and R 3.1.2 with devtools I installed Java for Mac.
- I installed the RJDBC package from CRAN (which depends on the DBI package also from CRAN) and the teradataR package from GitHub.
- I downloaded the Teradata JDBC driver, unpacked it, and moved
tdgssconfig.jarandterajdbc4.jarto/System/Library/Java/Extensions.
After that, writing the data frame foo to the table DATABASE.BAR was as simple as:
teradataR::tdConnect(dsn='datamart.mycompany.com',
uid='user',pwd='pass',
dType='jdbc')
teradataR::tdWriteTable(databasename='DATABASE',
tablename='BAR', df=foo)
teradataR::tdClose(conn)I had to do this because DBI::dbWriteTable() now fails on Teradata as explained here.
My thanks go to Jeffrey Wong for mirroring and nurturing the no-longer-supported teradataR package, and to Skylar Lyon for finding Jeff’s repo.