Func
Represents a function in the Datagrok platform. In Grok, nearly every executable action—whether it's a data query, a script, a UI action, or a predictive model—is represented as a Func. This unified abstraction provides a consistent way to define, discover, secure, and execute platform capabilities. Examples of functions in Grok include: * Querying an external PostgreSQL database * Executing JavaScript code in the browser that uses Grok APIs * Performing mathematical calculations (e.g., Sin(PI)) * Modifying datasets (e.g., deleting a column) * Sending an email * Applying a predictive model to a dataset * Calculating molecular properties via a Python script * Displaying interactive dialogs Despite their differences (server-side vs client-side execution, computational vs UI-based tasks), all functions share a common set of capabilities: * Scriptable: Callable from the console or scripts. * Findable: Searchable through the "Help | Functions" interface. * Introspectable: Metadata about parameters is programmatically accessible. * Secure: Access can be restricted via privileges or user groups. * Auditable: Execution history and parameters are tracked. * Runnable: The platform can dynamically generate UI for parameters. * Linkable: Functions can be linked in dashboards, conversations, etc. * Composable: Usable in workflow designers and query transformations.
Attributes
| Name | Type | Description |
|---|---|---|
| source | Optional[str] | Identifies the origin or type of function (e.g., "function", "sql-query", "js-script"). |
| options | Optional[Dict[str, Any]] | Arbitrary function-specific configuration options. |
| tags | Optional[List[str]] | Keywords or categories associated with the function. |
| description | Optional[str] | A human-readable description of the function's purpose. |
| params | Optional[List[FuncParam]] | List of parameter definitions for the function. **kwargs Additional arguments passed to the parent NamedModel initializer, such as id, name, friendly_name, created_on, updated_on, and namespace. |
| params | list of FuncParam | Parameter definitions (both input and output). |
| source | str | Function type or origin. |
| tags | list of str | Function categories or keywords. |
| description | str | Human-readable description. |
| options | dict | Function-specific settings. |
| input_params | list of FuncParam | Parameters marked as inputs to the function. |
| output_params | list of FuncParam | Parameters marked as outputs from the function. |