dettl_run.Rd
Run specified stages of an import
dettl_run(
import,
db_name = NULL,
comment = NULL,
dry_run = FALSE,
allow_dirty_git = FALSE,
stage = c("extract", "transform"),
...
)
Path to import directory.
The name of the db to connect to. Connection info must be configured via the `dettl_config.yml`. If name is left blank this will default to using the first db configured.
Optional comment to be written to db log table when import is run.
If TRUE then any changes to the database will be rolled back.
If TRUE then skips check that the import is up to date with remote git repo.
The stage or stages of the import to be run.
Additional args passed to run_import for a specific import type
see RImport$run_import()
The import object
path <- dettl:::prepare_test_import(
system.file("examples", "person_information", package = "dettl"),
system.file("examples", "dettl_config.yml", package = "dettl")
)
dettl::dettl_run(file.path(path, "person_information/"), "test",
comment = "Example import")
#> Running extract /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running extract tests R/test_extract.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | extract
#> ⠏ | 0 | extract
#> ✔ | 1 | extract
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#>
#> 💅 Your tests are beautiful 💅
#> All extract tests passed.
#> Running transform /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running transform tests R/test_transform.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | transform
#> ⠏ | 0 | transform
#> ✔ | 1 | transform
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All transform tests passed.
dettl::dettl_run(file.path(path, "person_information/"), "test",
comment = "Example import",
save = tempfile())
#> Running extract /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running extract tests R/test_extract.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | extract
#> ⠏ | 0 | extract
#> ✔ | 1 | extract
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All extract tests passed.
#> Running transform /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running transform tests R/test_transform.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | transform
#> ⠏ | 0 | transform
#> ✔ | 1 | transform
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All transform tests passed.
#> Saved extract data to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpiqOfW1/file14a929c6aef0
#> Saved transform data to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpiqOfW1/file14a929c6aef0
import <- dettl::dettl_run(file.path(path, "person_information/"),
"test", stage = "extract")
#> Running extract /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running extract tests R/test_extract.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | extract
#> ⠏ | 0 | extract
#> ✔ | 1 | extract
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All extract tests passed.
dettl::dettl_run(file.path(path, "person_information/"), "test",
stage = c("extract", "transform", "load"),
comment = "Example import")
#> Running extract /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running extract tests R/test_extract.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | extract
#> ⠏ | 0 | extract
#> ✔ | 1 | extract
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All extract tests passed.
#> Running transform /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running transform tests R/test_transform.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | transform
#> ⠏ | 0 | transform
#> ✔ | 1 | transform
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All transform tests passed.
#> Running load /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a97fba72cb/person_information
#> Running load in a transaction:
#> - Running test queries before making any changes
#> - Running load step
#> - Running test queries after making changes
#> - Running load tests R/test_load.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | load
#> ⠏ | 0 | load
#> ✔ | 1 | load
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All tests passed, commiting changes to database.