Write a hive command with odbc connection?

I have a connection to hive using odbc:

library(DBI)
library(odbc)
hive_con <- dbConnect(odbc(), 
                 dsn = "Hive",
                 Host   = "emr-example-running.bi.aws.us.ourco.com",
                 Port   = 10000)

When I run this in rstudio the connections pane opens up and I am able to see all of the schemas and tables.

I would like to run a hive command that is not a select statement MSCK repair table adhoc.mtcars.

I tried

DBI::dbSendQuery(hive_con, "MSCK repair table adhoc.mtcars")

That did not work and then when I looked at the documentation for DBI::dbSendQuery it says

This method is for SELECT queries only

Since I'm not trying to write a select query, is there a way to run a hive command using my odbc connection?

I've had success using DBI:GetQuery() to execute statements in SQL Server, but not sure if it'd work on Hive.

 DBI::dbGetQuery(con, "EXEC [dbo].[procedure_name]")

Hi, thanks for the suggestion I tried that:

 DBI::dbGetQuery(con, "MSCK repair table adhoc.mtcars")

This failed to execute. Any other suggestions most welcome.

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