Clickhouse connection

Hi everyone, I need to connect RStudio to ClickHouse and then be able to run SQL queries in R Markdown, generating a pre-formatted table that I can view in the environment instead of a string that needs to be parsed with another function.

I tried to connect with:
con_click <- clickhouse_http_api(
host = host,
port = port,
user = user,
password = password,
dbname =
)
but i have this error "Error in clickhouse_http_api(host = host, port = port, user = user, password = password, :
could not find function "clickhouse_http_api""

I tried also with:
library(httr)

Config connection

url <- "http://xxxxxx/"
user <- "xxxx"
password <- "xxxxx"

query <- "select * from aaa.aaa_detail aum LIMIT 10"

Query execution

response <- GET(url, authenticate(user, password), query = list(query = query))

This connection works, but the response is a list e not a table.

I would like to create a connection that allows me to use a query like this (in R markdown)

```{sql connection=con_click,  output.var=prova}
select *
from aaa.aaa_detail pd 
limit 10

Someone can help me?
Thank you
Elisa

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.