如何使用odbc连接将rDataframe写入配置单元?

yacmzcpb  于 2021-06-26  发布在  Hive
关注(0)|答案(0)|浏览(223)

使用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))'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题