Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

SET Location in dbwrite table in r

avatar
Explorer

I am using Rstudio and I need to save some tables in my sandbox, however I cannot specify the location, because by default we send the tables to the path: hdfs: //haprod/warehouse/tablespace/managed/hive/cld_ml_bi_eng.db/iris How can I specify the location when writing the table is in the LOCATION '/sandbox/CLD_ML_BI_ENG/iris'

 

library(DBI)
library(odbc)
con_Hive <- dbConnect(odbc::odbc(), "Hive_produccion", database = "cld_ml_bi_eng", encoding = "latin1")
colnames(iris) <- gsub(pattern = "\\.", replacement = "_", x = colnames(iris))
dbWriteTable(conn = con_Hive, name = Id(schema = "cld_ml_bi_eng", table = "iris"), value = iris)

LOCATION '/sandbox/CLD_ML_BI_ENG/iris'

 

1 ACCEPTED SOLUTION

avatar
Guru

AFAIK the table location should be set at the time of Creation.

 

You can set files in a different location.

 

You can use ALTER TABLE jsont1 SET LOCATION "hdfs://mycluster:8020/jsam/j1"; to change the location and need to move the files manually from old location to new location.

View solution in original post

1 REPLY 1

avatar
Guru

AFAIK the table location should be set at the time of Creation.

 

You can set files in a different location.

 

You can use ALTER TABLE jsont1 SET LOCATION "hdfs://mycluster:8020/jsam/j1"; to change the location and need to move the files manually from old location to new location.