Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: impl Query2 for Spanner (#6352)

rebelice39248b17f091
diff --git a/backend/plugin/db/spanner/spanner.go b/backend/plugin/db/spanner/spanner.go
index d0c970458e..6d04ef2a77 100644
--- a/backend/plugin/db/spanner/spanner.go
+++ b/backend/plugin/db/spanner/spanner.go
@@ -497,6 +497,84 @@ func getDatabaseFromDSN(dsn string) (string, error) {
}
// QueryConn2 queries a SQL statement in a given connection.
-func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {
- return nil, errors.New("not implemented")
+func (d *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement string, queryContext *db.QueryContext) ([]*v1pb.QueryResult, error) {
+ stmts, err := sanitizeSQL(statement)
+ if err != nil {
+ return nil, err
+ }
+
+ var results []*v1pb.QueryResult
+ for _, statement := range stmts {
+ result, err := d.querySingleSQL(ctx, statement, queryContext)
+ if err != nil {
+ results = append(results, &v1pb.QueryResult{
+ Error: err.Error(),
+ })
+ } else {
+ results = append(results, result)
+ }
+ }
+
+ return results, nil
+}
+
+func (d *Driver) querySingleSQL(ctx context.Context, statement string, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {
+ statement = getStatementWithResultLimit(statement, queryContext.Limit)
+ iter := d.client.Single().Query(ctx, spanner.NewStatement(statement))
+ defer iter.Stop()
+
+ row, err := iter.Next()
+ if err == iterator.Done {
+ return nil, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+
+ data := []*v1pb.QueryRow{}
+ columnNames := getColumnNames(iter)
+ columnTypeNames, err := getColumnTypeNames(iter)
+ if err != nil {
+ return nil, err
+ }
+
+ for {
+ rowData, err := readRow2(row)
+ if err != nil {
+ return nil, err
+ }
+ data = append(data, rowData)
+
+ row, err = iter.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ // spanner doesn't mask the sensitive fields.
+ // Return the all false boolean slice here as the placeholder.
+ sensitiveInfo := make([]bool, len(columnNames))
+
+ return &v1pb.QueryResult{
+ ColumnNames: columnNames,
+ ColumnTypeNames: columnTypeNames,
+ Rows: data,
+ Masked: sensitiveInfo,
+ }, nil
+}
+
+func readRow2(row *spanner.Row) (*v1pb.QueryRow, error) {
+ result := &v1pb.QueryRow{}
+ for i := 0; i < row.Size(); i++ {
+ var col spanner.GenericColumnValue
+ if err := row.Column(i, &col); err != nil {
+ return nil, err
+ }
+ result.Values = append(result.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_ValueValue{ValueValue: col.Value}})
+ }
+
+ return result, nil
}
diff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.ts
index d6c7de7491..a40933b4ca 100644
--- a/frontend/src/types/proto/v1/sql_service.ts
+++ b/frontend/src/types/proto/v1/sql_service.ts
@@ -2,7 +2,7 @@
import * as Long from "long";
import type { CallContext, CallOptions } from "nice-grpc-common";
import * as _m0 from "protobufjs/minimal";
-import { NullValue, nullValueFromJSON, nullValueToJSON } from "../google/protobuf/struct";
+import { NullValue, nullValueFromJSON, nullValueToJSON, Value } from "../google/protobuf/struct";
import { Engine, engineFromJSON, engineToJSON } from "./common";
export const protobufPackage = "bytebase.v1";
@@ -63,7 +63,11 @@ export interface RowValue {
int64Value?: number | undefined;
stringValue?: string | undefined;
uint32Value?: number | undefined;
- uint64Value?: number | undefined;
+ uint64Value?:
+ | number
+ | undefined;
+ /** value_value is used for Spanner only. */
+ valueValue?: any;
}
export interface Advice {
@@ -531,6 +535,7 @@ function createBaseRowValue(): RowValue {
stringValue: undefined,
uint32Value: undefined,
uint64Value: undefined,
+ valueValue: undefined,
};
}
@@ -566,6 +571,9 @@ export const RowValue = {
if (message.uint64Value !== undefined) {
writer.uint32(80).uint64(message.uint64Value);
}
+ if (message.valueValue !== undefined) {
+ Value.encode(Value.wrap(message.valueValue), writer.uint32(90).fork()).ldelim();
+ }
return writer;
},
@@ -646,6 +654,13 @@ export const RowValue = {
message.uint64Value = longToNumber(reader.uint64() as Long);
continue;
+ case 11:
+ if (tag !== 90) {
+ break;
+ }
+
+ message.valueValue = Value.unwrap(Value.decode(reader, reader.uint32()));
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -667,6 +682,7 @@ export const RowValue = {
stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined,
uint32Value: isSet(object.uint32Value) ? Number(object.uint32Value) : undefined,
uint64Value: isSet(object.uint64Value) ? Number(object.uint64Value) : undefined,
+ valueValue: isSet(object?.valueValue) ? object.valueValue : undefined,
};
},
@@ -684,6 +700,7 @@ export const RowValue = {
message.stringValue !== undefined && (obj.stringValue = message.stringValue);
message.uint32Value !== undefined && (obj.uint32Value = Math.round(message.uint32Value));
message.uint64Value !== undefined && (obj.uint64Value = Math.round(message.uint64Value));
+ message.valueValue !== undefined && (obj.valueValue = message.valueValue);
return obj;
},
@@ -703,6 +720,7 @@ export const RowValue = {
message.stringValue = object.stringValue ?? undefined;
message.uint32Value = object.uint32Value ?? undefined;
message.uint64Value = object.uint64Value ?? undefined;
+ message.valueValue = object.valueValue ?? undefined;
return message;
},
};
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 23463f2a10..209f82afee 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -7462,6 +7462,7 @@ The sheet&#39;s `name` field is used to identify the sheet to update. Format: pr
| string_value | [string](#string) | | |
| uint32_value | [uint32](#uint32) | | |
| uint64_value | [uint64](#uint64) | | |
+| value_value | [google.protobuf.Value](#google-protobuf-Value) | | value_value is used for Spanner only. |
diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.go
index 1341d7ce66..fb77215aaf 100644
--- a/proto/generated-go/v1/sql_service.pb.go
+++ b/proto/generated-go/v1/sql_service.pb.go
@@ -360,6 +360,7 @@ type RowValue struct {
// *RowValue_StringValue
// *RowValue_Uint32Value
// *RowValue_Uint64Value
+ // *RowValue_ValueValue
Kind isRowValue_Kind `protobuf_oneof:"kind"`
}
@@ -472,6 +473,13 @@ func (x *RowValue) GetUint64Value() uint64 {
return 0
}
+func (x *RowValue) GetValueValue() *structpb.Value {
+ if x, ok := x.GetKind().(*RowValue_ValueValue); ok {
+ return x.ValueValue
+ }
+ return nil
+}
+
type isRowValue_Kind interface {
isRowValue_Kind()
}
@@ -516,6 +524,11 @@ type RowValue_Uint64Value struct {
Uint64Value uint64 `protobuf:"varint,10,opt,name=uint64_value,json=uint64Value,proto3,oneof"`
}
+type RowValue_ValueValue struct {
+ // value_value is used for Spanner only.
+ ValueValue *structpb.Value `protobuf:"bytes,11,opt,name=value_value,json=valueValue,proto3,oneof"`
+}
+
func (*RowValue_NullValue) isRowValue_Kind() {}
func (*RowValue_BoolValue) isRowValue_Kind() {}
@@ -536,6 +549,8 @@ func (*RowValue_Uint32Value) isRowValue_Kind() {}
func (*RowValue_Uint64Value) isRowValue_Kind() {}
+func (*RowValue_ValueValue) isRowValue_Kind() {}
+
type Advice struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -795,7 +810,7 @@ var file_v1_sql_service_proto_rawDesc = []byte{
0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x12, 0x2d, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
- 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x90, 0x03, 0x0a, 0x08, 0x52, 0x6f, 0x77, 0x56,
+ 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xcb, 0x03, 0x0a, 0x08, 0x52, 0x6f, 0x77, 0x56,
0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56,
@@ -820,53 +835,56 @@ var file_v1_sql_service_proto_rawDesc = []byte{
0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a,
0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c,
- 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41,
- 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75,
- 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
- 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a,
- 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69,
- 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a,
- 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e,
- 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e,
- 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53,
- 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e,
- 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03,
- 0x22, 0x8c, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12,
- 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d,
- 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
- 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
- 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
- 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22,
- 0x60, 0x0a, 0x0e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68,
- 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65,
- 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65,
- 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d,
- 0x61, 0x32, 0xd3, 0x01, 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
- 0x12, 0x5c, 0x0a, 0x06, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e,
- 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67,
- 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27,
- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,
- 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,
- 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x33,
+ 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48,
+ 0x00, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a,
+ 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65,
+ 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41,
+ 0x64, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74,
+ 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c,
+ 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18,
+ 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06,
+ 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65,
+ 0x74, 0x61, 0x69, 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16,
+ 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,
+ 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53,
+ 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02,
+ 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x8c, 0x01, 0x0a, 0x0d,
+ 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a,
+ 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x67, 0x69,
+ 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75,
+ 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65,
+ 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x60, 0x0a, 0x0e, 0x50, 0x72,
+ 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e,
+ 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78,
+ 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x32, 0xd3, 0x01, 0x0a,
+ 0x0a, 0x53, 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x06, 0x50,
+ 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
+ 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19,
+ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x73,
+ 0x71, 0x6c, 0x2f, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x05, 0x51, 0x75, 0x65,
+ 0x72, 0x79, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
+ 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72,
+ 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02,
+ 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
+ 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d,
+ 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -894,7 +912,8 @@ var file_v1_sql_service_proto_goTypes = []interface{}{
(*PrettyRequest)(nil), // 7: bytebase.v1.PrettyRequest
(*PrettyResponse)(nil), // 8: bytebase.v1.PrettyResponse
(structpb.NullValue)(0), // 9: google.protobuf.NullValue
- (Engine)(0), // 10: bytebase.v1.Engine
+ (*structpb.Value)(nil), // 10: google.protobuf.Value
+ (Engine)(0), // 11: bytebase.v1.Engine
}
var file_v1_sql_service_proto_depIdxs = []int32{
3, // 0: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult
@@ -902,17 +921,18 @@ var file_v1_sql_service_proto_depIdxs = []int32{
4, // 2: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow
5, // 3: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue
9, // 4: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
- 0, // 5: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status
- 10, // 6: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine
- 7, // 7: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest
- 1, // 8: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
- 8, // 9: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse
- 2, // 10: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
- 9, // [9:11] is the sub-list for method output_type
- 7, // [7:9] is the sub-list for method input_type
- 7, // [7:7] is the sub-list for extension type_name
- 7, // [7:7] is the sub-list for extension extendee
- 0, // [0:7] is the sub-list for field type_name
+ 10, // 5: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
+ 0, // 6: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status
+ 11, // 7: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine
+ 7, // 8: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest
+ 1, // 9: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
+ 8, // 10: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse
+ 2, // 11: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
+ 10, // [10:12] is the sub-list for method output_type
+ 8, // [8:10] is the sub-list for method input_type
+ 8, // [8:8] is the sub-list for extension type_name
+ 8, // [8:8] is the sub-list for extension extendee
+ 0, // [0:8] is the sub-list for field type_name
}
func init() { file_v1_sql_service_proto_init() }
@@ -1030,6 +1050,7 @@ func file_v1_sql_service_proto_init() {
(*RowValue_StringValue)(nil),
(*RowValue_Uint32Value)(nil),
(*RowValue_Uint64Value)(nil),
+ (*RowValue_ValueValue)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.proto
index e70f92154f..7aff77f72a 100644
--- a/proto/v1/sql_service.proto
+++ b/proto/v1/sql_service.proto
@@ -84,6 +84,8 @@ message RowValue {
string string_value = 8;
uint32 uint32_value = 9;
uint64 uint64_value = 10;
+ // value_value is used for Spanner only.
+ google.protobuf.Value value_value = 11;
}
}