User-Defined Function (UDF) object
User-Defined Function (UDF) object
| ... | Arguments passed on to
|
|---|
UDF objects store the definition of a user-defined function along with metadata and unit tests.
new()Initialize a udf object
udf$new( name, version, returns, volatility = c("volatile", "stable", "immutable"), language = c("sql", "plpythonu"), params = list(), body, description, schema = NA, replace = FALSE, authors = list(), tests = list(), ... )
nameThe UDF's name (e.g., "f_calculate_stuff")
versionA version string (e.g., "1.0")
returnsData type returned by this UDF (e.g., "float")
volatilityGiven the same inputs, the function will always return
the same result ("immutable"), will return the same result during a
given statement ("stable"), may return different results on successive
calls ("volatile").
languageString indicating the language used for the UDF's body
(e.g., "sql")
paramsA list of zero or more udfparameter objects specifying
input parameters
bodyThe body of the UDF containing SQL, Python, or other supported language
descriptionA detailed description of the UDF
schemaDatabase schema in which to place UDF (defualt: NA)
replaceLogical value indicating whether existing versions should
be replaced (default: FALSE)
authorsList of authors (e.g., list("Jane Doe"))
testsA list of zero or more udftest objects specifying test
cases for this UDF
...Additional arguments (not used)
write()Write UDF definition file
udf$write(file, ...)
create()Load a user-defined function
udf$create(conn, test = TRUE)
drop()Drop (delete) UDF
udf$drop(conn, cascade = FALSE)
test()Run tests
udf$test(conn)
clone()The objects of this class are cloneable with this method.
udf$clone(deep = FALSE)
deepWhether to make a deep clone.