qryflow_run {qryflow}R Documentation

Parse and execute a tagged SQL workflow

Description

qryflow_run() reads a SQL workflow from a file path or character string, parses it into tagged statements, and executes those statements against a database connection.

This function is typically used internally by qryflow(), but can also be called directly for more control over workflow execution.

Usage

qryflow_run(sql, con, ...)

Arguments

sql

A character string representing either the path to a .sql file or raw SQL content.

con

A database connection from DBI::dbConnect()

...

Additional arguments passed to qryflow_execute().

Value

A list representing the evaluated workflow, containing query results, execution metadata, or both, depending on the contents of the SQL script.

See Also

qryflow(), qryflow_results(), qryflow_execute(), qryflow_parse()

Examples

con <- example_db_connect(mtcars)

filepath <- example_sql_path("mtcars.sql")

obj <- qryflow_run(filepath, con)

obj$df_mtcars$sql
obj$df_mtcars$results

results <- qryflow_results(obj)

head(results$df_mtcars$results)

DBI::dbDisconnect(con)

[Package qryflow version 0.1.0 Index]