Skip to content

Commit 1b46f0d

Browse files
authored
include tar_read as well as tar_load for walk_call_sql to consume (#25)
1 parent 3d75aaa commit 1b46f0d

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ sql_deps <- function(path) {
3030
sql_expr <- function(path) {
3131
tryCatch( {
3232
text <- sql_lines(path)
33-
text <- text[grepl("tar_load", text)]
33+
text <- text[grepl("tar_(load|read)", text)]
3434
parse(text = text)
3535
},
3636
error = function(e) {

tests/testthat/test-tar-sql-deps.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ targets::tar_test("tar_sql_deps() works", {
33
"-- !preview conn=DBI::dbConnect(RSQLite::SQLite())",
44
"-- tar_load(data1)",
55
"-- tar_load(data2)",
6+
"-- tar_read(data3)",
67
"select 1 as my_col",
78
""
89
)
@@ -17,5 +18,5 @@ targets::tar_test("tar_sql_deps() works", {
1718
})
1819
suppressMessages(targets::tar_make(callr_function = NULL))
1920
out <- tar_sql_deps("query.sql")
20-
expect_equal(out, c("data1", "data2"))
21+
expect_equal(out, c("data1", "data2", "data3"))
2122
})

0 commit comments

Comments
 (0)