如何使用ODBC连接将H数据帧写入配置单元?

时间:2017-11-21 17:22:10

标签: r hive

使用RODBC包,我可以手动编写一个HiveQL语句,为我创建一个表,但有没有办法利用sqlSave()函数为我写一个整个表给Hive?

myconn <- odbcConnect(dsn = "dsn1",uid="username1",pwd="password1")
test <- data.frame(a = c(1,2,3,4,5), b = c("one", "two", "three", "four", 
"five"))

sqlSave(myconn, dat = test, tablename = "schema1.test")

我收到以下错误:

Error in sqlSave(myconn, dat = test, tablename = "cao_analytics.test") : 
HY000 80 [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 1:34 cannot recognize input 
near '"rownames"' 'varchar' '(' in column specification
[RODBC] ERROR: Could not SQLExecDirect 'CREATE TABLE cao_analytics.test  
("rownames" varchar(255), "a" DOUBLE, "b" varchar(255))'

0 个答案:

没有答案
相关问题