etl icon indicating copy to clipboard operation
etl copied to clipboard

kill etl_create()?

Open beanumber opened this issue 8 years ago • 4 comments

This is more problematic than I thought.

etl_create.default <- function(obj, ...) {
  obj <- obj %>%
    etl_init(...) %>%
    etl_update(...) %>%
    etl_cleanup(...)
  invisible(obj)
}

The problem is that these functions do not necessarily take the same arguments, so it's easy to pass unknown arguments to functions that don't take them, leading to unused argument errors.

I'm wondering if anything is lost if we simply remove etl_create. This would mean that users would have to call etl_init() explicitly if they wanted to initialize or re-initialize the database.

Note that as per #16 neither @nicholasjhorton nor @cpsievert like this function anyway.

beanumber avatar Jul 22 '16 13:07 beanumber

Have you considered using formals to filter for certain arguments?

jsonbecker avatar Oct 05 '16 13:10 jsonbecker

I haven't. How would it work here?

beanumber avatar Oct 05 '16 13:10 beanumber

If you call dots <- c(x[which(names(list(...)) %in% names(formals(etl_init)))]), for example, you could then call etl_inti(dots) and it would only contain arguments that are defined for etl_init etc.

jsonbecker avatar Oct 06 '16 04:10 jsonbecker

Right. I will think about this -- thanks!

beanumber avatar Oct 12 '16 19:10 beanumber