Documentation
¶
Overview ¶
Package exporttable is the register= argument of a managed script's platform.export (#1820): what it may ask for, which outputs it applies to, the manage_table call it becomes, and what that call reports back.
It exists so one call can land rows in a file and make the file a table. Before it, the path from script rows to a queryable table was three calls a script had to get right in order -- export, find the reference, register -- and it was also the only path free text had into SQL, because trino_execute binds no parameters. The registration is not a second mechanism: it is the same manage_table register a script could call itself, issued over the run's own session, so it is authorized and audited the way that call is.
It knows nothing about Starlark or about the run. The host binding hands it plain Go values and the tool's structured result.
Index ¶
Constants ¶
const ( Tool = "manage_table" Action = "register" )
Tool and Action are the call a registration becomes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Spec ¶
type Spec struct {
// Connection is the Trino connection whose scratch schema the table goes
// in. Required.
Connection string
// TableName is the table's name before the persona prefix. Empty takes a
// slug of the file's name, as manage_table does.
TableName string
// Follow moves the table onto each later version of the file. It defaults
// to true, as manage_table's does: a script that exports to one key every
// run wants the table to read the latest run.
Follow bool
}
Spec is what a register= argument asks for.
func Parse ¶
Parse reads a register= value, already converted from Starlark to plain Go. nil means the argument was not passed, and yields a nil Spec.
type Table ¶
type Table struct {
Connection string `json:"connection"`
QueryTable string `json:"query_table,omitempty"`
RegistrationID string `json:"registration_id,omitempty"`
Columns []string `json:"columns,omitempty"`
Format string `json:"format,omitempty"`
Follow bool `json:"follow"`
// Preview marks a registration a draft reports rather than makes: the
// output was not written, so there was no file to register.
Preview bool `json:"preview,omitempty"`
}
Table is the registration an export made, or would have made.
func FromResult ¶
FromResult reads the registration out of manage_table's structured result.