% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reader.R
\name{ggsql_register}
\alias{ggsql_register}
\alias{ggsql_unregister}
\alias{ggsql_table}
\alias{ggsql_table_names}
\title{Register and unregisters a data frame as a queryable table}
\usage{
ggsql_register(reader, df, name, replace = FALSE)

ggsql_unregister(reader, name)

ggsql_table(reader, name)

ggsql_table_names(reader)
}
\arguments{
\item{reader}{A \code{Reader} object created by e.g. \code{\link[=duckdb_reader]{duckdb_reader()}}.}

\item{df}{A data frame to register.}

\item{name}{The name of the table.}

\item{replace}{If \code{TRUE}, replace an existing table with the same name.
Defaults to \code{FALSE}.}
}
\value{
\code{reader} for \code{ggsql_register()} and \code{ggsql_unregister()}.
\code{ggsql_table} returns a data.frame if the table exists and \code{NULL} if not.
\code{ggsql_table_names} return a character vector.
}
\description{
After registration, the data frame can be queried by name in SQL statements.
You can use \code{ggsql_table} to extract tables from the reader (both registered
ones and those native to the backend) and \code{ggsql_table_names} to get a vector
of all the tables in reader.
}
\examples{
reader <- duckdb_reader()
ggsql_register(reader, mtcars, "cars")

ggsql_table_names(reader)

ggsql_table(reader, "cars")

ggsql_unregister(reader, "cars")

ggsql_table_names(reader)

}
