Prerequisites
The Kyvos ODBC driver should be installed and configured on the computer where you want to use R to connect to the Kyvos semantic model.
Steps to connect to Kyvos using R
Install R from the following link:
https://cloud.r-project.org/Open R and run the following command to install the ODBC package.
Code Block install.packages("odbc")
...
Verify that ODBC recognizes the installed drivers using odbcListDrivers() command.
Code Block library(odbc) sort(unique(odbcListDrivers()[[1]]))
Here’s a screenshot for reference.
Connect to Kyvos using the following command.
Code Block library(odbc) con <- dbConnect(odbc::odbc(), driver = "Kyvos ODBC Driver", UserName = "username", PWD = "password", host = "192.168.8.190", port=8081, HTTPPath = "kyvos/sql")
Verify the above connection with the command below.
Code Block dbIsValid(con) #Returns TRUE if connection is established else return FALSE.
Run the queries using the following command.
Code Block dbGetQuery(con,'Paste your SQL query here')
After executing the queries close the connection using the dbDisconnect(con). command.
Execute the dbIsValid(con) command to ensure that the connection is disconnected.