Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
daranzolin committed Jun 4, 2024
1 parent 51f96b6 commit 53e1b2f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
12 changes: 7 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ knitr::opts_chunk$set(

<!-- badges: end -->

sqltargets makes it easy to integrate SQL files within your [targets workflows.](https://github.com/ropensci/targets) The shorthand tar_sql() creates two targets: (1) the ‘upstream’ SQL file; and (2) the ‘downstream’ result of the query. Dependencies can be specified by calling tar_load() within SQL comments. Parameters can be specified using glue::glue_sql() bracket notation (‘{}’) (or configured using `sqltargets.glue_sql_delimiters` options (dev only)).
sqltargets makes it easy to integrate SQL files within your [targets workflows.](https://github.com/ropensci/targets) The shorthand `tar_sql()` creates two targets: (1) the ‘upstream’ SQL file; and (2) the ‘downstream’ result of the query. Dependencies can be specified by calling `tar_load()` within SQL comments. Parameters can be specified using glue::glue_sql() bracket notation (‘{}’) (or configured using the `sqltargets.glue_sql_opening_delimiter` and `sqltargets.glue_sql_closing_delimiter` options (dev only)).

## Installation

Expand Down Expand Up @@ -56,7 +56,6 @@ tar_dir({ #
writeLines(lines, "query.sql")
# Include the query in a pipeline as follows.
tar_script({
library(tarchetypes)
library(sqltargets)
list(
tar_sql(query, path = "query.sql")
Expand Down Expand Up @@ -88,7 +87,7 @@ lines <- c(
Pass parameters (presumably from another object in your targets project) from a named list with
'glue' syntax: `{param}`.
query.sql
`query.sql`
```sql
-- !preview conn=DBI::dbConnect(RSQLite::SQLite())
Expand All @@ -101,15 +100,18 @@ where age > {age_threshold}
```{r eval = FALSE}
tar_script({
library(targets)
library(tarchetypes)
library(sqltargets)
list(
tar_target(query_params, list(age_threshold = 30)),
tar_sql(query, path = "query.sql", query_params = query_params)
tar_sql(report, path = "query.sql", query_params = query_params)
)
}, ask = FALSE)
tar_visnetwork()
```
![](inst/tar_visnetwork.png)
## Code of Conduct
Please note that the sqltargets project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ Targetopia](https://img.shields.io/badge/R_Targetopia-member-blue?style=flat&lab
<!-- badges: end -->

sqltargets makes it easy to integrate SQL files within your [targets
workflows.](https://github.com/ropensci/targets) The shorthand tar_sql()
creates two targets: (1) the ‘upstream’ SQL file; and (2) the
‘downstream’ result of the query. Dependencies can be specified by
calling tar_load() within SQL comments. Parameters can be specified
using glue::glue_sql() bracket notation (‘{}’) (or configured using
`sqltargets.glue_sql_delimiters` options (dev only)).
workflows.](https://github.com/ropensci/targets) The shorthand
`tar_sql()` creates two targets: (1) the ‘upstream’ SQL file; and (2)
the ‘downstream’ result of the query. Dependencies can be specified by
calling `tar_load()` within SQL comments. Parameters can be specified
using glue::glue_sql() bracket notation (‘{}’) (or configured using the
`sqltargets.glue_sql_opening_delimiter` and
`sqltargets.glue_sql_closing_delimiter` options (dev only)).

## Installation

Expand Down Expand Up @@ -56,7 +57,6 @@ tar_dir({ #
writeLines(lines, "query.sql")
# Include the query in a pipeline as follows.
tar_script({
library(tarchetypes)
library(sqltargets)
list(
tar_sql(query, path = "query.sql")
Expand Down Expand Up @@ -90,7 +90,7 @@ lines <- c(
Pass parameters (presumably from another object in your targets project)
from a named list with ‘glue’ syntax: `{param}`.
query.sql
`query.sql`
``` sql
-- !preview conn=DBI::dbConnect(RSQLite::SQLite())
Expand All @@ -103,15 +103,18 @@ where age > {age_threshold}
``` r
tar_script({
library(targets)
library(tarchetypes)
library(sqltargets)
list(
tar_target(query_params, list(age_threshold = 30)),
tar_sql(query, path = "query.sql", query_params = query_params)
tar_sql(report, path = "query.sql", query_params = query_params)
)
}, ask = FALSE)
tar_visnetwork()
```
![](inst/tar_visnetwork.png)
## Code of Conduct
Please note that the sqltargets project is released with a [Contributor
Expand Down
Binary file added inst/tar_visnetwork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 53e1b2f

Please sign in to comment.