Skip to content

Commit

Permalink
Mount gsheets file
Browse files Browse the repository at this point in the history
- mount gsheets credentials file from host to container

- small changes
  • Loading branch information
sanjushahgupta authored Nov 4, 2024
1 parent 1009b79 commit 7bf08c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/ingestr/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const (
DuckDBDest = "/tmp/dest.db"
DuckDBSource = "/tmp/source.db"
DuckDBPrefix = "duckdb:///"
GsheetsSource = "/tmp/gsheets_source.db"
GsheetsPrefix = "gsheets://?credentials_path="
)

type connectionFetcher interface {
Expand Down Expand Up @@ -161,6 +163,15 @@ func (o *BasicOperator) ConvertTaskInstanceToContainerConfig(ctx context.Context
})
sourceURI = DuckDBPrefix + DuckDBSource
}
if strings.HasPrefix(sourceURI, GsheetsPrefix) {
sourcePath := strings.TrimPrefix(sourceURI, GsheetsPrefix)
mounts = append(mounts, mount.Mount{
Type: mount.TypeBind,
Source: sourcePath,
Target: GsheetsSource,
})
sourceURI = GsheetsPrefix + GsheetsSource
}

// some connection types can be shared among sources, therefore inferring source URI from the connection type is not
// always feasible. In the case of GSheets, we have to reuse the same GCP credentials, but change the prefix with gsheets://
Expand Down

0 comments on commit 7bf08c6

Please sign in to comment.