sqltargets
sqltargets copied to clipboard
tar_sql path parameter to depend on previous steps
I'm looking to achieve something like the following:
list(
tar_sql(
max_migration_version_str,
path = here::here("sql", "get_migration_version.sql")
),
tar_sql(
dataset,
path = here::here("sql", max_migration_version_str, "extract_dataset.sql")
),
...
)
This requires the path to become a dependent of basename(path) within another tar_target since it itself depends on max_migration_version_str.
Hmmm, does the second path already exist at runtime? Or is it created during? Without testing I think you'd have to do something like:
list(
tar_sql(
max_migration_version_str,
path = here::here("sql", "get_migration_version.sql")
),
tarchetypes::tar_file(
extract_dataset_query,
fs::path(here::here(), "sql", max_migration_version_str, "extract_dataset.sql")
)
tar_sql(
dataset,
path = extract_dataset_query
),
...
)