Skip to contents

The deletion of workflows from wflow_tbl is specified separately to avoid mistakes.

Usage

rpwf_db_del_entry(tbls, id, db_con)

Arguments

tbls

vector of character of table names, i.e., "df_tbl", "model_type_tbl", "r_grid_tbl", "r_grid_tbl", "wflow_result_tbl".

id

vector of ids to be deleted from a particular table.

db_con

an rpwf_connect_db() object.

Value

Called for the side effect.

Examples

board <- pins::board_temp()
tmp_dir <- tempdir()
db_con <- rpwf_connect_db(paste(tmp_dir, "db.SQLite", sep = "/"), board)
# Before deleting
DBI::dbGetQuery(db_con$con, "SELECT * FROM model_type_tbl;")
#>   model_type_id            py_module        py_base_learner r_engine
#> 1             1 sklearn.linear_model     LogisticRegression   glmnet
#> 2             2 sklearn.linear_model             ElasticNet   glmnet
#> 3             3          sklearn.svm                    SVC  kernlab
#> 4             4          sklearn.svm                    SVR  kernlab
#> 5             5              xgboost          XGBClassifier  xgboost
#> 6             6     sklearn.ensemble RandomForestClassifier    rpart
#>                                                                                                                                                                                       hyper_par_rename
#> 1                                                                                                                                                             {"penalty":["C"],"mixture":["l1_ratio"]}
#> 2                                                                                                                                                         {"penalty":["alpha"],"mixture":["l1_ratio"]}
#> 3                                                                                          {"cost":["C"],"degree":["degree"],"scale_factor":["gamma"],"rbf_sigma":["gamma"],"kernel_offset":["coef0"]}
#> 4                                                                     {"cost":["C"],"degree":["degree"],"scale_factor":["gamma"],"rbf_sigma":["gamma"],"kernel_offset":["coef0"],"margin":["epsilon"]}
#> 5 {"mtry":["colsample_bytree"],"trees":["n_estimators"],"min_n":["min_child_weight"],"tree_depth":["max_depth"],"learn_rate":["learning_rate"],"loss_reduction":["gamma"],"sample_size":["subsample"]}
#> 6                                                                                                           {"cost_complexity":["ccp_alpha"],"tree_depth":["max_depth"],"min_n":["min_samples_split"]}
#>       model_mode
#> 1 classification
#> 2     regression
#> 3 classification
#> 4     regression
#> 5 classification
#> 6 classification
rpwf_db_del_entry("model_type_tbl", 1, db_con)
# After deleting
DBI::dbGetQuery(db_con$con, "SELECT * FROM model_type_tbl;")
#>   model_type_id            py_module        py_base_learner r_engine
#> 1             2 sklearn.linear_model             ElasticNet   glmnet
#> 2             3          sklearn.svm                    SVC  kernlab
#> 3             4          sklearn.svm                    SVR  kernlab
#> 4             5              xgboost          XGBClassifier  xgboost
#> 5             6     sklearn.ensemble RandomForestClassifier    rpart
#>                                                                                                                                                                                       hyper_par_rename
#> 1                                                                                                                                                         {"penalty":["alpha"],"mixture":["l1_ratio"]}
#> 2                                                                                          {"cost":["C"],"degree":["degree"],"scale_factor":["gamma"],"rbf_sigma":["gamma"],"kernel_offset":["coef0"]}
#> 3                                                                     {"cost":["C"],"degree":["degree"],"scale_factor":["gamma"],"rbf_sigma":["gamma"],"kernel_offset":["coef0"],"margin":["epsilon"]}
#> 4 {"mtry":["colsample_bytree"],"trees":["n_estimators"],"min_n":["min_child_weight"],"tree_depth":["max_depth"],"learn_rate":["learning_rate"],"loss_reduction":["gamma"],"sample_size":["subsample"]}
#> 5                                                                                                           {"cost_complexity":["ccp_alpha"],"tree_depth":["max_depth"],"min_n":["min_samples_split"]}
#>       model_mode
#> 1     regression
#> 2 classification
#> 3     regression
#> 4 classification
#> 5 classification