I currently have access to an Apache Hive database via the beeline
CLI. We are still negotiating with IT to get R
on the server. Until that time, I would like to (ab)use the R
dbplyr
package to generate SQL queries on another machine, copy them over, and run them as raw SQL. I have used sql_render
in dbplyr
in the past in instances where I had a valid database connection, but I do not know how to do this without a valid database connection. The ideal case, for me would be something like:
con <- dummy_connection('hive') # this does not exist, I think
qry <- tbl(con,'mytable') %>% # complex logic to build a query
select(var1,var2) %>%
filter(var1 > 0) # etc...
sql_render(qry) %>% # cat it to a file to be used on another machine.
as.character() %>%
cat()
Is there a way to make this 'dummy' connection? And can it be done in such a way that I can specify the variant of SQL?