RImport.Rd
Manage R based data import.
Manage R based data import.
This object should not be initialised directly. Use dettl
to
create the object.
Import can be run by working with import object returned by
dettl
or by running top-level functions. Run the import by
working with this object if you want to step through the import process
stage by stage and inspect the data after each stage.
dettl::Import
-> RImport
reload()
Reload the objects sources to refresh source code or repair a broken Postgres connection.
run_import()
Run multiple stages of the data import
RImport$run_import(
comment = NULL,
dry_run = FALSE,
allow_dirty_git = FALSE,
stage = c("extract", "transform"),
save = FALSE
)
comment
Optional comment to be written to db log table when import is run.
dry_run
If TRUE then any changes to the database will be rolled back.
allow_dirty_git
If TRUE then skips check that the import is up to date
stage
The stage or stages of the import to be run.
save
Path and name to save data from each stage at, if TRUE then will save to a tempfile.
path <- dettl:::prepare_test_import(
system.file("examples", "person_information", package = "dettl"),
system.file("examples", "dettl_config.yml", package = "dettl"))
import_path <- file.path(path, "person_information")
import <- dettl::dettl(import_path, db_name = "test")
import$extract()
#> Running extract /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a91c74a0c1/person_information
#> Running extract tests R/test_extract.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | extract
#> ⠏ | 0 | extract
#> ✔ | 1 | extract [0.2s]
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> Duration: 0.2 s
#>
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All extract tests passed.
import$transform()
#> Running transform /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a91c74a0c1/person_information
#> Running transform tests R/test_transform.R
#> ✔ | F W S OK | Context
#>
#> ⠏ | 0 | transform
#> ⠏ | 0 | transform
#> ✔ | 1 | transform
#>
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> Duration: 0.2 s
#>
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All transform tests passed.
import$load()
#> Running load /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a91c74a0c1/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.