Skip to contents

Reverse engineer a table from its description from a SQL query

Usage

create_table(tbl_name)

Arguments

tbl_name

Table with holds the value with both the TABLE_NAME as well as the COLUMN_NAME. See details and examples

Value

a tibble assigned to the GlobalEnv

Details

The table to create derives its name from the TABLE_NAME column and the columns from the COLUMN_NAME column. Overall, the output comes from an Oracle DB

Examples

# mockup table descritpion
(tbl_descr <- tibble::tibble(TABLE_NAME = c("my_table"),
                             COLUMN_NAME = c("var1", "var2", "var3")))
#> # A tibble: 3 × 2
#>   TABLE_NAME COLUMN_NAME
#>   <chr>      <chr>      
#> 1 my_table   var1       
#> 2 my_table   var2       
#> 3 my_table   var3       
# now print the table
if (FALSE) create_table(tbl_descr) # \dontrun{}