Skip to content

Commit 67b9cce

Browse files
streaming writes to filer
1 parent c371bf4 commit 67b9cce

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

bundle/generate/downloader.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package generate
22

33
import (
4-
"bytes"
54
"context"
65
"fmt"
7-
"io"
86
"net/http"
97
"path"
108
"path/filepath"
@@ -14,12 +12,11 @@ import (
1412
"github.com/databricks/cli/libs/filer"
1513
"github.com/databricks/cli/libs/notebook"
1614
"github.com/databricks/databricks-sdk-go"
15+
"github.com/databricks/databricks-sdk-go/client"
1716
"github.com/databricks/databricks-sdk-go/service/jobs"
1817
"github.com/databricks/databricks-sdk-go/service/pipelines"
1918
"github.com/databricks/databricks-sdk-go/service/workspace"
2019
"golang.org/x/sync/errgroup"
21-
22-
"github.com/databricks/databricks-sdk-go/client"
2320
)
2421

2522
type exportFile struct {
@@ -216,17 +213,11 @@ func (n *Downloader) FlushToDisk(ctx context.Context, force bool) error {
216213
}
217214
defer reader.Close()
218215

219-
// Read into buffer so we can write via the filer
220-
content, err := io.ReadAll(reader)
221-
if err != nil {
222-
return err
223-
}
224-
225216
mode := []filer.WriteMode{filer.CreateParentDirectories}
226217
if force {
227218
mode = append(mode, filer.OverwriteIfExists)
228219
}
229-
err = n.outputFiler.Write(errCtx, targetPath, bytes.NewReader(content), mode...)
220+
err = n.outputFiler.Write(errCtx, targetPath, reader, mode...)
230221
if err != nil {
231222
return err
232223
}

0 commit comments

Comments
 (0)