% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/h3_extension.R
\name{ddbh3_create_conn}
\alias{ddbh3_create_conn}
\title{Create a DuckDB connection with spatial and h3 extensions}
\usage{
ddbh3_create_conn(
  dbdir = "memory",
  threads = NULL,
  memory_limit_gb = NULL,
  bigint = "integer64",
  ...
)
}
\arguments{
\item{dbdir}{String. Either "tempdir", "memory", or file path with .duckdb
or .db extension. Defaults to "memory".}

\item{threads}{Integer. Number of threads to use. If \code{NULL} (default), the setting is not changed, and DuckDB engine will use all available cores it detects (warning, on some shared HPC nodes the detected number of cores might be total number of cores on the node, not the per-job allocation).}

\item{memory_limit_gb}{Numeric. Memory limit in GB. If \code{NULL} (default), the setting is not changed, and DuckDB engine will use 80\% of available operating system memory it detects (warning, on some shared HPC nodes the detected memory might be the full node memory, not the per-job allocation).}

\item{bigint}{String. How to handle 64-bit integers. One of "integer64" or "numeric"}

\item{...}{Other parameters passed to \code{DBI::dbConnect()}}
}
\value{
A \code{duckdb_connection}
}
\description{
It creates a DuckDB connection, and then it installs and loads the
spatial and h3 extensions
}
\examples{
\donttest{
# load packages
library(duckspatial)
library(duckh3)

# create a duckdb database in memory
conn <- ddbh3_create_conn(dbdir = "memory", threads = 1)

# create an in-memory connection with 1 thread and 2GB memory limit
conn <- ddbh3_create_conn(threads = 1, memory_limit_gb = 2)

# Create a persistent database in disk
# conn <- ddbh3_create_conn(dbdir = "my_database.duckdb")

ddbs_stop_conn(conn)
}
}
