|
1 | 1 | #' @title Compile a PRQL query into a SQL query
|
2 |
| -#' @param prql_query a PRQL query string. |
3 |
| -#' @param target a compile target name to use. If not specified (`NULL`), |
4 |
| -#' the target contained in the query will be used. |
5 |
| -#' All available target names can be listed with the [prql_get_targets] function. |
6 |
| -#' @param format a logical flag (default: `TRUE`). Whether to format the SQL query. |
| 2 | +#' @param prql_query A character of PRQL query. |
| 3 | +#' @param target A character of the target name to use or `NULL`. |
| 4 | +#' If `NULL`, the target contained in the query will be used. |
| 5 | +#' All available target names can be listed with the [prql_get_targets()] function. |
| 6 | +#' @param ... Ignored. |
| 7 | +#' @param format A logical flag (default: `TRUE`). Whether to format the SQL query. |
7 | 8 | #' @param signature_comment a logical flag. (default: `TRUE`).
|
8 | 9 | #' Whether to add a signature comment to the output SQL query.
|
9 |
| -#' @return a SQL query string |
10 |
| -#' @seealso [prql_get_targets] |
| 10 | +#' @param display A character, one of `"plain"` (default) or `"ansi_color"`. |
| 11 | +#' If `"ansi_color"`, error will be displayed with ANSI color. |
| 12 | +#' @return A character of the compiled SQL query. |
11 | 13 | #' @examples
|
12 | 14 | #' "from mtcars | filter cyl > 6 | select {cyl, mpg}" |>
|
13 | 15 | #' prql_compile()
|
|
38 | 40 | prql_compile <- function(
|
39 | 41 | prql_query,
|
40 | 42 | target = getOption("prqlr.target", default = NULL),
|
| 43 | + ..., |
41 | 44 | format = getOption("prqlr.format", default = TRUE),
|
42 |
| - signature_comment = getOption("prqlr.signature_comment", default = TRUE)) { |
43 |
| - compile(prql_query, target %||% "sql.any", format, signature_comment) |
| 45 | + signature_comment = getOption("prqlr.signature_comment", default = TRUE), |
| 46 | + display = getOption("prqlr.display", default = "plain")) { |
| 47 | + compile( |
| 48 | + prql_query, |
| 49 | + target = target %||% "sql.any", |
| 50 | + format = format, |
| 51 | + signature_comment = signature_comment, |
| 52 | + display = display |
| 53 | + ) |
44 | 54 | }
|
45 | 55 |
|
46 | 56 | #' @title prqlc's version
|
|
0 commit comments