Skip to content

Commit

Permalink
Merge pull request #3003 from redpanda-data/snowflake-ua
Browse files Browse the repository at this point in the history
snowflake: update user agent
  • Loading branch information
rockwotj authored Nov 13, 2024
2 parents 5e62026 + 19d5243 commit e4f8636
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
18 changes: 10 additions & 8 deletions internal/impl/snowflake/streaming/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,11 @@ func TestIntegerCompat(t *testing.T) {
ctx := context.Background()
restClient, streamClient := setup(t)
channelOpts := streaming.ChannelOptions{
Name: t.Name(),
DatabaseName: envOr("SNOWFLAKE_DB", "BABY_DATABASE"),
SchemaName: "PUBLIC",
TableName: "TEST_INT_TABLE",
Name: t.Name(),
DatabaseName: envOr("SNOWFLAKE_DB", "BABY_DATABASE"),
SchemaName: "PUBLIC",
TableName: "TEST_INT_TABLE",
BuildParallelism: 1,
}
_, err := restClient.RunSQL(ctx, streaming.RunSQLRequest{
Database: channelOpts.DatabaseName,
Expand Down Expand Up @@ -347,10 +348,11 @@ func TestTimestampCompat(t *testing.T) {
ctx := context.Background()
restClient, streamClient := setup(t)
channelOpts := streaming.ChannelOptions{
Name: t.Name(),
DatabaseName: envOr("SNOWFLAKE_DB", "BABY_DATABASE"),
SchemaName: "PUBLIC",
TableName: "TEST_TIMESTAMP_TABLE",
Name: t.Name(),
DatabaseName: envOr("SNOWFLAKE_DB", "BABY_DATABASE"),
SchemaName: "PUBLIC",
TableName: "TEST_TIMESTAMP_TABLE",
BuildParallelism: 1,
}
var columnDefs []string
var columnNames []string
Expand Down
2 changes: 1 addition & 1 deletion internal/impl/snowflake/streaming/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func NewRestClient(account, user, version, app string, privateKey *rsa.PrivateKe
// this should only show up in development, not released binaries
version = "99.0.0"
}
userAgent := fmt.Sprintf("RedpandaConnect/%v", version)
userAgent := fmt.Sprintf("RedpandaConnect_SnowpipeStreamingSDK/%v", version)
debugf(logger, "making snowflake HTTP requests using User-Agent: %s", userAgent)
c = &SnowflakeRestClient{
account: account,
Expand Down
3 changes: 3 additions & 0 deletions internal/impl/snowflake/streaming/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ type encryptionInfo struct {

// OpenChannel creates a new or reuses a channel to load data into a Snowflake table.
func (c *SnowflakeServiceClient) OpenChannel(ctx context.Context, opts ChannelOptions) (*SnowflakeIngestionChannel, error) {
if opts.BuildParallelism <= 0 {
return nil, fmt.Errorf("invalid build parallelism: %d", opts.BuildParallelism)
}
resp, err := c.client.openChannel(ctx, openChannelRequest{
RequestID: c.nextRequestID(),
Role: c.options.Role,
Expand Down

0 comments on commit e4f8636

Please sign in to comment.