qryflow {qryflow} | R Documentation |
Run a multi-step SQL workflow and return query results
Description
qryflow()
is the main entry point to the qryflow
package. It executes a SQL workflow
defined in a tagged .sql
script or character string and returns query results as R objects.
The SQL script can contain multiple steps tagged with @query
or @exec
. Query results
are captured and returned as a named list, where names correspond to the @query
tags.
Usage
qryflow(sql, con, ..., simplify = TRUE)
Arguments
sql |
A file path to a |
con |
A database connection from |
... |
Additional arguments passed to |
simplify |
Logical; if |
Details
This is a wrapper around the combination of qryflow_run()
, which always provides a list of results and metadata,
and qryflow_results()
, which filters the output of qryflow_run()
to only include the results of the SQL.
Value
A named list of query results, or a single result if simplify = TRUE
and only one chunk exists.
See Also
qryflow_run()
, qryflow_results()
Examples
con <- example_db_connect(mtcars)
filepath <- example_sql_path("mtcars.sql")
results <- qryflow(filepath, con)
head(results$df_mtcars)
DBI::dbDisconnect(con)