Skip to contents

Configuration is read from the remote R process environment by default. Use [thip_setup()] once inside THIP to save user-level configuration, unless the platform already supplies it. Explicit arguments override the environment. Run this inside the THIP network. The PC's Jupyter API token is not a database credential and is not used by this package.

Usage

thip_connect(
  host = Sys.getenv("THIP_DB_HOST"),
  port = Sys.getenv("THIP_DB_PORT", "8123"),
  database = Sys.getenv("THIP_DB_NAME", "thip"),
  user = Sys.getenv("THIP_DB_USER"),
  password = Sys.getenv("THIP_DB_PASSWORD"),
  scheme = Sys.getenv("THIP_DB_SCHEME", "http"),
  max_seconds = NULL,
  max_threads = 2L,
  max_rows = NULL
)

Arguments

host

Database hostname; defaults to THIP_DB_HOST.

port

HTTP port; defaults to THIP_DB_PORT or 8123.

database

Database name; defaults to THIP_DB_NAME or thip.

user

Database username; defaults to THIP_DB_USER.

password

Database password; defaults to THIP_DB_PASSWORD.

scheme

Either http or https; defaults to THIP_DB_SCHEME or http.

max_seconds

Server query time limit, in seconds; NULL inherits the platform setting.

max_threads

Maximum server threads per query, default 2; NULL inherits the platform setting.

max_rows

Server result row limit; NULL inherits the platform setting. Explicit limits must be positive; overflow raises an error, never truncation.

Value

A verified ClickHouseHTTP DBI connection.

Details

Every request includes readonly=1 and overflow mode `throw`. Optional resource limits complement, rather than replace, operator-provisioned read-only database permissions. Do not alter the returned object's slots or use SQL to override these settings.

The returned object is a genuine `ClickHouseHTTPConnection`, usable with `DBI::dbGetQuery()` and `dplyr::tbl()`. Connection setup uses the driver's exported connection class because its `dbConnect()` method issues USE and SET statements. This factory sends SELECT only; all query transport, result decoding and dbplyr translation remain in the upstream driver. Tested with ClickHouseHTTP 1.1.2: older versions are refused, a newer version that changes the connection structure stops with a clear message, and other newer versions warn once per session.

Examples

if (FALSE) { # \dontrun{
con <- thip_connect()
DBI::dbGetQuery(con, "SELECT 1 AS connection_ok")
DBI::dbDisconnect(con)
} # }