% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/verb-collect.R
\name{collect.tbl_sql}
\alias{collect.tbl_sql}
\title{Collect results into a local data frame}
\usage{
\method{collect}{tbl_sql}(
  x,
  ...,
  n = Inf,
  warn_incomplete = TRUE,
  sql_options = NULL,
  cte = deprecated()
)
}
\arguments{
\item{x}{A lazy data frame backed by a database query.}

\item{...}{Ignored.}

\item{n}{Number of rows to fetch. Defaults to \code{Inf}, meaning all rows.}

\item{warn_incomplete}{Warn if \code{n} is less than the number of result rows?}

\item{sql_options}{SQL rendering options generated by \code{\link[=sql_options]{sql_options()}}.}

\item{cte}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}
Use the \code{sql_options} argument instead.}
}
\description{
\code{collect()} executes the query and retrieves the results into a local tibble.
This brings all the data from the database into R's memory, which is useful
once you've done as much as possible in the database, and now need to use
R functions.
}
\examples{
library(dplyr, warn.conflicts = FALSE)

db <- memdb_frame(a = c(3, 4, 1, 2), b = c(5, 1, 2, NA))
db |> filter(a <= 2) |> collect()
}
