Skip to content

Commit e80a50f

Browse files
authored
add data stream status and object type (#55)
1 parent db459da commit e80a50f

File tree

9 files changed

+57
-14
lines changed

9 files changed

+57
-14
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.1.6-alpha
4+
* Add Snowflake data stream status support
5+
* Modify Snowflake data stream create for view support
6+
37
## v0.1.5-alpha
48

59
* Add Snowflake data stream commands

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
require (
66
github.com/pkg/errors v0.9.1
7-
github.com/relationalai/rai-sdk-go v0.4.5-alpha
7+
github.com/relationalai/rai-sdk-go v0.4.7-alpha
88
github.com/spf13/cobra v1.5.0
99
)
1010

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R
277277
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
278278
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
279279
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
280-
github.com/relationalai/rai-sdk-go v0.4.5-alpha h1:+F7Z2K7H2q8S1x4Y0P7baz9GyCGOlTIVRmnacwmo228=
281-
github.com/relationalai/rai-sdk-go v0.4.5-alpha/go.mod h1:qfIZ7OiUpM+ZLPB8m358DFQPRPFzMjM4ghX4iKR8UHo=
280+
github.com/relationalai/rai-sdk-go v0.4.7-alpha h1:9Jbl+01nLEwar7eJGfZOkuKEpJaO7oRLCYHSwijl1z4=
281+
github.com/relationalai/rai-sdk-go v0.4.7-alpha/go.mod h1:qfIZ7OiUpM+ZLPB8m358DFQPRPFzMjM4ghX4iKR8UHo=
282282
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
283283
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
284284
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=

rai/cmds.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -895,13 +895,13 @@ func createSnowflakeDataStream(cmd *cobra.Command, args []string) {
895895
warehouse := action.getStringEnv("warehouse", "SNOWSQL_WAREHOUSE")
896896
username := action.getStringEnv("username", "SNOWSQL_USER")
897897
password := action.getStringEnv("password", "SNOWSQL_PWD")
898-
isView := action.getBool("is-view")
898+
objectType := action.getString("object-type")
899899
raiDatabase := action.getString("rai-database")
900900
relation := action.getString("rai-relation")
901901
creds := &rai.SnowflakeCredentials{Username: username, Password: password}
902902

903903
opts := &rai.DataStreamOpts{
904-
IsView: isView,
904+
ObjectType: objectType,
905905
RaiDatabase: raiDatabase,
906906
Relation: relation,
907907
ObjectName: dataStream,
@@ -948,6 +948,16 @@ func listSnowflakeDataStreams(cmd *cobra.Command, args []string) {
948948
action.Exit(rsp, err)
949949
}
950950

951+
func getSnowflakeDataStreamStatus(cmd *cobra.Command, args []string) {
952+
action := newAction(cmd)
953+
integration := args[0]
954+
dbLink := args[1]
955+
dataStream := args[2]
956+
action.Start("Get Snowflake data stream status %s (%s)", dataStream, integration)
957+
rsp, err := action.Client().GetSnowflakeDataStreamStatus(integration, dbLink, dataStream)
958+
action.Exit(rsp, err)
959+
}
960+
951961
//
952962
// Misc
953963
//

rai/main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func addCommands(root *cobra.Command) {
379379
cmd.Flags().String("warehouse", "", "Snowflake warehouse (default: SNOWSQL_WAREHOUSE env var)")
380380
cmd.Flags().String("username", "", "Snowflake username (default: SNOWSQL_USER env var)")
381381
cmd.Flags().String("password", "", "Snowflake password (default: SNOWSQL_PWD env var)")
382-
cmd.Flags().Bool("is-view", false, "Snowflake object is a view (default: false)")
382+
cmd.Flags().String("object-type", "", "Snowflake object type (default: table)")
383383
cmd.Flags().String("rai-database", "", "RelationalAI target database name")
384384
cmd.MarkFlagRequired("rai-database")
385385
cmd.Flags().String("rai-relation", "", "RelationalAI target relation")
@@ -411,6 +411,13 @@ func addCommands(root *cobra.Command) {
411411
Run: listSnowflakeDataStreams}
412412
root.AddCommand(cmd)
413413

414+
cmd = &cobra.Command{
415+
Use: "get-snowflake-data-stream-status integration database-link objectName",
416+
Short: "Get status information about a Snowflake data stream associated with an integration and database-link",
417+
Args: cobra.ExactArgs(3),
418+
Run: getSnowflakeDataStreamStatus}
419+
root.AddCommand(cmd)
420+
414421
// Misc
415422
cmd = &cobra.Command{
416423
Use: "get-access-token",

vendor/github.com/relationalai/rai-sdk-go/rai/client.go

+15-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/relationalai/rai-sdk-go/rai/models.go

+13-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/relationalai/rai-sdk-go/rai/version.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ github.com/pierrec/lz4/v4/internal/xxh32
4949
# github.com/pkg/errors v0.9.1
5050
## explicit
5151
github.com/pkg/errors
52-
# github.com/relationalai/rai-sdk-go v0.4.5-alpha
52+
# github.com/relationalai/rai-sdk-go v0.4.7-alpha
5353
## explicit; go 1.18
5454
github.com/relationalai/rai-sdk-go/rai
5555
github.com/relationalai/rai-sdk-go/rai/pb

0 commit comments

Comments
 (0)