Skip to content

Commit 1324ca2

Browse files
authored
Merge pull request #563 from slingdata-io/v1.4.9
V1.4.9
2 parents 5350b9e + c6e28e4 commit 1324ca2

21 files changed

Lines changed: 82 additions & 21 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ cmd/sling/tests/replications/r.test.yaml
3131
cmd/sling/tests/pipelines/p.test.yaml
3232

3333
*..go
34+
*..md
3435
*__test.go
3536

3637
appicon.png

cmd/sling/sling_cli.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,14 @@ import (
2626
"github.com/spf13/cast"
2727
)
2828

29-
//go:embed examples.sh
30-
var slingFolder embed.FS
29+
//go:embed resource/*
30+
var slingResources embed.FS
3131
var (
3232
examples = ``
3333
ctx = g.NewContext(context.Background())
3434
telemetry = true
3535
interrupted = false
3636
machineID = ""
37-
telProps = g.M(
38-
"application", "sling-cli",
39-
"version", core.Version,
40-
"os", runtime.GOOS+"/"+runtime.GOARCH,
41-
)
4237
)
4338

4439
func init() {
@@ -405,7 +400,7 @@ func init() {
405400
}
406401

407402
// collect examples
408-
examplesBytes, _ := slingFolder.ReadFile("examples.sh")
403+
examplesBytes, _ := slingResources.ReadFile("resource/examples.sh")
409404
examples = string(examplesBytes)
410405

411406
cliConns.Make().Add()
@@ -433,7 +428,7 @@ func Track(event string, props ...map[string]interface{}) {
433428
"user_id", machineID,
434429
)
435430

436-
for k, v := range telProps {
431+
for k, v := range core.TelProps {
437432
properties[k] = v
438433
}
439434

cmd/sling/sling_run.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import (
66
"os"
77
"path"
88
"path/filepath"
9+
"runtime"
910
"runtime/debug"
1011
"strings"
1112
"time"
1213

1314
"gopkg.in/yaml.v2"
1415

1516
"github.com/shirou/gopsutil/v3/mem"
17+
"github.com/slingdata-io/sling-cli/core"
1618
"github.com/slingdata-io/sling-cli/core/dbio/connection"
1719
"github.com/slingdata-io/sling-cli/core/env"
1820
"github.com/slingdata-io/sling-cli/core/sling"
@@ -208,7 +210,9 @@ func processRun(c *g.CliSC) (ok bool, err error) {
208210
runReplication:
209211
defer connection.CloseAll()
210212

211-
g.Info(g.Colorize(g.ColorCyan, "Sling CLI | https://slingdata.io"))
213+
if !cast.ToBool(os.Getenv("SLING_THREAD_CHILD")) {
214+
g.Info(g.Colorize(g.ColorCyan, "Sling CLI | https://slingdata.io"))
215+
}
212216

213217
if pipelineCfgPath != "" {
214218
err = runPipeline(pipelineCfgPath)
@@ -568,6 +572,8 @@ func replicationRun(cfgPath string, cfgOverwrite *sling.Config, selectStreams ..
568572
}
569573

570574
func runPipeline(pipelineCfgPath string) (err error) {
575+
g.DebugLow("Sling version: %s (%s %s)", core.Version, runtime.GOOS, runtime.GOARCH)
576+
571577
pipeline, err := sling.LoadPipelineConfigFromFile(pipelineCfgPath)
572578
if err != nil {
573579
return g.Error(err, "could not load pipeline: %s", pipelineCfgPath)

cmd/sling/sling_update.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ func upgradeBrew() (err error) {
154154
}
155155

156156
func upgradeScoop() (err error) {
157-
g.Info("Sling was installed with scoop. Running `scoop update sling`")
157+
g.Warn("Sling was installed with scoop. Try running `scoop update sling`")
158+
return nil
159+
// errors with "sling" is still running. Need to install manually
158160

159161
proc, err := process.NewProc("scoop")
160162
if err != nil {

core/dbio/database/database.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ func (conn *BaseConn) Connect(timeOut ...int) (err error) {
704704
}
705705

706706
conn.SetProp("connected", "true")
707+
conn.SetProp("connect_time", cast.ToString(time.Now()))
707708

708709
return nil
709710
}

core/dbio/database/database_athena.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ func (conn *AthenaConn) Connect(timeOut ...int) (err error) {
154154
}
155155

156156
conn.SetProp("connected", "true")
157+
conn.SetProp("connect_time", cast.ToString(time.Now()))
157158

158159
if !cast.ToBool(conn.GetProp("silent")) {
159160
g.Debug(`opened "%s" connection (%s)`, conn.Type, conn.GetProp("sling_conn_id"))

core/dbio/database/database_bigtable.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ func (conn *BigTableConn) Connect(timeOut ...int) error {
176176
}
177177

178178
conn.SetProp("connected", "true")
179+
conn.SetProp("connect_time", cast.ToString(time.Now()))
179180

180181
return nil
181182
}

core/dbio/database/database_d1.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func (conn *D1Conn) Connect(timeOut ...int) (err error) {
128128
}
129129

130130
conn.SetProp("connected", "true")
131+
conn.SetProp("connect_time", cast.ToString(time.Now()))
131132

132133
return nil
133134
}

core/dbio/database/database_duckdb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func (conn *DuckDbConn) Connect(timeOut ...int) (err error) {
125125
g.Debug(`opened "%s" connection (%s)`, conn.Type, conn.GetProp("sling_conn_id"))
126126

127127
conn.SetProp("connected", "true")
128+
conn.SetProp("connect_time", cast.ToString(time.Now()))
128129

129130
if conn.GetType() == dbio.TypeDbMotherDuck {
130131
_, err = conn.Exec("SET autoinstall_known_extensions=1; SET autoload_known_extensions=1;" + noDebugKey)

0 commit comments

Comments
 (0)