Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add AdminExecute API proto (#6405)
rebelice8b5a47d46880
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex daba582fbe..67065674db 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -7,6 +7,7 @@ import ("encoding/base64""encoding/json""fmt"+ "io""net/http""reflect""strconv"@@ -92,6 +93,131 @@ func (*SQLService) Pretty(_ context.Context, request *v1pb.PrettyRequest) (*v1pb}, nil}+// AdminExecute executes the SQL statement.+func (s *SQLService) AdminExecute(server v1pb.SQLService_AdminExecuteServer) error {+ ctx := server.Context()+ var driver db.Driver+ var conn *sql.Conn+ defer func() {+ if conn != nil {+ if err := conn.Close(); err != nil {+ log.Warn("failed to close connection", zap.Error(err))+ }+ }+ if driver != nil {+ driver.Close(ctx)+ }+ }()+ for {+ request, err := server.Recv()+ if err != nil {+ if err == io.EOF {+ return nil+ }+ return status.Errorf(codes.Internal, "failed to receive request: %v", err)+ }++ instance, activity, err := s.preAdminExecute(ctx, request)+ if err != nil {+ return err+ }++ // We only need to get the driver and connection once.+ if driver == nil {+ driver, err = s.dbFactory.GetAdminDatabaseDriver(ctx, instance, request.ConnectionDatabase)+ if err != nil {+ return status.Errorf(codes.Internal, "failed to get database driver: %v", err)+ }++ sqlDB := driver.GetDB()+ if sqlDB != nil {+ conn, err = sqlDB.Conn(ctx)+ if err != nil {+ return status.Errorf(codes.Internal, "failed to get database connection: %v", err)+ }+ }+ }++ result, durationNs, queryErr := s.doAdminExecute(ctx, driver, conn, request)++ if err := s.postAdminExecute(ctx, activity, durationNs, queryErr); err != nil {+ return err+ }++ if queryErr != nil {+ return status.Errorf(codes.Internal, "failed to execute statement: %v", queryErr)+ }++ if err := server.Send(&v1pb.AdminExecuteResponse{+ Results: result,+ }); err != nil {+ return status.Errorf(codes.Internal, "failed to send response: %v", err)+ }+ }+}++func (s *SQLService) postAdminExecute(ctx context.Context, activity *api.Activity, durationNs int64, queryErr error) error {+ var payload api.ActivitySQLEditorQueryPayload+ if err := json.Unmarshal([]byte(activity.Payload), &payload); err != nil {+ return status.Errorf(codes.Internal, "failed to unmarshal activity payload: %v", err)+ }++ var newLevel *api.ActivityLevel+ payload.DurationNs = durationNs+ if queryErr != nil {+ payload.Error = queryErr.Error()+ errorLevel := api.ActivityError+ newLevel = &errorLevel+ }++ // TODO: update the advice list++ payloadBytes, err := json.Marshal(payload)+ if err != nil {+ log.Warn("Failed to marshal activity after executing sql statement",+ zap.String("database_name", payload.DatabaseName),+ zap.Int("instance_id", payload.InstanceID),+ zap.String("statement", payload.Statement),+ zap.Error(err))+ return status.Errorf(codes.Internal, "Failed to marshal activity after executing sql statement: %v", err)+ }++ payloadString := string(payloadBytes)+ if _, err := s.store.PatchActivity(ctx, &api.ActivityPatch{+ ID: activity.ID,+ UpdaterID: activity.CreatorID,+ Level: newLevel,+ Payload: &payloadString,+ }); err != nil {+ return status.Errorf(codes.Internal, "Failed to update activity after executing sql statement: %v", err)+ }++ return nil+}++func (*SQLService) doAdminExecute(ctx context.Context, driver db.Driver, conn *sql.Conn, request *v1pb.AdminExecuteRequest) ([]*v1pb.QueryResult, int64, error) {+ start := time.Now().UnixNano()+ result, err := driver.RunStatement(ctx, conn, request.Statement)+ return result, time.Now().UnixNano() - start, err+}++func (s *SQLService) preAdminExecute(ctx context.Context, request *v1pb.AdminExecuteRequest) (*store.InstanceMessage, *api.Activity, error) {+ user, _, instance, database, err := s.prepareRelatedMessage(ctx, request.Name, request.ConnectionDatabase)+ if err != nil {+ return nil, nil, err+ }++ activity, err := s.createQueryActivity(ctx, user, api.ActivityInfo, instance.UID, api.ActivitySQLEditorQueryPayload{+ Statement: request.Statement,+ InstanceID: instance.UID,+ DeprecatedInstanceName: instance.Title,+ DatabaseID: database.UID,+ DatabaseName: request.ConnectionDatabase,+ })++ return instance, activity, err+}+// Export exports the SQL query result.func (s *SQLService) Export(ctx context.Context, request *v1pb.ExportRequest) (*v1pb.ExportResponse, error) {instanceMessage, sensitiveSchemaInfo, activity, err := s.preExport(ctx, request)diff --git a/backend/plugin/advisor/utils_for_tests.go b/backend/plugin/advisor/utils_for_tests.goindex 878bb095b3..fe0ca7784c 100644--- a/backend/plugin/advisor/utils_for_tests.go+++ b/backend/plugin/advisor/utils_for_tests.go@@ -254,6 +254,11 @@ func (*MockDriver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *databreturn nil, nil}+// RunStatement implements the Driver interface.+func (*MockDriver) RunStatement(_ context.Context, _ *sql.Conn, _ string) ([]*v1pb.QueryResult, error) {+ return nil, nil+}+// QueryConn implements the Driver interface.func (*MockDriver) QueryConn(_ context.Context, _ *sql.Conn, statement string, _ *database.QueryContext) ([]any, error) {switch statement {diff --git a/backend/plugin/db/clickhouse/clickhouse.go b/backend/plugin/db/clickhouse/clickhouse.goindex 7ae5f75a05..039e950174 100644--- a/backend/plugin/db/clickhouse/clickhouse.go+++ b/backend/plugin/db/clickhouse/clickhouse.go@@ -158,7 +158,7 @@ func (driver *Driver) Execute(ctx context.Context, statement string, _ bool) (inreturn 0, err}- return 0, err+ return totalRowsAffected, err}// QueryConn querys a SQL statement in a given connection.@@ -166,6 +166,33 @@ func (driver *Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement sreturn util.Query(ctx, driver.dbType, conn, statement, queryContext)}+// RunStatement runs a SQL statement.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ var results []*v1pb.QueryResult+ if err := util.ApplyMultiStatements(strings.NewReader(statement), func(stmt string) error {+ rows, err := conn.QueryContext(ctx, statement)+ if err != nil {+ // TODO(d): ClickHouse will return "driver: bad connection" if we use non-SELECT statement for Query(). We need to ignore the error.+ //nolint+ return nil+ }+ defer rows.Close()++ result, err := convertRowsToQueryResult(rows)+ if err != nil {+ result = &v1pb.QueryResult{+ Error: err.Error(),+ }+ }+ results = append(results, result)+ return nil+ }); err != nil {+ return nil, err+ }++ return results, nil+}+// QueryConn2 queries a SQL statement in a given connection.func (driver *Driver) QueryConn2(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]*v1pb.QueryResult, error) {// TODO(rebelice): implement multi-statement query@@ -211,6 +238,10 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, statement str}defer rows.Close()+ return convertRowsToQueryResult(rows)+}++func convertRowsToQueryResult(rows *sql.Rows) (*v1pb.QueryResult, error) {columnNames, err := rows.Columns()if err != nil {return nil, errdiff --git a/backend/plugin/db/driver.go b/backend/plugin/db/driver.goindex e320a7bcd9..4e02c32d1d 100644--- a/backend/plugin/db/driver.go+++ b/backend/plugin/db/driver.go@@ -496,6 +496,8 @@ type Driver interface {// Used for execute readonly SELECT statement// TODO(rebelice): remove QueryConn and rename QueryConn2 to QueryConn when legacy code is removed.QueryConn2(ctx context.Context, conn *sql.Conn, statement string, queryContext *QueryContext) ([]*v1pb.QueryResult, error)+ // RunStatement will execute the statement and return the result, for both SELECT and non-SELECT statements.+ RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error)// Sync schema// SyncInstance syncs the instance metadata.diff --git a/backend/plugin/db/mongodb/mongodb.go b/backend/plugin/db/mongodb/mongodb.goindex 4c995b5c6a..8cb8ec2781 100644--- a/backend/plugin/db/mongodb/mongodb.go+++ b/backend/plugin/db/mongodb/mongodb.go@@ -248,3 +248,8 @@ func (driver *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement strRows: rows,}}, nil}++// RunStatement runs a SQL statement in a given connection.+func (driver *Driver) RunStatement(ctx context.Context, _ *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return driver.QueryConn2(ctx, nil, statement, nil)+}diff --git a/backend/plugin/db/mssql/mssql.go b/backend/plugin/db/mssql/mssql.goindex b73544e5f7..3a4f99ec33 100644--- a/backend/plugin/db/mssql/mssql.go+++ b/backend/plugin/db/mssql/mssql.go@@ -170,3 +170,8 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parreturn util.Query2(ctx, db.MSSQL, conn, statement, queryContext)}++// RunStatement runs a SQL statement.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return util.RunStatement(ctx, parser.MSSQL, conn, statement)+}diff --git a/backend/plugin/db/mysql/mysql.go b/backend/plugin/db/mysql/mysql.goindex 12d0713945..df34683c09 100644--- a/backend/plugin/db/mysql/mysql.go+++ b/backend/plugin/db/mysql/mysql.go@@ -341,3 +341,8 @@ func (driver *Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singlereturn util.Query2(ctx, driver.dbType, conn, statement, queryContext)}++// RunStatement runs a SQL statement in a given connection.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return util.RunStatement(ctx, bbparser.MySQL, conn, statement)+}diff --git a/backend/plugin/db/oracle/oracle.go b/backend/plugin/db/oracle/oracle.goindex 9a95e2a311..63a5772ffe 100644--- a/backend/plugin/db/oracle/oracle.go+++ b/backend/plugin/db/oracle/oracle.go@@ -182,3 +182,8 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parreturn util.Query2(ctx, db.Oracle, conn, statement, queryContext)}++// RunStatement runs a SQL statement in a given connection.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return util.RunStatement(ctx, parser.Oracle, conn, statement)+}diff --git a/backend/plugin/db/pg/pg.go b/backend/plugin/db/pg/pg.goindex 91f58752cd..c1d0d2981b 100644--- a/backend/plugin/db/pg/pg.go+++ b/backend/plugin/db/pg/pg.go@@ -501,3 +501,8 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parreturn util.Query2(ctx, db.Postgres, conn, statement, queryContext)}++// RunStatement runs a SQL statement in a given connection.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return util.RunStatement(ctx, parser.Postgres, conn, statement)+}diff --git a/backend/plugin/db/redis/redis.go b/backend/plugin/db/redis/redis.goindex 1bc4b0e1d8..252a2d588d 100644--- a/backend/plugin/db/redis/redis.go+++ b/backend/plugin/db/redis/redis.go@@ -274,3 +274,8 @@ func (d *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement string,Rows: data,}}, nil}++// RunStatement runs a SQL statement in a given connection.+func (d *Driver) RunStatement(ctx context.Context, _ *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return d.QueryConn2(ctx, nil, statement, nil)+}diff --git a/backend/plugin/db/redshift/redshift.go b/backend/plugin/db/redshift/redshift.goindex 66a4d381db..d5b959600a 100644--- a/backend/plugin/db/redshift/redshift.go+++ b/backend/plugin/db/redshift/redshift.go@@ -435,3 +435,8 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parreturn util.Query2(ctx, db.Postgres, conn, statement, queryContext)}++// RunStatement runs a SQL statement in a given connection.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return util.RunStatement(ctx, parser.Redshift, conn, statement)+}diff --git a/backend/plugin/db/snowflake/snowflake.go b/backend/plugin/db/snowflake/snowflake.goindex 72ff5b2aff..c782c4449e 100644--- a/backend/plugin/db/snowflake/snowflake.go+++ b/backend/plugin/db/snowflake/snowflake.go@@ -294,3 +294,8 @@ func (*Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL parreturn util.Query2(ctx, db.Snowflake, conn, statement, queryContext)}++// RunStatement runs a SQL statement in a given connection.+func (*Driver) RunStatement(ctx context.Context, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ return util.RunStatement(ctx, parser.Snowflake, conn, statement)+}diff --git a/backend/plugin/db/spanner/spanner.go b/backend/plugin/db/spanner/spanner.goindex 94a3ba116b..08af8603f2 100644--- a/backend/plugin/db/spanner/spanner.go+++ b/backend/plugin/db/spanner/spanner.go@@ -505,7 +505,8 @@ func (d *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement string,var results []*v1pb.QueryResultfor _, statement := range stmts {- result, err := d.querySingleSQL(ctx, statement, queryContext)+ statement = getStatementWithResultLimit(statement, queryContext.Limit)+ result, err := d.querySingleSQL(ctx, statement)if err != nil {results = append(results, &v1pb.QueryResult{Error: err.Error(),@@ -518,8 +519,7 @@ func (d *Driver) QueryConn2(ctx context.Context, _ *sql.Conn, statement string,return results, nil}-func (d *Driver) querySingleSQL(ctx context.Context, statement string, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {- statement = getStatementWithResultLimit(statement, queryContext.Limit)+func (d *Driver) querySingleSQL(ctx context.Context, statement string) (*v1pb.QueryResult, error) {iter := d.client.Single().Query(ctx, spanner.NewStatement(statement))defer iter.Stop()@@ -578,3 +578,81 @@ func readRow2(row *spanner.Row) (*v1pb.QueryRow, error) {return result, nil}++// RunStatement executes a SQL statement.+func (d *Driver) RunStatement(ctx context.Context, _ *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ stmts, err := sanitizeSQL(statement)+ if err != nil {+ return nil, err+ }++ var results []*v1pb.QueryResult+ for _, statement := range stmts {+ if isSelect(statement) {+ result, err := d.querySingleSQL(ctx, statement)+ if err != nil {+ results = append(results, &v1pb.QueryResult{+ Error: err.Error(),+ })+ continue+ }+ results = append(results, result)+ continue+ }++ if isDDL(statement) {+ op, err := d.dbClient.UpdateDatabaseDdl(ctx, &databasepb.UpdateDatabaseDdlRequest{+ Database: getDSN(d.config.Host, d.databaseName),+ Statements: []string{statement},+ })+ if err != nil {+ results = append(results, &v1pb.QueryResult{+ Error: err.Error(),+ })+ continue+ }+ if err := op.Wait(ctx); err != nil {+ results = append(results, &v1pb.QueryResult{+ Error: err.Error(),+ })+ continue+ }+ results = append(results, &v1pb.QueryResult{})+ continue+ }++ var rowCount int64+ if _, err := d.client.ReadWriteTransaction(ctx, func(ctx context.Context, rwt *spanner.ReadWriteTransaction) error {+ count, err := rwt.Update(ctx, spanner.NewStatement(statement))+ if err != nil {+ return err+ }+ rowCount = count+ return nil+ }); err != nil {+ results = append(results, &v1pb.QueryResult{+ Error: err.Error(),+ })+ continue+ }++ field := []string{"Affected Rows"}+ types := []string{"INT64"}+ rows := []*v1pb.QueryRow{+ {+ Values: []*v1pb.RowValue{+ {+ Kind: &v1pb.RowValue_Int64Value{Int64Value: rowCount},+ },+ },+ },+ }+ results = append(results, &v1pb.QueryResult{+ ColumnNames: field,+ ColumnTypeNames: types,+ Rows: rows,+ })+ }++ return results, nil+}diff --git a/backend/plugin/db/sqlite/sqlite.go b/backend/plugin/db/sqlite/sqlite.goindex 27bebfa45e..f89941f34e 100644--- a/backend/plugin/db/sqlite/sqlite.go+++ b/backend/plugin/db/sqlite/sqlite.go@@ -161,3 +161,8 @@ func (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string,func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {return nil, errors.New("not implemented")}++// RunStatement runs a SQL statement.+func (*Driver) RunStatement(_ context.Context, _ *sql.Conn, _ string) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.goindex 8fd044f2dc..c3778f73b2 100644--- a/backend/plugin/db/util/driverutil.go+++ b/backend/plugin/db/util/driverutil.go@@ -20,10 +20,13 @@ import ("github.com/paulmach/orb/encoding/wkt""github.com/pkg/errors""github.com/shopspring/decimal"+ "go.uber.org/zap""google.golang.org/protobuf/types/known/structpb""github.com/bytebase/bytebase/backend/common"+ "github.com/bytebase/bytebase/backend/common/log""github.com/bytebase/bytebase/backend/plugin/db"+ parser "github.com/bytebase/bytebase/backend/plugin/parser/sql"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")@@ -278,6 +281,109 @@ func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement strin}, nil}+// RunStatement runs a SQL statement in a given connection.+func RunStatement(ctx context.Context, engineType parser.EngineType, conn *sql.Conn, statement string) ([]*v1pb.QueryResult, error) {+ singleSQLs, err := parser.SplitMultiSQL(engineType, statement)+ if err != nil {+ return nil, err+ }+ if len(singleSQLs) == 0 {+ return nil, nil+ }++ var results []*v1pb.QueryResult+ for _, singleSQL := range singleSQLs {+ if singleSQL.Empty {+ continue+ }+ if IsAffectedRowsStatement(singleSQL.Text) {+ sqlResult, err := conn.ExecContext(ctx, singleSQLs[0].Text)+ if err != nil {+ return nil, err+ }+ affectedRows, err := sqlResult.RowsAffected()+ if err != nil {+ log.Info("rowsAffected returns error", zap.Error(err))+ }++ field := []string{"Affected Rows"}+ types := []string{"INT"}+ rows := []*v1pb.QueryRow{+ {+ Values: []*v1pb.RowValue{+ {+ Kind: &v1pb.RowValue_Int64Value{+ Int64Value: affectedRows,+ },+ },+ },+ },+ }+ results = append(results, &v1pb.QueryResult{+ ColumnNames: field,+ ColumnTypeNames: types,+ Rows: rows,+ })+ continue+ }+ results = append(results, adminQuery(ctx, conn, singleSQL.Text))+ }++ return results, nil+}++func adminQuery(ctx context.Context, conn *sql.Conn, statement string) *v1pb.QueryResult {+ rows, err := conn.QueryContext(ctx, statement)+ if err != nil {+ return &v1pb.QueryResult{+ Error: err.Error(),+ }+ }+ defer rows.Close()++ result, err := rowsToQueryResult(rows)+ if err != nil {+ return &v1pb.QueryResult{+ Error: err.Error(),+ }+ }+ return result+}++func rowsToQueryResult(rows *sql.Rows) (*v1pb.QueryResult, error) {+ columnNames, err := rows.Columns()+ if err != nil {+ return nil, err+ }++ columnTypes, err := rows.ColumnTypes()+ if err != nil {+ return nil, err+ }++ var columnTypeNames []string+ for _, v := range columnTypes {+ // DatabaseTypeName returns the database system name of the column type.+ // refer: https://pkg.go.dev/database/sql#ColumnType.DatabaseTypeName+ columnTypeNames = append(columnTypeNames, strings.ToUpper(v.DatabaseTypeName()))+ }++ data, err := readRows2(rows, columnTypes, columnTypeNames, nil)+ if err != nil {+ return nil, err+ }++ if err := rows.Err(); err != nil {+ return nil, err+ }++ return &v1pb.QueryResult{+ ColumnNames: columnNames,+ ColumnTypeNames: columnTypeNames,+ Rows: data,+ }, nil+}+// query will execute a query.func queryAdmin(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string, _ int) ([]any, error) {rows, err := conn.QueryContext(ctx, statement)diff --git a/backend/plugin/parser/sql/parser.go b/backend/plugin/parser/sql/parser.goindex 5630a2a3e6..523dd88eb4 100644--- a/backend/plugin/parser/sql/parser.go+++ b/backend/plugin/parser/sql/parser.go@@ -32,6 +32,8 @@ const (Redshift EngineType = "REDSHIFT"// OceanBase is the engine type for OceanBase.OceanBase EngineType = "OCEANBASE"+ // Snowflake is the engine type for Snowflake.+ Snowflake EngineType = "SNOWFLAKE"// DeparseIndentString is the string for each indent level.DeparseIndentString = " "diff --git a/backend/plugin/parser/sql/utils.go b/backend/plugin/parser/sql/utils.goindex 181fba2154..d70a917373 100644--- a/backend/plugin/parser/sql/utils.go+++ b/backend/plugin/parser/sql/utils.go@@ -1,6 +1,7 @@package parserimport (+ "bufio""bytes""fmt""io"@@ -246,7 +247,14 @@ func SplitMultiSQL(engineType EngineType, statement string) ([]SingleSQL, error)t := newTokenizer(statement)list, err = t.splitMySQLMultiSQL()default:- return nil, errors.Errorf("engine type is not supported: %s", engineType)+ err = applyMultiStatements(strings.NewReader(statement), func(sql string) error {+ list = append(list, SingleSQL{+ Text: sql,+ LastLine: 0,+ Empty: false,+ })+ return nil+ })}if err != nil {@@ -266,6 +274,92 @@ func SplitMultiSQL(engineType EngineType, statement string) ([]SingleSQL, error)return result, nil}+// applyMultiStatements will apply the split statements from scanner.+// This function only used for SQLite, snowflake.+// For MySQL and PostgreSQL, use parser.SplitMultiSQLStream instead.+// Copy from plugin/db/util/driverutil.go.+func applyMultiStatements(sc io.Reader, f func(string) error) error {+ // TODO(rebelice): use parser/tokenizer to split SQL statements.+ reader := bufio.NewReader(sc)+ var sb strings.Builder+ delimiter := false+ comment := false+ done := false+ for !done {+ line, err := reader.ReadString('\n')+ if err != nil {+ if err == io.EOF {+ done = true+ } else {+ return err+ }+ }+ line = strings.TrimRight(line, "\r\n")++ execute := false+ switch {+ case strings.HasPrefix(line, "/*"):+ if strings.Contains(line, "*/") {+ if !strings.HasSuffix(line, "*/") {+ return errors.Errorf("`*/` must be the end of the line; new statement should start as a new line")+ }+ } else {+ comment = true+ }+ continue+ case comment && !strings.Contains(line, "*/"):+ // Skip the line when in comment mode.+ continue+ case comment && strings.Contains(line, "*/"):+ if !strings.HasSuffix(line, "*/") {+ return errors.Errorf("`*/` must be the end of the line; new statement should start as a new line")+ }+ comment = false+ continue+ case sb.Len() == 0 && line == "":+ continue+ case strings.HasPrefix(line, "--"):+ continue+ case line == "DELIMITER ;;":+ delimiter = true+ continue+ case line == "DELIMITER ;" && delimiter:+ delimiter = false+ execute = true+ case strings.HasSuffix(line, ";"):+ _, _ = sb.WriteString(line)+ _, _ = sb.WriteString("\n")+ if !delimiter {+ execute = true+ }+ default:+ _, _ = sb.WriteString(line)+ _, _ = sb.WriteString("\n")+ continue+ }+ if execute {+ s := sb.String()+ s = strings.Trim(s, "\n\t ")+ if s != "" {+ if err := f(s); err != nil {+ return errors.Wrapf(err, "execute query %q failed", s)+ }+ }+ sb.Reset()+ }+ }+ // Apply the remaining content.+ s := sb.String()+ s = strings.Trim(s, "\n\t ")+ if s != "" {+ if err := f(s); err != nil {+ return errors.Wrapf(err, "execute query %q failed", s)+ }+ }++ return nil+}+// SplitMultiSQLStream splits statement stream into a slice of the single SQL.func SplitMultiSQLStream(engineType EngineType, src io.Reader, f func(string) error) ([]SingleSQL, error) {var list []SingleSQLdiff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.tsindex 6fdae07c98..e9bf1d64f8 100644--- a/frontend/src/types/proto/v1/sql_service.ts+++ b/frontend/src/types/proto/v1/sql_service.ts@@ -7,6 +7,29 @@ import { Engine, engineFromJSON, engineToJSON } from "./common";export const protobufPackage = "bytebase.v1";+export interface AdminExecuteRequest {+ /**+ * The name is the instance name to execute the query against.+ * Format: instances/{instance}+ */+ name: string;+ /**+ * The connection database name to execute the query against.+ * For PostgreSQL, it's required.+ * For other database engines, it's optional. Use empty string to execute against without specifying a database.+ */+ connectionDatabase: string;+ /** The SQL statement to execute. */+ statement: string;+ /** The maximum number of rows to return. */+ limit: number;+}++export interface AdminExecuteResponse {+ /** The query results. */+ results: QueryResult[];+}+export interface ExportRequest {/*** The name is the instance name to execute the query against.@@ -213,6 +236,163 @@ export interface PrettyResponse {expectedSchema: string;}+function createBaseAdminExecuteRequest(): AdminExecuteRequest {+ return { name: "", connectionDatabase: "", statement: "", limit: 0 };+}++export const AdminExecuteRequest = {+ encode(message: AdminExecuteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ if (message.connectionDatabase !== "") {+ writer.uint32(18).string(message.connectionDatabase);+ }+ if (message.statement !== "") {+ writer.uint32(26).string(message.statement);+ }+ if (message.limit !== 0) {+ writer.uint32(32).int32(message.limit);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): AdminExecuteRequest {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseAdminExecuteRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.name = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.connectionDatabase = reader.string();+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.statement = reader.string();+ continue;+ case 4:+ if (tag !== 32) {+ break;+ }++ message.limit = reader.int32();+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): AdminExecuteRequest {+ return {+ name: isSet(object.name) ? String(object.name) : "",+ connectionDatabase: isSet(object.connectionDatabase) ? String(object.connectionDatabase) : "",+ statement: isSet(object.statement) ? String(object.statement) : "",+ limit: isSet(object.limit) ? Number(object.limit) : 0,+ };+ },++ toJSON(message: AdminExecuteRequest): unknown {+ const obj: any = {};+ message.name !== undefined && (obj.name = message.name);+ message.connectionDatabase !== undefined && (obj.connectionDatabase = message.connectionDatabase);+ message.statement !== undefined && (obj.statement = message.statement);+ message.limit !== undefined && (obj.limit = Math.round(message.limit));+ return obj;+ },++ create(base?: DeepPartial<AdminExecuteRequest>): AdminExecuteRequest {+ return AdminExecuteRequest.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<AdminExecuteRequest>): AdminExecuteRequest {+ const message = createBaseAdminExecuteRequest();+ message.name = object.name ?? "";+ message.connectionDatabase = object.connectionDatabase ?? "";+ message.statement = object.statement ?? "";+ message.limit = object.limit ?? 0;+ return message;+ },+};++function createBaseAdminExecuteResponse(): AdminExecuteResponse {+ return { results: [] };+}++export const AdminExecuteResponse = {+ encode(message: AdminExecuteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.results) {+ QueryResult.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): AdminExecuteResponse {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseAdminExecuteResponse();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.results.push(QueryResult.decode(reader, reader.uint32()));+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): AdminExecuteResponse {+ return { results: Array.isArray(object?.results) ? object.results.map((e: any) => QueryResult.fromJSON(e)) : [] };+ },++ toJSON(message: AdminExecuteResponse): unknown {+ const obj: any = {};+ if (message.results) {+ obj.results = message.results.map((e) => e ? QueryResult.toJSON(e) : undefined);+ } else {+ obj.results = [];+ }+ return obj;+ },++ create(base?: DeepPartial<AdminExecuteResponse>): AdminExecuteResponse {+ return AdminExecuteResponse.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<AdminExecuteResponse>): AdminExecuteResponse {+ const message = createBaseAdminExecuteResponse();+ message.results = object.results?.map((e) => QueryResult.fromPartial(e)) || [];+ return message;+ },+};+function createBaseExportRequest(): ExportRequest {return { name: "", connectionDatabase: "", statement: "", limit: 0, format: 0 };}@@ -1352,6 +1532,43 @@ export const SQLServiceDefinition = {},},},+ adminExecute: {+ name: "AdminExecute",+ requestType: AdminExecuteRequest,+ requestStream: true,+ responseType: AdminExecuteResponse,+ responseStream: true,+ options: {+ _unknownFields: {+ 578365826: [+ new Uint8Array([+ 21,+ 58,+ 1,+ 42,+ 34,+ 16,+ 47,+ 118,+ 49,+ 58,+ 97,+ 100,+ 109,+ 105,+ 110,+ 69,+ 120,+ 101,+ 99,+ 117,+ 116,+ 101,+ ]),+ ],+ },+ },+ },},} as const;@@ -1359,12 +1576,20 @@ export interface SQLServiceImplementation<CallContextExt = {}> {pretty(request: PrettyRequest, context: CallContext & CallContextExt): Promise<DeepPartial<PrettyResponse>>;query(request: QueryRequest, context: CallContext & CallContextExt): Promise<DeepPartial<QueryResponse>>;export(request: ExportRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ExportResponse>>;+ adminExecute(+ request: AsyncIterable<AdminExecuteRequest>,+ context: CallContext & CallContextExt,+ ): ServerStreamingMethodResult<DeepPartial<AdminExecuteResponse>>;}export interface SQLServiceClient<CallOptionsExt = {}> {pretty(request: DeepPartial<PrettyRequest>, options?: CallOptions & CallOptionsExt): Promise<PrettyResponse>;query(request: DeepPartial<QueryRequest>, options?: CallOptions & CallOptionsExt): Promise<QueryResponse>;export(request: DeepPartial<ExportRequest>, options?: CallOptions & CallOptionsExt): Promise<ExportResponse>;+ adminExecute(+ request: AsyncIterable<DeepPartial<AdminExecuteRequest>>,+ options?: CallOptions & CallOptionsExt,+ ): AsyncIterable<AdminExecuteResponse>;}declare var self: any | undefined;@@ -1435,3 +1660,5 @@ if (_m0.util.Long !== Long) {function isSet(value: any): boolean {return value !== null && value !== undefined;}++export type ServerStreamingMethodResult<Response> = { [Symbol.asyncIterator](): AsyncIterator<Response, void> };diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 133563433c..3c3284f591 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -478,6 +478,8 @@- [SheetService](#bytebase-v1-SheetService)- [v1/sql_service.proto](#v1_sql_service-proto)+ - [AdminExecuteRequest](#bytebase-v1-AdminExecuteRequest)+ - [AdminExecuteResponse](#bytebase-v1-AdminExecuteResponse)- [Advice](#bytebase-v1-Advice)- [ExportRequest](#bytebase-v1-ExportRequest)- [ExportResponse](#bytebase-v1-ExportResponse)@@ -7495,6 +7497,39 @@ The sheet's `name` field is used to identify the sheet to update. Format: pr+<a name="bytebase-v1-AdminExecuteRequest"></a>++### AdminExecuteRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name is the instance name to execute the query against. Format: instances/{instance} |+| connection_database | [string](#string) | | The connection database name to execute the query against. For PostgreSQL, it's required. For other database engines, it's optional. Use empty string to execute against without specifying a database. |+| statement | [string](#string) | | The SQL statement to execute. |+| limit | [int32](#int32) | | The maximum number of rows to return. |+++++++<a name="bytebase-v1-AdminExecuteResponse"></a>++### AdminExecuteResponse++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| results | [QueryResult](#bytebase-v1-QueryResult) | repeated | The query results. |++++++<a name="bytebase-v1-Advice"></a>### Advice@@ -7718,6 +7753,7 @@ The sheet's `name` field is used to identify the sheet to update. Format: pr| Pretty | [PrettyRequest](#bytebase-v1-PrettyRequest) | [PrettyResponse](#bytebase-v1-PrettyResponse) | || Query | [QueryRequest](#bytebase-v1-QueryRequest) | [QueryResponse](#bytebase-v1-QueryResponse) | || Export | [ExportRequest](#bytebase-v1-ExportRequest) | [ExportResponse](#bytebase-v1-ExportResponse) | |+| AdminExecute | [AdminExecuteRequest](#bytebase-v1-AdminExecuteRequest) stream | [AdminExecuteResponse](#bytebase-v1-AdminExecuteResponse) stream | |diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.goindex 2790b39789..50c1ccf30b 100644--- a/proto/generated-go/v1/sql_service.pb.go+++ b/proto/generated-go/v1/sql_service.pb.go@@ -68,7 +68,7 @@ func (x ExportRequest_Format) Number() protoreflect.EnumNumber {// Deprecated: Use ExportRequest_Format.Descriptor instead.func (ExportRequest_Format) EnumDescriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{0, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{2, 0}}type Advice_Status int32@@ -121,7 +121,133 @@ func (x Advice_Status) Number() protoreflect.EnumNumber {// Deprecated: Use Advice_Status.Descriptor instead.func (Advice_Status) EnumDescriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{7, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{9, 0}+}++type AdminExecuteRequest struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The name is the instance name to execute the query against.+ // Format: instances/{instance}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ // The connection database name to execute the query against.+ // For PostgreSQL, it's required.+ // For other database engines, it's optional. Use empty string to execute against without specifying a database.+ ConnectionDatabase string `protobuf:"bytes,2,opt,name=connection_database,json=connectionDatabase,proto3" json:"connection_database,omitempty"`+ // The SQL statement to execute.+ Statement string `protobuf:"bytes,3,opt,name=statement,proto3" json:"statement,omitempty"`+ // The maximum number of rows to return.+ Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`+}++func (x *AdminExecuteRequest) Reset() {+ *x = AdminExecuteRequest{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_sql_service_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *AdminExecuteRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*AdminExecuteRequest) ProtoMessage() {}++func (x *AdminExecuteRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_sql_service_proto_msgTypes[0]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use AdminExecuteRequest.ProtoReflect.Descriptor instead.+func (*AdminExecuteRequest) Descriptor() ([]byte, []int) {+ return file_v1_sql_service_proto_rawDescGZIP(), []int{0}+}++func (x *AdminExecuteRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *AdminExecuteRequest) GetConnectionDatabase() string {+ if x != nil {+ return x.ConnectionDatabase+ }+ return ""+}++func (x *AdminExecuteRequest) GetStatement() string {+ if x != nil {+ return x.Statement+ }+ return ""+}++func (x *AdminExecuteRequest) GetLimit() int32 {+ if x != nil {+ return x.Limit+ }+ return 0+}++type AdminExecuteResponse struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The query results.+ Results []*QueryResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`+}++func (x *AdminExecuteResponse) Reset() {+ *x = AdminExecuteResponse{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_sql_service_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *AdminExecuteResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*AdminExecuteResponse) ProtoMessage() {}++func (x *AdminExecuteResponse) ProtoReflect() protoreflect.Message {+ mi := &file_v1_sql_service_proto_msgTypes[1]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use AdminExecuteResponse.ProtoReflect.Descriptor instead.+func (*AdminExecuteResponse) Descriptor() ([]byte, []int) {+ return file_v1_sql_service_proto_rawDescGZIP(), []int{1}+}++func (x *AdminExecuteResponse) GetResults() []*QueryResult {+ if x != nil {+ return x.Results+ }+ return nil}type ExportRequest struct {@@ -147,7 +273,7 @@ type ExportRequest struct {func (x *ExportRequest) Reset() {*x = ExportRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[0]+ mi := &file_v1_sql_service_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -160,7 +286,7 @@ func (x *ExportRequest) String() string {func (*ExportRequest) ProtoMessage() {}func (x *ExportRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[0]+ mi := &file_v1_sql_service_proto_msgTypes[2]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -173,7 +299,7 @@ func (x *ExportRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExportRequest.ProtoReflect.Descriptor instead.func (*ExportRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{2}}func (x *ExportRequest) GetName() string {@@ -223,7 +349,7 @@ type ExportResponse struct {func (x *ExportResponse) Reset() {*x = ExportResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[1]+ mi := &file_v1_sql_service_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -236,7 +362,7 @@ func (x *ExportResponse) String() string {func (*ExportResponse) ProtoMessage() {}func (x *ExportResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[1]+ mi := &file_v1_sql_service_proto_msgTypes[3]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -249,7 +375,7 @@ func (x *ExportResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ExportResponse.ProtoReflect.Descriptor instead.func (*ExportResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{1}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{3}}func (x *ExportResponse) GetContent() []byte {@@ -280,7 +406,7 @@ type QueryRequest struct {func (x *QueryRequest) Reset() {*x = QueryRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[2]+ mi := &file_v1_sql_service_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -293,7 +419,7 @@ func (x *QueryRequest) String() string {func (*QueryRequest) ProtoMessage() {}func (x *QueryRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[2]+ mi := &file_v1_sql_service_proto_msgTypes[4]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -306,7 +432,7 @@ func (x *QueryRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.func (*QueryRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{2}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{4}}func (x *QueryRequest) GetName() string {@@ -351,7 +477,7 @@ type QueryResponse struct {func (x *QueryResponse) Reset() {*x = QueryResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[3]+ mi := &file_v1_sql_service_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -364,7 +490,7 @@ func (x *QueryResponse) String() string {func (*QueryResponse) ProtoMessage() {}func (x *QueryResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[3]+ mi := &file_v1_sql_service_proto_msgTypes[5]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -377,7 +503,7 @@ func (x *QueryResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.func (*QueryResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{3}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{5}}func (x *QueryResponse) GetResults() []*QueryResult {@@ -415,7 +541,7 @@ type QueryResult struct {func (x *QueryResult) Reset() {*x = QueryResult{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[4]+ mi := &file_v1_sql_service_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -428,7 +554,7 @@ func (x *QueryResult) String() string {func (*QueryResult) ProtoMessage() {}func (x *QueryResult) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[4]+ mi := &file_v1_sql_service_proto_msgTypes[6]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -441,7 +567,7 @@ func (x *QueryResult) ProtoReflect() protoreflect.Message {// Deprecated: Use QueryResult.ProtoReflect.Descriptor instead.func (*QueryResult) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{4}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{6}}func (x *QueryResult) GetColumnNames() []string {@@ -491,7 +617,7 @@ type QueryRow struct {func (x *QueryRow) Reset() {*x = QueryRow{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[5]+ mi := &file_v1_sql_service_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -504,7 +630,7 @@ func (x *QueryRow) String() string {func (*QueryRow) ProtoMessage() {}func (x *QueryRow) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[5]+ mi := &file_v1_sql_service_proto_msgTypes[7]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -517,7 +643,7 @@ func (x *QueryRow) ProtoReflect() protoreflect.Message {// Deprecated: Use QueryRow.ProtoReflect.Descriptor instead.func (*QueryRow) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{5}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{7}}func (x *QueryRow) GetValues() []*RowValue {@@ -551,7 +677,7 @@ type RowValue struct {func (x *RowValue) Reset() {*x = RowValue{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[6]+ mi := &file_v1_sql_service_proto_msgTypes[8]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -564,7 +690,7 @@ func (x *RowValue) String() string {func (*RowValue) ProtoMessage() {}func (x *RowValue) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[6]+ mi := &file_v1_sql_service_proto_msgTypes[8]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -577,7 +703,7 @@ func (x *RowValue) ProtoReflect() protoreflect.Message {// Deprecated: Use RowValue.ProtoReflect.Descriptor instead.func (*RowValue) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{6}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{8}}func (m *RowValue) GetKind() isRowValue_Kind {@@ -757,7 +883,7 @@ type Advice struct {func (x *Advice) Reset() {*x = Advice{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[7]+ mi := &file_v1_sql_service_proto_msgTypes[9]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -770,7 +896,7 @@ func (x *Advice) String() string {func (*Advice) ProtoMessage() {}func (x *Advice) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[7]+ mi := &file_v1_sql_service_proto_msgTypes[9]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -783,7 +909,7 @@ func (x *Advice) ProtoReflect() protoreflect.Message {// Deprecated: Use Advice.ProtoReflect.Descriptor instead.func (*Advice) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{7}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{9}}func (x *Advice) GetStatus() Advice_Status {@@ -844,7 +970,7 @@ type PrettyRequest struct {func (x *PrettyRequest) Reset() {*x = PrettyRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[8]+ mi := &file_v1_sql_service_proto_msgTypes[10]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -857,7 +983,7 @@ func (x *PrettyRequest) String() string {func (*PrettyRequest) ProtoMessage() {}func (x *PrettyRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[8]+ mi := &file_v1_sql_service_proto_msgTypes[10]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -870,7 +996,7 @@ func (x *PrettyRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PrettyRequest.ProtoReflect.Descriptor instead.func (*PrettyRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{8}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{10}}func (x *PrettyRequest) GetEngine() Engine {@@ -908,7 +1034,7 @@ type PrettyResponse struct {func (x *PrettyResponse) Reset() {*x = PrettyResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[9]+ mi := &file_v1_sql_service_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -921,7 +1047,7 @@ func (x *PrettyResponse) String() string {func (*PrettyResponse) ProtoMessage() {}func (x *PrettyResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[9]+ mi := &file_v1_sql_service_proto_msgTypes[11]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -934,7 +1060,7 @@ func (x *PrettyResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PrettyResponse.ProtoReflect.Descriptor instead.func (*PrettyResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{9}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{11}}func (x *PrettyResponse) GetCurrentSchema() string {@@ -963,138 +1089,159 @@ var file_v1_sql_service_proto_rawDesc = []byte{0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x22, 0xfd, 0x01, 0x0a, 0x0d, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x13,- 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62,- 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x65,- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a,- 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,- 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c,- 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69,- 0x74, 0x12, 0x39, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,- 0x0e, 0x32, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46, 0x6f,- 0x72, 0x6d, 0x61, 0x74, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x33, 0x0a, 0x06,- 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x12, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54,- 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07,- 0x0a, 0x03, 0x43, 0x53, 0x56, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4a, 0x53, 0x4f, 0x4e, 0x10,- 0x02, 0x22, 0x2a, 0x0a, 0x0e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,- 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x8c, 0x01,- 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17,- 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41,- 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65,- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x02,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,- 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74,- 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61,- 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18,- 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x72, 0x0a, 0x0d,- 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a,- 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65,- 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,- 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03,- 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73,- 0x22, 0xb5, 0x01, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,- 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73,- 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4e, 0x61,- 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x74, 0x79,- 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f,- 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12,- 0x29, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72,- 0x79, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61,- 0x73, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x08, 0x52, 0x06, 0x6d, 0x61, 0x73, 0x6b,- 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x39, 0x0a, 0x08, 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, 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, 0x61, 0x6c, 0x75, 0x65,- 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a,- 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21,- 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20,- 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75,- 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75,- 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c,- 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f,- 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x0a, 0x66,- 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74,- 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00,- 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b,- 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,- 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,- 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,- 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56,- 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76,- 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 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, 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, 0xc0, 0x02, 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, 0x12, 0x6b,- 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71,- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,- 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76,- 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,- 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 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,+ 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x13, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75,+ 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a,+ 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61,+ 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e,+ 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c,+ 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,+ 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d,+ 0x69, 0x74, 0x22, 0x4a, 0x0a, 0x14, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75,+ 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65,+ 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,+ 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xfd,+ 0x01, 0x0a, 0x0d, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,+ 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,+ 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x63, 0x6f, 0x6e,+ 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74,+ 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,+ 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69,+ 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x39,+ 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70,+ 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x61,+ 0x74, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x33, 0x0a, 0x06, 0x46, 0x6f, 0x72,+ 0x6d, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x12, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e,+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x43,+ 0x53, 0x56, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x02, 0x22, 0x2a,+ 0x0a, 0x0e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,+ 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,+ 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x8c, 0x01, 0x0a, 0x0c, 0x51,+ 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e,+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04,+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,+ 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74,+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65,+ 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d,+ 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01,+ 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x72, 0x0a, 0x0d, 0x51, 0x75, 0x65,+ 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65,+ 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,+ 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2d,+ 0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,+ 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64,+ 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0xb5, 0x01,+ 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a,+ 0x0c, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20,+ 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73,+ 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f,+ 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6c,+ 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x04,+ 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f,+ 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65,+ 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x08, 0x52, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x12,+ 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,+ 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x39, 0x0a, 0x08, 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, 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, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52,+ 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f,+ 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00,+ 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62,+ 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,+ 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23,+ 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04,+ 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61,+ 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c,+ 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61,+ 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f,+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x69,+ 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74,+ 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00,+ 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c,+ 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01,+ 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75,+ 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75,+ 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 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, 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, 0xb6, 0x03, 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, 0x12, 0x6b, 0x0a, 0x06, 0x45,+ 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,+ 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28,+ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b,+ 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,+ 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x74, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69,+ 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63,+ 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78,+ 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82,+ 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x3a, 0x61, 0x64,+ 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x28, 0x01, 0x30, 0x01, 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 (@@ -1110,45 +1257,50 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {}var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)+var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12)var file_v1_sql_service_proto_goTypes = []interface{}{- (ExportRequest_Format)(0), // 0: bytebase.v1.ExportRequest.Format- (Advice_Status)(0), // 1: bytebase.v1.Advice.Status- (*ExportRequest)(nil), // 2: bytebase.v1.ExportRequest- (*ExportResponse)(nil), // 3: bytebase.v1.ExportResponse- (*QueryRequest)(nil), // 4: bytebase.v1.QueryRequest- (*QueryResponse)(nil), // 5: bytebase.v1.QueryResponse- (*QueryResult)(nil), // 6: bytebase.v1.QueryResult- (*QueryRow)(nil), // 7: bytebase.v1.QueryRow- (*RowValue)(nil), // 8: bytebase.v1.RowValue- (*Advice)(nil), // 9: bytebase.v1.Advice- (*PrettyRequest)(nil), // 10: bytebase.v1.PrettyRequest- (*PrettyResponse)(nil), // 11: bytebase.v1.PrettyResponse- (structpb.NullValue)(0), // 12: google.protobuf.NullValue- (*structpb.Value)(nil), // 13: google.protobuf.Value- (Engine)(0), // 14: bytebase.v1.Engine+ (ExportRequest_Format)(0), // 0: bytebase.v1.ExportRequest.Format+ (Advice_Status)(0), // 1: bytebase.v1.Advice.Status+ (*AdminExecuteRequest)(nil), // 2: bytebase.v1.AdminExecuteRequest+ (*AdminExecuteResponse)(nil), // 3: bytebase.v1.AdminExecuteResponse+ (*ExportRequest)(nil), // 4: bytebase.v1.ExportRequest+ (*ExportResponse)(nil), // 5: bytebase.v1.ExportResponse+ (*QueryRequest)(nil), // 6: bytebase.v1.QueryRequest+ (*QueryResponse)(nil), // 7: bytebase.v1.QueryResponse+ (*QueryResult)(nil), // 8: bytebase.v1.QueryResult+ (*QueryRow)(nil), // 9: bytebase.v1.QueryRow+ (*RowValue)(nil), // 10: bytebase.v1.RowValue+ (*Advice)(nil), // 11: bytebase.v1.Advice+ (*PrettyRequest)(nil), // 12: bytebase.v1.PrettyRequest+ (*PrettyResponse)(nil), // 13: bytebase.v1.PrettyResponse+ (structpb.NullValue)(0), // 14: google.protobuf.NullValue+ (*structpb.Value)(nil), // 15: google.protobuf.Value+ (Engine)(0), // 16: bytebase.v1.Engine}var file_v1_sql_service_proto_depIdxs = []int32{- 0, // 0: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportRequest.Format- 6, // 1: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult- 9, // 2: bytebase.v1.QueryResponse.advices:type_name -> bytebase.v1.Advice- 7, // 3: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow- 8, // 4: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue- 12, // 5: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue- 13, // 6: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value- 1, // 7: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status- 14, // 8: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine- 10, // 9: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest- 4, // 10: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest- 2, // 11: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest- 11, // 12: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse- 5, // 13: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse- 3, // 14: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse- 12, // [12:15] is the sub-list for method output_type- 9, // [9:12] is the sub-list for method input_type- 9, // [9:9] is the sub-list for extension type_name- 9, // [9:9] is the sub-list for extension extendee- 0, // [0:9] is the sub-list for field type_name+ 8, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult+ 0, // 1: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportRequest.Format+ 8, // 2: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult+ 11, // 3: bytebase.v1.QueryResponse.advices:type_name -> bytebase.v1.Advice+ 9, // 4: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow+ 10, // 5: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue+ 14, // 6: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue+ 15, // 7: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value+ 1, // 8: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status+ 16, // 9: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine+ 12, // 10: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest+ 6, // 11: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest+ 4, // 12: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest+ 2, // 13: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest+ 13, // 14: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse+ 7, // 15: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse+ 5, // 16: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse+ 3, // 17: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse+ 14, // [14:18] is the sub-list for method output_type+ 10, // [10:14] is the sub-list for method input_type+ 10, // [10:10] is the sub-list for extension type_name+ 10, // [10:10] is the sub-list for extension extendee+ 0, // [0:10] is the sub-list for field type_name}func init() { file_v1_sql_service_proto_init() }@@ -1159,7 +1311,7 @@ func file_v1_sql_service_proto_init() {file_v1_common_proto_init()if !protoimpl.UnsafeEnabled {file_v1_sql_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ExportRequest); i {+ switch v := v.(*AdminExecuteRequest); i {case 0:return &v.statecase 1:@@ -1171,7 +1323,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ExportResponse); i {+ switch v := v.(*AdminExecuteResponse); i {case 0:return &v.statecase 1:@@ -1183,7 +1335,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*QueryRequest); i {+ switch v := v.(*ExportRequest); i {case 0:return &v.statecase 1:@@ -1195,7 +1347,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*QueryResponse); i {+ switch v := v.(*ExportResponse); i {case 0:return &v.statecase 1:@@ -1207,7 +1359,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*QueryResult); i {+ switch v := v.(*QueryRequest); i {case 0:return &v.statecase 1:@@ -1219,7 +1371,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*QueryRow); i {+ switch v := v.(*QueryResponse); i {case 0:return &v.statecase 1:@@ -1231,7 +1383,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*RowValue); i {+ switch v := v.(*QueryResult); i {case 0:return &v.statecase 1:@@ -1243,7 +1395,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*Advice); i {+ switch v := v.(*QueryRow); i {case 0:return &v.statecase 1:@@ -1255,7 +1407,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*PrettyRequest); i {+ switch v := v.(*RowValue); i {case 0:return &v.statecase 1:@@ -1267,6 +1419,30 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Advice); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_sql_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PrettyRequest); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_sql_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*PrettyResponse); i {case 0:return &v.state@@ -1279,7 +1455,7 @@ func file_v1_sql_service_proto_init() {}}}- file_v1_sql_service_proto_msgTypes[6].OneofWrappers = []interface{}{+ file_v1_sql_service_proto_msgTypes[8].OneofWrappers = []interface{}{(*RowValue_NullValue)(nil),(*RowValue_BoolValue)(nil),(*RowValue_BytesValue)(nil),@@ -1298,7 +1474,7 @@ func file_v1_sql_service_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_sql_service_proto_rawDesc,NumEnums: 2,- NumMessages: 10,+ NumMessages: 12,NumExtensions: 0,NumServices: 1,},diff --git a/proto/generated-go/v1/sql_service.pb.gw.go b/proto/generated-go/v1/sql_service.pb.gw.goindex 9aef8cbed9..8b339254fe 100644--- a/proto/generated-go/v1/sql_service.pb.gw.go+++ b/proto/generated-go/v1/sql_service.pb.gw.go@@ -201,6 +201,49 @@ func local_request_SQLService_Export_0(ctx context.Context, marshaler runtime.Ma}+func request_SQLService_AdminExecute_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (SQLService_AdminExecuteClient, runtime.ServerMetadata, error) {+ var metadata runtime.ServerMetadata+ stream, err := client.AdminExecute(ctx)+ if err != nil {+ grpclog.Infof("Failed to start streaming: %v", err)+ return nil, metadata, err+ }+ dec := marshaler.NewDecoder(req.Body)+ handleSend := func() error {+ var protoReq AdminExecuteRequest+ err := dec.Decode(&protoReq)+ if err == io.EOF {+ return err+ }+ if err != nil {+ grpclog.Infof("Failed to decode request: %v", err)+ return err+ }+ if err := stream.Send(&protoReq); err != nil {+ grpclog.Infof("Failed to send request: %v", err)+ return err+ }+ return nil+ }+ go func() {+ for {+ if err := handleSend(); err != nil {+ break+ }+ }+ if err := stream.CloseSend(); err != nil {+ grpclog.Infof("Failed to terminate client stream: %v", err)+ }+ }()+ header, err := stream.Header()+ if err != nil {+ grpclog.Infof("Failed to get header from client: %v", err)+ return nil, metadata, err+ }+ metadata.HeaderMD = header+ return stream, metadata, nil+}+// RegisterSQLServiceHandlerServer registers the http handlers for service SQLService to "mux".// UnaryRPC :call SQLServiceServer directly.// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.@@ -282,6 +325,13 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,})+ mux.Handle("POST", pattern_SQLService_AdminExecute_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")+ _, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ })+return nil}@@ -389,6 +439,28 @@ func RegisterSQLServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,})+ mux.Handle("POST", pattern_SQLService_AdminExecute_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/AdminExecute", runtime.WithHTTPPathPattern("/v1:adminExecute"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_SQLService_AdminExecute_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_SQLService_AdminExecute_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)++ })+return nil}@@ -398,6 +470,8 @@ var (pattern_SQLService_Query_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "instances", "name"}, "query"))pattern_SQLService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "instances", "name"}, "export"))++ pattern_SQLService_AdminExecute_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"v1"}, "adminExecute")))var (@@ -406,4 +480,6 @@ var (forward_SQLService_Query_0 = runtime.ForwardResponseMessageforward_SQLService_Export_0 = runtime.ForwardResponseMessage++ forward_SQLService_AdminExecute_0 = runtime.ForwardResponseStream)diff --git a/proto/generated-go/v1/sql_service_grpc.pb.go b/proto/generated-go/v1/sql_service_grpc.pb.goindex de1433d774..f4bf2a5112 100644--- a/proto/generated-go/v1/sql_service_grpc.pb.go+++ b/proto/generated-go/v1/sql_service_grpc.pb.go@@ -19,9 +19,10 @@ import (const _ = grpc.SupportPackageIsVersion7const (- SQLService_Pretty_FullMethodName = "/bytebase.v1.SQLService/Pretty"- SQLService_Query_FullMethodName = "/bytebase.v1.SQLService/Query"- SQLService_Export_FullMethodName = "/bytebase.v1.SQLService/Export"+ SQLService_Pretty_FullMethodName = "/bytebase.v1.SQLService/Pretty"+ SQLService_Query_FullMethodName = "/bytebase.v1.SQLService/Query"+ SQLService_Export_FullMethodName = "/bytebase.v1.SQLService/Export"+ SQLService_AdminExecute_FullMethodName = "/bytebase.v1.SQLService/AdminExecute")// SQLServiceClient is the client API for SQLService service.@@ -31,6 +32,7 @@ type SQLServiceClient interface {Pretty(ctx context.Context, in *PrettyRequest, opts ...grpc.CallOption) (*PrettyResponse, error)Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error)+ AdminExecute(ctx context.Context, opts ...grpc.CallOption) (SQLService_AdminExecuteClient, error)}type sQLServiceClient struct {@@ -68,6 +70,37 @@ func (c *sQLServiceClient) Export(ctx context.Context, in *ExportRequest, opts .return out, nil}+func (c *sQLServiceClient) AdminExecute(ctx context.Context, opts ...grpc.CallOption) (SQLService_AdminExecuteClient, error) {+ stream, err := c.cc.NewStream(ctx, &SQLService_ServiceDesc.Streams[0], SQLService_AdminExecute_FullMethodName, opts...)+ if err != nil {+ return nil, err+ }+ x := &sQLServiceAdminExecuteClient{stream}+ return x, nil+}++type SQLService_AdminExecuteClient interface {+ Send(*AdminExecuteRequest) error+ Recv() (*AdminExecuteResponse, error)+ grpc.ClientStream+}++type sQLServiceAdminExecuteClient struct {+ grpc.ClientStream+}++func (x *sQLServiceAdminExecuteClient) Send(m *AdminExecuteRequest) error {+ return x.ClientStream.SendMsg(m)+}++func (x *sQLServiceAdminExecuteClient) Recv() (*AdminExecuteResponse, error) {+ m := new(AdminExecuteResponse)+ if err := x.ClientStream.RecvMsg(m); err != nil {+ return nil, err+ }+ return m, nil+}+// SQLServiceServer is the server API for SQLService service.// All implementations must embed UnimplementedSQLServiceServer// for forward compatibility@@ -75,6 +108,7 @@ type SQLServiceServer interface {Pretty(context.Context, *PrettyRequest) (*PrettyResponse, error)Query(context.Context, *QueryRequest) (*QueryResponse, error)Export(context.Context, *ExportRequest) (*ExportResponse, error)+ AdminExecute(SQLService_AdminExecuteServer) errormustEmbedUnimplementedSQLServiceServer()}@@ -91,6 +125,9 @@ func (UnimplementedSQLServiceServer) Query(context.Context, *QueryRequest) (*Quefunc (UnimplementedSQLServiceServer) Export(context.Context, *ExportRequest) (*ExportResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method Export not implemented")}+func (UnimplementedSQLServiceServer) AdminExecute(SQLService_AdminExecuteServer) error {+ return status.Errorf(codes.Unimplemented, "method AdminExecute not implemented")+}func (UnimplementedSQLServiceServer) mustEmbedUnimplementedSQLServiceServer() {}// UnsafeSQLServiceServer may be embedded to opt out of forward compatibility for this service.@@ -158,6 +195,32 @@ func _SQLService_Export_Handler(srv interface{}, ctx context.Context, dec func(ireturn interceptor(ctx, in, info, handler)}+func _SQLService_AdminExecute_Handler(srv interface{}, stream grpc.ServerStream) error {+ return srv.(SQLServiceServer).AdminExecute(&sQLServiceAdminExecuteServer{stream})+}++type SQLService_AdminExecuteServer interface {+ Send(*AdminExecuteResponse) error+ Recv() (*AdminExecuteRequest, error)+ grpc.ServerStream+}++type sQLServiceAdminExecuteServer struct {+ grpc.ServerStream+}++func (x *sQLServiceAdminExecuteServer) Send(m *AdminExecuteResponse) error {+ return x.ServerStream.SendMsg(m)+}++func (x *sQLServiceAdminExecuteServer) Recv() (*AdminExecuteRequest, error) {+ m := new(AdminExecuteRequest)+ if err := x.ServerStream.RecvMsg(m); err != nil {+ return nil, err+ }+ return m, nil+}+// SQLService_ServiceDesc is the grpc.ServiceDesc for SQLService service.// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)@@ -178,6 +241,13 @@ var SQLService_ServiceDesc = grpc.ServiceDesc{Handler: _SQLService_Export_Handler,},},- Streams: []grpc.StreamDesc{},+ Streams: []grpc.StreamDesc{+ {+ StreamName: "AdminExecute",+ Handler: _SQLService_AdminExecute_Handler,+ ServerStreams: true,+ ClientStreams: true,+ },+ },Metadata: "v1/sql_service.proto",}diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.protoindex 6ddeeb041f..fc656a23b8 100644--- a/proto/v1/sql_service.proto+++ b/proto/v1/sql_service.proto@@ -28,6 +28,34 @@ service SQLService {body: "*"};}+ rpc AdminExecute(stream AdminExecuteRequest) returns (stream AdminExecuteResponse) {+ option (google.api.http) = {+ post: "/v1:adminExecute"+ body: "*"+ };+ }+}++message AdminExecuteRequest {+ // The name is the instance name to execute the query against.+ // Format: instances/{instance}+ string name = 1;++ // The connection database name to execute the query against.+ // For PostgreSQL, it's required.+ // For other database engines, it's optional. Use empty string to execute against without specifying a database.+ string connection_database = 2;++ // The SQL statement to execute.+ string statement = 3;++ // The maximum number of rows to return.+ int32 limit = 4;+}++message AdminExecuteResponse {+ // The query results.+ repeated QueryResult results = 1;}message ExportRequest {