MCPcopy Create free account
hub / github.com/sql-machine-learning/sqlflow / DumpDBModel

Function DumpDBModel

go/model/model.go:275–290  ·  view source on GitHub ↗

DumpDBModel dumps a model tarball from database to local file system and return the file name

(db *database.DB, table, cwd string)

Source from the content-addressed store, hash-verified

273// DumpDBModel dumps a model tarball from database to local
274// file system and return the file name
275func DumpDBModel(db *database.DB, table, cwd string) (string, error) {
276 sqlf, err := sqlfs.Open(db.DB, table)
277 if err != nil {
278 return "", fmt.Errorf("Can't open sqlfs %s, %v", table, err)
279 }
280 defer sqlf.Close()
281 fileName := filepath.Join(cwd, "model_dump.tar.gz")
282 file, err := os.Create(fileName)
283 if err != nil {
284 return "", fmt.Errorf("Can't careate model file: %v", err)
285 }
286 if _, err = io.Copy(file, sqlf); err != nil {
287 return "", fmt.Errorf("Can't dump model to local file")
288 }
289 return fileName, nil
290}
291
292// ExtractMetaFromTarball extract metadata from given tarball
293// and return the metadata json string. This function do not

Callers 4

ReleaseModelMethod · 0.92
downloadModelFromDBFunction · 0.92
releaseModelFromLocalFunction · 0.92
loadModelFromDBFunction · 0.85

Calls 3

OpenFunction · 0.92
ErrorfMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected