% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reader.R
\name{ggsql_execute}
\alias{ggsql_execute}
\alias{ggsql_execute_sql}
\title{Execute a ggsql query}
\usage{
ggsql_execute(reader, query)

ggsql_execute_sql(reader, query)
}
\arguments{
\item{reader}{A \code{Reader} object created by e.g. \code{\link[=duckdb_reader]{duckdb_reader()}} or
\code{\link[=odbc_reader]{odbc_reader()}}.}

\item{query}{A ggsql query string (SQL + VISUALISE clause).}
}
\value{
\code{ggsql_execute()} returns \code{Spec} object. \code{ggsql_execute_sql()}
returns a data frame or \code{NULL}
}
\description{
Parses the query, and execute it against the reader's database. Returns
either a visualization specification ready for rendering (\code{ggsql_execute}) or
a data frame with the query result (\code{ggsql_execute_sql}).
}
\examples{
reader <- duckdb_reader()
ggsql_register(reader, mtcars, "cars")
spec <- ggsql_execute(reader,
  "SELECT * FROM cars VISUALISE mpg AS x, disp AS y DRAW point"
)

}
