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

Function newSource

runtime/controller_test.go:1225–1255  ·  view source on GitHub ↗
(name, path, localFileHash string, rows int64)

Source from the content-addressed store, hash-verified

1223}
1224
1225func newSource(name, path, localFileHash string, rows int64) (*runtimev1.Model, *runtimev1.Resource) {
1226 source := &runtimev1.Model{
1227 Spec: &runtimev1.ModelSpec{
1228 InputConnector: "local_file",
1229 OutputConnector: "duckdb",
1230 InputProperties: testruntime.Must(structpb.NewStruct(map[string]any{"path": path, "local_files_hash": localFileHash})),
1231 OutputProperties: testruntime.Must(structpb.NewStruct(map[string]any{"materialize": true})),
1232 RefreshSchedule: &runtimev1.Schedule{RefUpdate: true},
1233 DefinedAsSource: true,
1234 ChangeMode: runtimev1.ModelChangeMode_MODEL_CHANGE_MODE_RESET,
1235 },
1236 State: &runtimev1.ModelState{
1237 ExecutorConnector: "duckdb",
1238 ResultConnector: "duckdb",
1239 ResultProperties: testruntime.Must(structpb.NewStruct(map[string]any{"table": name, "used_model_name": true, "view": false})),
1240 ResultTable: name,
1241 RowsTotal: rows,
1242 },
1243 }
1244 sourceRes := &runtimev1.Resource{
1245 Meta: &runtimev1.ResourceMeta{
1246 Name: &runtimev1.ResourceName{Kind: runtime.ResourceKindModel, Name: name},
1247 Owner: runtime.GlobalProjectParserName,
1248 FilePaths: []string{fmt.Sprintf("/sources/%s.yaml", name)},
1249 },
1250 Resource: &runtimev1.Resource_Model{
1251 Model: source,
1252 },
1253 }
1254 return source, sourceRes
1255}
1256
1257func newModel(query, name, source string, rows int64) (*runtimev1.Model, *runtimev1.Resource) {
1258 model := &runtimev1.Model{

Callers 1

TestWatchFunction · 0.85

Calls 1

MustFunction · 0.92

Tested by

no test coverage detected