Manage SQL based data import.

Manage SQL based data import.

Details

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.

Super class

dettl::Import -> SqlImport

Methods

Inherited methods


Method reload()

Reload the objects sources to refresh source code or repair a broken Postgres connection.

Usage

SqlImport$reload()


Method read_config()

Read and parse config from path.

Usage

SqlImport$read_config()

Examples

path <- dettl:::prepare_test_import(
  system.file("examples", "sql_example", package = "dettl"),
  system.file("examples", "dettl_config.yml", package = "dettl"))
import_path <- file.path(path, "sql_example")

import <- dettl::dettl(import_path, db_name = "test")
import$run_import(stage = c("extract", "transform", "load"))
#> No extract function defined for this import, skipping step
#> No transform function defined for this import, skipping step
#> Running load /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a96a3d9bd9/sql_example
#> 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 | counts-test                                                     
#>  |         1 | counts-test
#> 
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All tests passed, commiting changes to database.