Upload a df from Rstudio environment to HADOOP via ODBC connection

So I'm trying UPLOAD a DF to our company's HADOOP HIve server. Using the following coding procedure:


library(dbplyr)
library(dplyr)
library(DBI)
con <- dbConnect(odbc::odbc(), "HadoopCE_Hive")

dbWriteTable(conn= con, value = mtcars,  name = Id(schema = "my_schema", table = "mtcars"))

And Unfortunately I get the following error:

Error: nanodbc/nanodbc.cpp:1617: 42000: [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error while compiling statement: FAILED: ParseException line 2:8 cannot recognize input near '?' ',' '?' in expression specification 
<SQL> 'INSERT INTO `sch_analysts`.`mtcars` (`row_names`, `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'

However I can see that a table was created sucessfully, however it has no data in it:

**glimpse(tbl(con, in_schema("my_schema", "mtcars")))**

Observations: ??
Variables: 12
Database: Hive 3.1.0.3.1.4.0-315[@Hive/HIVE]
$ mtcars.row_names <chr> 
$ mtcars.mpg       <dbl> 
$ mtcars.cyl       <dbl> 
$ mtcars.disp      <dbl> 
$ mtcars.hp        <dbl> 
$ mtcars.drat      <dbl> 
$ mtcars.wt        <dbl> 
$ mtcars.qsec      <dbl> 
$ mtcars.vs        <dbl> 
$ mtcars.am        <dbl> 
$ mtcars.gear      <dbl> 
$ mtcars.carb      <dbl> 

Normally we upload the file via SFTP connection and upload the data from there, but I would like to use a more timesaving method.

THank you for your help in advance!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.