A flexible API that can be converted to an RStudio Connection Contract
rscontract_spec(
connection_object = NULL,
type = "spec_type",
host = "spec_host",
icon = NULL,
name = "",
connect_script = "library(connections)\n[Place your code here]",
disconnect_code = "function() rscontract_close('spec_host', 'spec_type')",
preview_code = "function(){}",
catalog_list = "sample_catalog()",
object_types = "default_types()",
object_list = NULL,
object_columns = NULL,
actions = NULL
)
The connection object. Default to NULL.
Type of the connection.
Name of the host
Path to the connection's icon. Defaults to NULL.
The connection's name.
The text of the connection code.
Function to use to disconnect. Default to function().
Function to run when the preview table icon is clicked on. Default to function().
Hierarchical list of the catalogs, schema, table/view and fields.
Function that provides the structure of the connection. The default function will work properly, it is going to be rare when it needs to be changed.
Function to run to get the catalogs, schema, tables or views based what has been expanded on. Defaults to NULL.
Function to run that pull the field information. Default to NULL
Additional buttons to add to the connection pane. Defaults to NULL.
Returns an `rscontract_spec` class object
# NOT RUN {
str(rscontract_spec())
# }
Run the code above in your browser using DataLab