MCPcopy Create free account
hub / github.com/rilldata/rill / createTableAsSelect

Function createTableAsSelect

runtime/server/controller_test.go:281–303  ·  view source on GitHub ↗

createTableAsSelect is a test utility for creating a table directly in an OLAP connector. It invokes a model executor directly without actually creating a model resource. This is useful for testing resources against pre-existing/external tables.

(t *testing.T, rt *runtime.Runtime, instanceID, connector, name, sql string)

Source from the content-addressed store, hash-verified

279// It invokes a model executor directly without actually creating a model resource.
280// This is useful for testing resources against pre-existing/external tables.
281func createTableAsSelect(t *testing.T, rt *runtime.Runtime, instanceID, connector, name, sql string) {
282 h, release, err := rt.AcquireHandle(context.Background(), instanceID, connector)
283 require.NoError(t, err)
284 defer release()
285 opts := &drivers.ModelExecutorOptions{
286 Env: &drivers.ModelEnv{},
287 ModelName: name,
288 InputHandle: h,
289 InputConnector: connector,
290 PreliminaryInputProperties: map[string]any{"sql": sql},
291 OutputHandle: h,
292 OutputConnector: connector,
293 PreliminaryOutputProperties: map[string]any{"table": name},
294 }
295 me, err := h.AsModelExecutor(instanceID, opts)
296 require.NoError(t, err)
297 _, err = me.Execute(context.Background(), &drivers.ModelExecuteOptions{
298 ModelExecutorOptions: opts,
299 InputProperties: opts.PreliminaryInputProperties,
300 OutputProperties: opts.PreliminaryOutputProperties,
301 })
302 require.NoError(t, err)
303}

Callers 2

TestCreateTriggerAllFunction · 0.85
TestModelChangeModesFunction · 0.85

Calls 3

AcquireHandleMethod · 0.80
AsModelExecutorMethod · 0.65
ExecuteMethod · 0.65

Tested by

no test coverage detected