Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: extract QueryHistoryService from SQLService (#21067)
Danny Xu5d554f6b53d5
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 33958696ea..fa79980784 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -4190,6 +4190,120 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.Project'+ /bytebase.v1.QueryHistoryService/GetQueryHistory:+ post:+ tags:+ - bytebase.v1.QueryHistoryService+ summary: GetQueryHistory+ description: |-+ GetQueryHistory gets a single query history for the caller.+ Permissions required: None (only returns the caller's own query history)+ operationId: bytebase.v1.QueryHistoryService.GetQueryHistory+ parameters:+ - name: Connect-Protocol-Version+ in: header+ required: true+ schema:+ $ref: '#/components/schemas/connect-protocol-version'+ - name: Connect-Timeout-Ms+ in: header+ schema:+ $ref: '#/components/schemas/connect-timeout-header'+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.GetQueryHistoryRequest'+ required: true+ responses:+ default:+ description: Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/connect.error'+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.QueryHistory'+ /bytebase.v1.QueryHistoryService/ListQueryHistories:+ post:+ tags:+ - bytebase.v1.QueryHistoryService+ summary: ListQueryHistories+ description: |-+ ListQueryHistories lists query histories of all users in a project.+ Permissions required: bb.queryHistories.list+ operationId: bytebase.v1.QueryHistoryService.ListQueryHistories+ parameters:+ - name: Connect-Protocol-Version+ in: header+ required: true+ schema:+ $ref: '#/components/schemas/connect-protocol-version'+ - name: Connect-Timeout-Ms+ in: header+ schema:+ $ref: '#/components/schemas/connect-timeout-header'+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListQueryHistoriesRequest'+ required: true+ responses:+ default:+ description: Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/connect.error'+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListQueryHistoriesResponse'+ /bytebase.v1.QueryHistoryService/SearchQueryHistories:+ post:+ tags:+ - bytebase.v1.QueryHistoryService+ summary: SearchQueryHistories+ description: |-+ SearchQueryHistories searches query histories for the caller.+ Permissions required: None (only returns caller's own query histories)+ operationId: bytebase.v1.QueryHistoryService.SearchQueryHistories+ parameters:+ - name: Connect-Protocol-Version+ in: header+ required: true+ schema:+ $ref: '#/components/schemas/connect-protocol-version'+ - name: Connect-Timeout-Ms+ in: header+ schema:+ $ref: '#/components/schemas/connect-timeout-header'+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesRequest'+ required: true+ responses:+ default:+ description: Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/connect.error'+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesResponse'/bytebase.v1.ReleaseService/CheckRelease:post:tags:@@ -5571,7 +5685,9 @@ paths:- bytebase.v1.SQLServicesummary: GetQueryHistorydescription: |-- GetQueryHistory gets a single query history for the caller.+ Deprecated: use QueryHistoryService.GetQueryHistory instead.+ Delegating alias kept for upgrade transition; will be removed in a future release.+ No HTTP binding: the REST route is served by QueryHistoryService.Permissions required: None (only returns the caller's own query history)operationId: bytebase.v1.SQLService.GetQueryHistoryparameters:@@ -5603,13 +5719,16 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.QueryHistory'+ deprecated: true/bytebase.v1.SQLService/ListQueryHistories:post:tags:- bytebase.v1.SQLServicesummary: ListQueryHistoriesdescription: |-- ListQueryHistories lists query histories of all users in a project.+ Deprecated: use QueryHistoryService.ListQueryHistories instead.+ Delegating alias kept for upgrade transition; will be removed in a future release.+ No HTTP binding: the REST route is served by QueryHistoryService.Permissions required: bb.queryHistories.listoperationId: bytebase.v1.SQLService.ListQueryHistoriesparameters:@@ -5641,6 +5760,7 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.ListQueryHistoriesResponse'+ deprecated: true/bytebase.v1.SQLService/Query:post:tags:@@ -5685,7 +5805,9 @@ paths:- bytebase.v1.SQLServicesummary: SearchQueryHistoriesdescription: |-- SearchQueryHistories searches query histories for the caller.+ Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ Delegating alias kept for upgrade transition; will be removed in a future release.+ No HTTP binding: the REST route is served by QueryHistoryService.Permissions required: None (only returns caller's own query histories)operationId: bytebase.v1.SQLService.SearchQueryHistoriesparameters:@@ -5717,6 +5839,7 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesResponse'+ deprecated: true/bytebase.v1.ServiceAccountService/CreateServiceAccount:post:tags:@@ -22505,6 +22628,8 @@ tags:description: InstanceService manages database instances and their connections.- name: bytebase.v1.DatabaseServicedescription: DatabaseService manages databases and their schemas.+ - name: bytebase.v1.QueryHistoryService+ description: QueryHistoryService manages query history records of SQL Editor queries and exports.- name: bytebase.v1.SQLServicedescription: SQLService executes SQL queries and manages query operations.- name: bytebase.v1.PlanServicediff --git a/backend/api/v1/query_history_service.go b/backend/api/v1/query_history_service.gonew file mode 100644index 0000000000..057671e792--- /dev/null+++ b/backend/api/v1/query_history_service.go@@ -0,0 +1,222 @@+package v1++import (+ "context"+ "fmt"++ "connectrpc.com/connect"+ "github.com/pkg/errors"+ "google.golang.org/protobuf/types/known/timestamppb"++ "github.com/bytebase/bytebase/backend/common"+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"+ "github.com/bytebase/bytebase/backend/generated-go/v1/v1connect"+ "github.com/bytebase/bytebase/backend/store"+)++// QueryHistoryService implements the query history service.+type QueryHistoryService struct {+ v1connect.UnimplementedQueryHistoryServiceHandler+ store *store.Store+}++// NewQueryHistoryService creates a new QueryHistoryService.+func NewQueryHistoryService(store *store.Store) *QueryHistoryService {+ return &QueryHistoryService{+ store: store,+ }+}++// SearchQueryHistories lists the caller's own query histories in the parent+// project. The AIP-159 wildcard "projects/-" is rejected: cross-project reads+// are reserved for the IAM-gated ListQueryHistories.+func (s *QueryHistoryService) SearchQueryHistories(ctx context.Context, req *connect.Request[v1pb.SearchQueryHistoriesRequest]) (*connect.Response[v1pb.SearchQueryHistoriesResponse], error) {+ request := req.Msg+ user, ok := GetUserFromContext(ctx)+ if !ok {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))+ }++ find := &store.FindQueryHistoryMessage{Creator: &user.Email}+ if err := s.resolveQueryHistoryParent(ctx, request.Parent, find, false); err != nil {+ return nil, err+ }++ filterQ, err := store.GetListQueryHistoryFilter(request.Filter)+ if err != nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }+ find.FilterQ = filterQ++ histories, nextPageToken, err := s.paginatedQueryHistories(ctx, find, request.PageToken, request.PageSize)+ if err != nil {+ return nil, err+ }+ return connect.NewResponse(&v1pb.SearchQueryHistoriesResponse{+ QueryHistories: histories,+ NextPageToken: nextPageToken,+ }), nil+}++// ListQueryHistories lists query histories of all users in a project. The IAM+// interceptor checks bb.queryHistories.list on the parent project, or on the+// workspace when the parent is the AIP-159 wildcard "projects/-".+func (s *QueryHistoryService) ListQueryHistories(ctx context.Context, req *connect.Request[v1pb.ListQueryHistoriesRequest]) (*connect.Response[v1pb.ListQueryHistoriesResponse], error) {+ request := req.Msg+ find := &store.FindQueryHistoryMessage{}+ if err := s.resolveQueryHistoryParent(ctx, request.Parent, find, true); err != nil {+ return nil, err+ }++ creator, err := store.GetListQueryHistoriesCreatorFilter(request.Filter)+ if err != nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }+ find.Creator = creator++ histories, nextPageToken, err := s.paginatedQueryHistories(ctx, find, request.PageToken, request.PageSize)+ if err != nil {+ return nil, err+ }+ return connect.NewResponse(&v1pb.ListQueryHistoriesResponse{+ QueryHistories: histories,+ NextPageToken: nextPageToken,+ }), nil+}++// GetQueryHistory gets a single query history. Query histories are private to+// their creator, so only the creator may retrieve one.+func (s *QueryHistoryService) GetQueryHistory(ctx context.Context, req *connect.Request[v1pb.GetQueryHistoryRequest]) (*connect.Response[v1pb.QueryHistory], error) {+ user, ok := GetUserFromContext(ctx)+ if !ok {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))+ }++ projectID, historyID, err := common.GetProjectIDQueryHistoryID(req.Msg.Name)+ if err != nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }++ history, err := s.store.GetQueryHistory(ctx, historyID)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get query history: %v", err.Error()))+ }+ // Hide existence from non-creators and project mismatches by returning the+ // same not-found error for all three cases.+ if history == nil || history.Project != projectID || history.Creator != user.Email {+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("query history %q not found", req.Msg.Name))+ }++ queryHistory, err := s.convertToV1QueryHistory(ctx, history)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert query history"))+ }+ return connect.NewResponse(queryHistory), nil+}++// paginatedQueryHistories applies pagination to find, fetches one extra row to+// detect whether a next page exists, and converts the results to the v1 shape.+func (s *QueryHistoryService) paginatedQueryHistories(ctx context.Context, find *store.FindQueryHistoryMessage, pageToken string, requestedPageSize int32) ([]*v1pb.QueryHistory, string, error) {+ offset, err := parseLimitAndOffset(&pageSize{+ token: pageToken,+ limit: int(requestedPageSize),+ maximum: 1000,+ })+ if err != nil {+ return nil, "", err+ }+ limitPlusOne := offset.limit + 1+ find.Limit = &limitPlusOne+ find.Offset = &offset.offset++ historyList, err := s.store.ListQueryHistories(ctx, find)+ if err != nil {+ return nil, "", connect.NewError(connect.CodeInternal, errors.Errorf("failed to list history: %v", err.Error()))+ }++ nextPageToken := ""+ if len(historyList) == limitPlusOne {+ historyList = historyList[:offset.limit]+ if nextPageToken, err = offset.getNextPageToken(); err != nil {+ return nil, "", connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to marshal next page token"))+ }+ }++ var histories []*v1pb.QueryHistory+ for _, history := range historyList {+ queryHistory, err := s.convertToV1QueryHistory(ctx, history)+ if err != nil {+ return nil, "", connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert log entity"))+ }+ if queryHistory == nil {+ continue+ }+ histories = append(histories, queryHistory)+ }+ return histories, nextPageToken, nil+}++// resolveQueryHistoryParent applies the parent scope to find: a concrete+// "projects/{id}" parent must exist in the caller's workspace and scopes by+// project. When allowWildcard is set, the AIP-159 wildcard "projects/-"+// scopes by workspace instead, which is mandatory because query_history rows+// are workspace-scoped only through their project.+func (s *QueryHistoryService) resolveQueryHistoryParent(ctx context.Context, parent string, find *store.FindQueryHistoryMessage, allowWildcard bool) error {+ projectID, err := common.GetProjectID(parent)+ if err != nil {+ return connect.NewError(connect.CodeInvalidArgument, err)+ }+ if projectID == "-" {+ if !allowWildcard {+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf(`the wildcard parent "projects/-" is not supported; specify a concrete project`))+ }+ workspaceID := common.GetWorkspaceIDFromContext(ctx)+ if workspaceID == "" {+ return connect.NewError(connect.CodeInternal, errors.Errorf("workspace not found in context"))+ }+ find.Workspace = workspaceID+ return nil+ }+ project, err := s.store.GetProject(ctx, &store.FindProjectMessage{+ Workspace: common.GetWorkspaceIDFromContext(ctx),+ ResourceID: &projectID,+ })+ if err != nil {+ return connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get project"))+ }+ if project == nil {+ return connect.NewError(connect.CodeNotFound, errors.Errorf("project %q not found", parent))+ }+ find.Project = &projectID+ return nil+}++func (s *QueryHistoryService) convertToV1QueryHistory(ctx context.Context, history *store.QueryHistoryMessage) (*v1pb.QueryHistory, error) {+ creator, err := s.store.GetAccountByEmail(ctx, history.Creator)+ if err != nil {+ return nil, err+ }+ if creator == nil {+ return nil, errors.Errorf("cannot found user with email %s", history.Creator)+ }++ historyType := v1pb.QueryHistory_TYPE_UNSPECIFIED+ switch history.Type {+ case store.QueryHistoryTypeExport:+ historyType = v1pb.QueryHistory_EXPORT+ case store.QueryHistoryTypeQuery:+ historyType = v1pb.QueryHistory_QUERY+ default:+ }++ return &v1pb.QueryHistory{+ Name: fmt.Sprintf("%s/queryHistories/%s", common.FormatProject(history.Project), history.ResourceID),+ Statement: history.Statement,+ Error: history.Payload.Error,+ Database: history.Database,+ Creator: common.FormatUserEmail(creator.Email),+ CreateTime: timestamppb.New(history.CreatedAt),+ Duration: history.Payload.Duration,+ Type: historyType,+ }, nil+}diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex f443d63dda..f6bfb35c6c 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -47,6 +47,9 @@ type SQLService struct {dbFactory *dbfactory.DBFactorylicenseService *enterprise.LicenseServiceiamManager *iam.Manager+ // queryHistoryService backs the deprecated query history aliases until+ // they are removed.+ queryHistoryService *QueryHistoryService}// NewSQLService creates a SQLService.@@ -56,13 +59,15 @@ func NewSQLService(dbFactory *dbfactory.DBFactory,licenseService *enterprise.LicenseService,iamManager *iam.Manager,+ queryHistoryService *QueryHistoryService,) *SQLService {return &SQLService{- store: store,- schemaSyncer: schemaSyncer,- dbFactory: dbFactory,- licenseService: licenseService,- iamManager: iamManager,+ store: store,+ schemaSyncer: schemaSyncer,+ dbFactory: dbFactory,+ licenseService: licenseService,+ iamManager: iamManager,+ queryHistoryService: queryHistoryService,}}@@ -1405,168 +1410,28 @@ func (s *SQLService) createQueryHistory(database *store.DatabaseMessage, queryTy}}-// SearchQueryHistories lists the caller's own query histories in the parent-// project. The AIP-159 wildcard "projects/-" is rejected: cross-project reads-// are reserved for the IAM-gated ListQueryHistories.+// SearchQueryHistories is a deprecated delegating alias for+// QueryHistoryService.SearchQueryHistories, kept so gRPC/Connect callers of+// the old method name keep working during upgrade. It will be removed in a+// future release.func (s *SQLService) SearchQueryHistories(ctx context.Context, req *connect.Request[v1pb.SearchQueryHistoriesRequest]) (*connect.Response[v1pb.SearchQueryHistoriesResponse], error) {- request := req.Msg- user, ok := GetUserFromContext(ctx)- if !ok {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))- }-- find := &store.FindQueryHistoryMessage{Creator: &user.Email}- if err := s.resolveQueryHistoryParent(ctx, request.Parent, find, false); err != nil {- return nil, err- }-- filterQ, err := store.GetListQueryHistoryFilter(request.Filter)- if err != nil {- return nil, connect.NewError(connect.CodeInvalidArgument, err)- }- find.FilterQ = filterQ-- histories, nextPageToken, err := s.paginatedQueryHistories(ctx, find, request.PageToken, request.PageSize)- if err != nil {- return nil, err- }- return connect.NewResponse(&v1pb.SearchQueryHistoriesResponse{- QueryHistories: histories,- NextPageToken: nextPageToken,- }), nil+ return s.queryHistoryService.SearchQueryHistories(ctx, req)}-// paginatedQueryHistories applies pagination to find, fetches one extra row to-// detect whether a next page exists, and converts the results to the v1 shape.-func (s *SQLService) paginatedQueryHistories(ctx context.Context, find *store.FindQueryHistoryMessage, pageToken string, requestedPageSize int32) ([]*v1pb.QueryHistory, string, error) {- offset, err := parseLimitAndOffset(&pageSize{- token: pageToken,- limit: int(requestedPageSize),- maximum: 1000,- })- if err != nil {- return nil, "", err- }- limitPlusOne := offset.limit + 1- find.Limit = &limitPlusOne- find.Offset = &offset.offset-- historyList, err := s.store.ListQueryHistories(ctx, find)- if err != nil {- return nil, "", connect.NewError(connect.CodeInternal, errors.Errorf("failed to list history: %v", err.Error()))- }-- nextPageToken := ""- if len(historyList) == limitPlusOne {- historyList = historyList[:offset.limit]- if nextPageToken, err = offset.getNextPageToken(); err != nil {- return nil, "", connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to marshal next page token"))- }- }-- var histories []*v1pb.QueryHistory- for _, history := range historyList {- queryHistory, err := s.convertToV1QueryHistory(ctx, history)- if err != nil {- return nil, "", connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert log entity"))- }- if queryHistory == nil {- continue- }- histories = append(histories, queryHistory)- }- return histories, nextPageToken, nil-}--// ListQueryHistories lists query histories of all users in a project. The IAM-// interceptor checks bb.queryHistories.list on the parent project, or on the-// workspace when the parent is the AIP-159 wildcard "projects/-".+// ListQueryHistories is a deprecated delegating alias for+// QueryHistoryService.ListQueryHistories, kept so gRPC/Connect callers of+// the old method name keep working during upgrade. It will be removed in a+// future release.func (s *SQLService) ListQueryHistories(ctx context.Context, req *connect.Request[v1pb.ListQueryHistoriesRequest]) (*connect.Response[v1pb.ListQueryHistoriesResponse], error) {- request := req.Msg- find := &store.FindQueryHistoryMessage{}- if err := s.resolveQueryHistoryParent(ctx, request.Parent, find, true); err != nil {- return nil, err- }-- creator, err := store.GetListQueryHistoriesCreatorFilter(request.Filter)- if err != nil {- return nil, connect.NewError(connect.CodeInvalidArgument, err)- }- find.Creator = creator-- histories, nextPageToken, err := s.paginatedQueryHistories(ctx, find, request.PageToken, request.PageSize)- if err != nil {- return nil, err- }- return connect.NewResponse(&v1pb.ListQueryHistoriesResponse{- QueryHistories: histories,- NextPageToken: nextPageToken,- }), nil+ return s.queryHistoryService.ListQueryHistories(ctx, req)}-// resolveQueryHistoryParent applies the parent scope to find: a concrete-// "projects/{id}" parent must exist in the caller's workspace and scopes by-// project. When allowWildcard is set, the AIP-159 wildcard "projects/-"-// scopes by workspace instead, which is mandatory because query_history rows-// are workspace-scoped only through their project.-func (s *SQLService) resolveQueryHistoryParent(ctx context.Context, parent string, find *store.FindQueryHistoryMessage, allowWildcard bool) error {- projectID, err := common.GetProjectID(parent)- if err != nil {- return connect.NewError(connect.CodeInvalidArgument, err)- }- if projectID == "-" {- if !allowWildcard {- return connect.NewError(connect.CodeInvalidArgument, errors.Errorf(`the wildcard parent "projects/-" is not supported; specify a concrete project`))- }- workspaceID := common.GetWorkspaceIDFromContext(ctx)- if workspaceID == "" {- return connect.NewError(connect.CodeInternal, errors.Errorf("workspace not found in context"))- }- find.Workspace = workspaceID- return nil- }- project, err := s.store.GetProject(ctx, &store.FindProjectMessage{- Workspace: common.GetWorkspaceIDFromContext(ctx),- ResourceID: &projectID,- })- if err != nil {- return connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get project"))- }- if project == nil {- return connect.NewError(connect.CodeNotFound, errors.Errorf("project %q not found", parent))- }- find.Project = &projectID- return nil-}--// GetQueryHistory gets a single query history. Query histories are private to-// their creator, so only the creator may retrieve one.+// GetQueryHistory is a deprecated delegating alias for+// QueryHistoryService.GetQueryHistory, kept so gRPC/Connect callers of the+// old method name keep working during upgrade. It will be removed in a+// future release.func (s *SQLService) GetQueryHistory(ctx context.Context, req *connect.Request[v1pb.GetQueryHistoryRequest]) (*connect.Response[v1pb.QueryHistory], error) {- user, ok := GetUserFromContext(ctx)- if !ok {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))- }-- projectID, historyID, err := common.GetProjectIDQueryHistoryID(req.Msg.Name)- if err != nil {- return nil, connect.NewError(connect.CodeInvalidArgument, err)- }-- history, err := s.store.GetQueryHistory(ctx, historyID)- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get query history: %v", err.Error()))- }- // Hide existence from non-creators and project mismatches by returning the- // same not-found error for all three cases.- if history == nil || history.Project != projectID || history.Creator != user.Email {- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("query history %q not found", req.Msg.Name))- }-- queryHistory, err := s.convertToV1QueryHistory(ctx, history)- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert query history"))- }- return connect.NewResponse(queryHistory), nil+ return s.queryHistoryService.GetQueryHistory(ctx, req)}// The Build*Func parser-context helpers moved todiff --git a/backend/api/v1/sql_service_converter.go b/backend/api/v1/sql_service_converter.goindex 4debc7dad1..cd661ce144 100644--- a/backend/api/v1/sql_service_converter.go+++ b/backend/api/v1/sql_service_converter.go@@ -1,16 +1,8 @@package v1import (- "context"- "fmt"-- "github.com/pkg/errors"- "google.golang.org/protobuf/types/known/timestamppb"-- "github.com/bytebase/bytebase/backend/common"storepb "github.com/bytebase/bytebase/backend/generated-go/store"v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"- "github.com/bytebase/bytebase/backend/store")func convertToV1Advice(advice *storepb.Advice) *v1pb.Advice {@@ -36,33 +28,3 @@ func convertAdviceStatus(status storepb.Advice_Status) v1pb.Advice_Level {return v1pb.Advice_ADVICE_LEVEL_UNSPECIFIED}}--func (s *SQLService) convertToV1QueryHistory(ctx context.Context, history *store.QueryHistoryMessage) (*v1pb.QueryHistory, error) {- creator, err := s.store.GetAccountByEmail(ctx, history.Creator)- if err != nil {- return nil, err- }- if creator == nil {- return nil, errors.Errorf("cannot found user with email %s", history.Creator)- }-- historyType := v1pb.QueryHistory_TYPE_UNSPECIFIED- switch history.Type {- case store.QueryHistoryTypeExport:- historyType = v1pb.QueryHistory_EXPORT- case store.QueryHistoryTypeQuery:- historyType = v1pb.QueryHistory_QUERY- default:- }-- return &v1pb.QueryHistory{- Name: fmt.Sprintf("%s/queryHistories/%s", common.FormatProject(history.Project), history.ResourceID),- Statement: history.Statement,- Error: history.Payload.Error,- Database: history.Database,- Creator: common.FormatUserEmail(creator.Email),- CreateTime: timestamppb.New(history.CreatedAt),- Duration: history.Payload.Duration,- Type: historyType,- }, nil-}diff --git a/backend/generated-go/v1/query_history_service.pb.go b/backend/generated-go/v1/query_history_service.pb.gonew file mode 100644index 0000000000..3ed395888f--- /dev/null+++ b/backend/generated-go/v1/query_history_service.pb.go@@ -0,0 +1,641 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.36.11+// protoc (unknown)+// source: v1/query_history_service.proto++package v1++import (+ _ "google.golang.org/genproto/googleapis/api/annotations"+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ durationpb "google.golang.org/protobuf/types/known/durationpb"+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"+ reflect "reflect"+ sync "sync"+ unsafe "unsafe"+)++const (+ // Verify that this generated code is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)+ // Verify that runtime/protoimpl is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)+)++type QueryHistory_Type int32++const (+ // Unspecified query history type.+ QueryHistory_TYPE_UNSPECIFIED QueryHistory_Type = 0+ // Query execution for data retrieval.+ QueryHistory_QUERY QueryHistory_Type = 1+ // Data export operation to file.+ QueryHistory_EXPORT QueryHistory_Type = 2+)++// Enum value maps for QueryHistory_Type.+var (+ QueryHistory_Type_name = map[int32]string{+ 0: "TYPE_UNSPECIFIED",+ 1: "QUERY",+ 2: "EXPORT",+ }+ QueryHistory_Type_value = map[string]int32{+ "TYPE_UNSPECIFIED": 0,+ "QUERY": 1,+ "EXPORT": 2,+ }+)++func (x QueryHistory_Type) Enum() *QueryHistory_Type {+ p := new(QueryHistory_Type)+ *p = x+ return p+}++func (x QueryHistory_Type) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (QueryHistory_Type) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_query_history_service_proto_enumTypes[0].Descriptor()+}++func (QueryHistory_Type) Type() protoreflect.EnumType {+ return &file_v1_query_history_service_proto_enumTypes[0]+}++func (x QueryHistory_Type) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use QueryHistory_Type.Descriptor instead.+func (QueryHistory_Type) EnumDescriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{5, 0}+}++type SearchQueryHistoriesRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The parent project to search query histories in.+ // Format: projects/{project}+ // The AIP-159 wildcard "projects/-" is not supported; use+ // ListQueryHistories for cross-project reads.+ Parent string `protobuf:"bytes,4,opt,name=parent,proto3" json:"parent,omitempty"`+ // The maximum number of histories to return.+ // The service may return fewer than this value.+ // If unspecified, at most 10 history entries will be returned.+ // The maximum value is 1000; values above 1000 will be coerced to 1000.+ PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`+ // A page token, received from a previous `ListQueryHistory` call.+ // Provide this to retrieve the subsequent page.+ PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`+ // Filter is the filter to apply on the search query history+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+ //+ // Supported filter:+ // - project: the project full name in "projects/{id}" format, support "==" operator.+ // - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.+ // - instance: the instance full name in "instances/{id}" format, support "==" operator.+ // - type: the type, should be "QUERY" or "EXPORT", support "==" operator.+ // - statement: the SQL statement, support ".contains()" operator.+ //+ // For example:+ // project == "projects/{project}"+ // database == "instances/{instance}/databases/{database}"+ // instance == "instances/{instance}"+ // type == "QUERY"+ // type == "EXPORT"+ // statement.contains("select")+ // type == "QUERY" && statement.contains("select")+ Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *SearchQueryHistoriesRequest) Reset() {+ *x = SearchQueryHistoriesRequest{}+ mi := &file_v1_query_history_service_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *SearchQueryHistoriesRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SearchQueryHistoriesRequest) ProtoMessage() {}++func (x *SearchQueryHistoriesRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_query_history_service_proto_msgTypes[0]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SearchQueryHistoriesRequest.ProtoReflect.Descriptor instead.+func (*SearchQueryHistoriesRequest) Descriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{0}+}++func (x *SearchQueryHistoriesRequest) GetParent() string {+ if x != nil {+ return x.Parent+ }+ return ""+}++func (x *SearchQueryHistoriesRequest) GetPageSize() int32 {+ if x != nil {+ return x.PageSize+ }+ return 0+}++func (x *SearchQueryHistoriesRequest) GetPageToken() string {+ if x != nil {+ return x.PageToken+ }+ return ""+}++func (x *SearchQueryHistoriesRequest) GetFilter() string {+ if x != nil {+ return x.Filter+ }+ return ""+}++type SearchQueryHistoriesResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The list of history.+ QueryHistories []*QueryHistory `protobuf:"bytes,1,rep,name=query_histories,json=queryHistories,proto3" json:"query_histories,omitempty"`+ // A token to retrieve next page of history.+ // Pass this value in the page_token field in the subsequent call to+ // `ListQueryHistory` method to retrieve the next page of history.+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *SearchQueryHistoriesResponse) Reset() {+ *x = SearchQueryHistoriesResponse{}+ mi := &file_v1_query_history_service_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *SearchQueryHistoriesResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SearchQueryHistoriesResponse) ProtoMessage() {}++func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {+ mi := &file_v1_query_history_service_proto_msgTypes[1]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SearchQueryHistoriesResponse.ProtoReflect.Descriptor instead.+func (*SearchQueryHistoriesResponse) Descriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{1}+}++func (x *SearchQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {+ if x != nil {+ return x.QueryHistories+ }+ return nil+}++func (x *SearchQueryHistoriesResponse) GetNextPageToken() string {+ if x != nil {+ return x.NextPageToken+ }+ return ""+}++type ListQueryHistoriesRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The parent project whose query histories are listed.+ // Format: projects/{project}+ // Use "projects/-" to list query histories across all projects+ // (https://google.aip.dev/159); this requires the bb.queryHistories.list+ // permission on the workspace.+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`+ // The maximum number of histories to return.+ // The service may return fewer than this value.+ // If unspecified, at most 10 history entries will be returned.+ // The maximum value is 1000; values above 1000 will be coerced to 1000.+ PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`+ // A page token, received from a previous `ListQueryHistories` call.+ // Provide this to retrieve the subsequent page.+ PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`+ // Filter is the filter to apply on the list query histories.+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+ //+ // Supported filter:+ // - creator: the user full name in "users/{email}" format, support "==" operator.+ //+ // For example:+ // creator == "users/{email}"+ Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ListQueryHistoriesRequest) Reset() {+ *x = ListQueryHistoriesRequest{}+ mi := &file_v1_query_history_service_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ListQueryHistoriesRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ListQueryHistoriesRequest) ProtoMessage() {}++func (x *ListQueryHistoriesRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_query_history_service_proto_msgTypes[2]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ListQueryHistoriesRequest.ProtoReflect.Descriptor instead.+func (*ListQueryHistoriesRequest) Descriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{2}+}++func (x *ListQueryHistoriesRequest) GetParent() string {+ if x != nil {+ return x.Parent+ }+ return ""+}++func (x *ListQueryHistoriesRequest) GetPageSize() int32 {+ if x != nil {+ return x.PageSize+ }+ return 0+}++func (x *ListQueryHistoriesRequest) GetPageToken() string {+ if x != nil {+ return x.PageToken+ }+ return ""+}++func (x *ListQueryHistoriesRequest) GetFilter() string {+ if x != nil {+ return x.Filter+ }+ return ""+}++type ListQueryHistoriesResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The list of query histories.+ QueryHistories []*QueryHistory `protobuf:"bytes,1,rep,name=query_histories,json=queryHistories,proto3" json:"query_histories,omitempty"`+ // A token to retrieve next page of history.+ // Pass this value in the page_token field in the subsequent call to+ // `ListQueryHistories` method to retrieve the next page of history.+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ListQueryHistoriesResponse) Reset() {+ *x = ListQueryHistoriesResponse{}+ mi := &file_v1_query_history_service_proto_msgTypes[3]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ListQueryHistoriesResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ListQueryHistoriesResponse) ProtoMessage() {}++func (x *ListQueryHistoriesResponse) ProtoReflect() protoreflect.Message {+ mi := &file_v1_query_history_service_proto_msgTypes[3]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ListQueryHistoriesResponse.ProtoReflect.Descriptor instead.+func (*ListQueryHistoriesResponse) Descriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{3}+}++func (x *ListQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {+ if x != nil {+ return x.QueryHistories+ }+ return nil+}++func (x *ListQueryHistoriesResponse) GetNextPageToken() string {+ if x != nil {+ return x.NextPageToken+ }+ return ""+}++type GetQueryHistoryRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The name of the query history to retrieve.+ // Format: projects/{project}/queryHistories/{id}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *GetQueryHistoryRequest) Reset() {+ *x = GetQueryHistoryRequest{}+ mi := &file_v1_query_history_service_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *GetQueryHistoryRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*GetQueryHistoryRequest) ProtoMessage() {}++func (x *GetQueryHistoryRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_query_history_service_proto_msgTypes[4]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use GetQueryHistoryRequest.ProtoReflect.Descriptor instead.+func (*GetQueryHistoryRequest) Descriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{4}+}++func (x *GetQueryHistoryRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++type QueryHistory struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The name for the query history.+ // Format: projects/{project}/queryHistories/{id}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ // The database name to execute the query.+ // Format: instances/{instance}/databases/{databaseName}+ Database string `protobuf:"bytes,2,opt,name=database,proto3" json:"database,omitempty"`+ Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"`+ CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`+ Statement string `protobuf:"bytes,5,opt,name=statement,proto3" json:"statement,omitempty"`+ Error *string `protobuf:"bytes,6,opt,name=error,proto3,oneof" json:"error,omitempty"`+ Duration *durationpb.Duration `protobuf:"bytes,7,opt,name=duration,proto3" json:"duration,omitempty"`+ Type QueryHistory_Type `protobuf:"varint,8,opt,name=type,proto3,enum=bytebase.v1.QueryHistory_Type" json:"type,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *QueryHistory) Reset() {+ *x = QueryHistory{}+ mi := &file_v1_query_history_service_proto_msgTypes[5]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *QueryHistory) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*QueryHistory) ProtoMessage() {}++func (x *QueryHistory) ProtoReflect() protoreflect.Message {+ mi := &file_v1_query_history_service_proto_msgTypes[5]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use QueryHistory.ProtoReflect.Descriptor instead.+func (*QueryHistory) Descriptor() ([]byte, []int) {+ return file_v1_query_history_service_proto_rawDescGZIP(), []int{5}+}++func (x *QueryHistory) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *QueryHistory) GetDatabase() string {+ if x != nil {+ return x.Database+ }+ return ""+}++func (x *QueryHistory) GetCreator() string {+ if x != nil {+ return x.Creator+ }+ return ""+}++func (x *QueryHistory) GetCreateTime() *timestamppb.Timestamp {+ if x != nil {+ return x.CreateTime+ }+ return nil+}++func (x *QueryHistory) GetStatement() string {+ if x != nil {+ return x.Statement+ }+ return ""+}++func (x *QueryHistory) GetError() string {+ if x != nil && x.Error != nil {+ return *x.Error+ }+ return ""+}++func (x *QueryHistory) GetDuration() *durationpb.Duration {+ if x != nil {+ return x.Duration+ }+ return nil+}++func (x *QueryHistory) GetType() QueryHistory_Type {+ if x != nil {+ return x.Type+ }+ return QueryHistory_TYPE_UNSPECIFIED+}++var File_v1_query_history_service_proto protoreflect.FileDescriptor++const file_v1_query_history_service_proto_rawDesc = "" ++ "\n" ++ "\x1ev1/query_history_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"\x8e\x01\n" ++ "\x1bSearchQueryHistoriesRequest\x12\x1b\n" ++ "\x06parent\x18\x04 \x01(\tB\x03\xe0A\x02R\x06parent\x12\x1b\n" ++ "\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" ++ "\n" ++ "page_token\x18\x02 \x01(\tR\tpageToken\x12\x16\n" ++ "\x06filter\x18\x03 \x01(\tR\x06filter\"\x8f\x01\n" ++ "\x1cSearchQueryHistoriesResponse\x12G\n" ++ "\x0fquery_histories\x18\x01 \x03(\v2\x19.bytebase.v1.QueryHistoryB\x03\xe0A\x03R\x0equeryHistories\x12&\n" ++ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xa5\x01\n" ++ "\x19ListQueryHistoriesRequest\x124\n" ++ "\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" ++ "\x14bytebase.com/ProjectR\x06parent\x12\x1b\n" ++ "\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x1d\n" ++ "\n" ++ "page_token\x18\x03 \x01(\tR\tpageToken\x12\x16\n" ++ "\x06filter\x18\x04 \x01(\tR\x06filter\"\x8d\x01\n" ++ "\x1aListQueryHistoriesResponse\x12G\n" ++ "\x0fquery_histories\x18\x01 \x03(\v2\x19.bytebase.v1.QueryHistoryB\x03\xe0A\x03R\x0equeryHistories\x12&\n" ++ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"1\n" ++ "\x16GetQueryHistoryRequest\x12\x17\n" ++ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"\x9b\x03\n" ++ "\fQueryHistory\x12\x17\n" ++ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x03R\x04name\x12\x1f\n" ++ "\bdatabase\x18\x02 \x01(\tB\x03\xe0A\x03R\bdatabase\x12\x1d\n" ++ "\acreator\x18\x03 \x01(\tB\x03\xe0A\x03R\acreator\x12@\n" ++ "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" ++ "createTime\x12!\n" ++ "\tstatement\x18\x05 \x01(\tB\x03\xe0A\x03R\tstatement\x12\x1e\n" ++ "\x05error\x18\x06 \x01(\tB\x03\xe0A\x03H\x00R\x05error\x88\x01\x01\x12:\n" ++ "\bduration\x18\a \x01(\v2\x19.google.protobuf.DurationB\x03\xe0A\x03R\bduration\x122\n" ++ "\x04type\x18\b \x01(\x0e2\x1e.bytebase.v1.QueryHistory.TypeR\x04type\"3\n" ++ "\x04Type\x12\x14\n" ++ "\x10TYPE_UNSPECIFIED\x10\x00\x12\t\n" ++ "\x05QUERY\x10\x01\x12\n" ++ "\n" ++ "\x06EXPORT\x10\x02B\b\n" ++ "\x06_error2\x91\x04\n" ++ "\x13QueryHistoryService\x12\xb2\x01\n" ++ "\x14SearchQueryHistories\x12(.bytebase.v1.SearchQueryHistoriesRequest\x1a).bytebase.v1.SearchQueryHistoriesResponse\"E\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x022:\x01*\"-/v1/{parent=projects/*}/queryHistories:search\x12\xbc\x01\n" ++ "\x12ListQueryHistories\x12&.bytebase.v1.ListQueryHistoriesRequest\x1a'.bytebase.v1.ListQueryHistoriesResponse\"U\xdaA\x06parent\x8a\xea0\x16bb.queryHistories.list\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=projects/*}/queryHistories\x12\x85\x01\n" ++ "\x0fGetQueryHistory\x12#.bytebase.v1.GetQueryHistoryRequest\x1a\x19.bytebase.v1.QueryHistory\"2\x90\xea0\x02\x82\xd3\xe4\x93\x02(\x12&/v1/{name=projects/*/queryHistories/*}B\xae\x01\n" ++ "\x0fcom.bytebase.v1B\x18QueryHistoryServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"++var (+ file_v1_query_history_service_proto_rawDescOnce sync.Once+ file_v1_query_history_service_proto_rawDescData []byte+)++func file_v1_query_history_service_proto_rawDescGZIP() []byte {+ file_v1_query_history_service_proto_rawDescOnce.Do(func() {+ file_v1_query_history_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_v1_query_history_service_proto_rawDesc), len(file_v1_query_history_service_proto_rawDesc)))+ })+ return file_v1_query_history_service_proto_rawDescData+}++var file_v1_query_history_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_v1_query_history_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)+var file_v1_query_history_service_proto_goTypes = []any{+ (QueryHistory_Type)(0), // 0: bytebase.v1.QueryHistory.Type+ (*SearchQueryHistoriesRequest)(nil), // 1: bytebase.v1.SearchQueryHistoriesRequest+ (*SearchQueryHistoriesResponse)(nil), // 2: bytebase.v1.SearchQueryHistoriesResponse+ (*ListQueryHistoriesRequest)(nil), // 3: bytebase.v1.ListQueryHistoriesRequest+ (*ListQueryHistoriesResponse)(nil), // 4: bytebase.v1.ListQueryHistoriesResponse+ (*GetQueryHistoryRequest)(nil), // 5: bytebase.v1.GetQueryHistoryRequest+ (*QueryHistory)(nil), // 6: bytebase.v1.QueryHistory+ (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp+ (*durationpb.Duration)(nil), // 8: google.protobuf.Duration+}+var file_v1_query_history_service_proto_depIdxs = []int32{+ 6, // 0: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory+ 6, // 1: bytebase.v1.ListQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory+ 7, // 2: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp+ 8, // 3: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration+ 0, // 4: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type+ 1, // 5: bytebase.v1.QueryHistoryService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest+ 3, // 6: bytebase.v1.QueryHistoryService.ListQueryHistories:input_type -> bytebase.v1.ListQueryHistoriesRequest+ 5, // 7: bytebase.v1.QueryHistoryService.GetQueryHistory:input_type -> bytebase.v1.GetQueryHistoryRequest+ 2, // 8: bytebase.v1.QueryHistoryService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse+ 4, // 9: bytebase.v1.QueryHistoryService.ListQueryHistories:output_type -> bytebase.v1.ListQueryHistoriesResponse+ 6, // 10: bytebase.v1.QueryHistoryService.GetQueryHistory:output_type -> bytebase.v1.QueryHistory+ 8, // [8:11] is the sub-list for method output_type+ 5, // [5:8] is the sub-list for method input_type+ 5, // [5:5] is the sub-list for extension type_name+ 5, // [5:5] is the sub-list for extension extendee+ 0, // [0:5] is the sub-list for field type_name+}++func init() { file_v1_query_history_service_proto_init() }+func file_v1_query_history_service_proto_init() {+ if File_v1_query_history_service_proto != nil {+ return+ }+ file_v1_annotation_proto_init()+ file_v1_query_history_service_proto_msgTypes[5].OneofWrappers = []any{}+ type x struct{}+ out := protoimpl.TypeBuilder{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_query_history_service_proto_rawDesc), len(file_v1_query_history_service_proto_rawDesc)),+ NumEnums: 1,+ NumMessages: 6,+ NumExtensions: 0,+ NumServices: 1,+ },+ GoTypes: file_v1_query_history_service_proto_goTypes,+ DependencyIndexes: file_v1_query_history_service_proto_depIdxs,+ EnumInfos: file_v1_query_history_service_proto_enumTypes,+ MessageInfos: file_v1_query_history_service_proto_msgTypes,+ }.Build()+ File_v1_query_history_service_proto = out.File+ file_v1_query_history_service_proto_goTypes = nil+ file_v1_query_history_service_proto_depIdxs = nil+}diff --git a/backend/generated-go/v1/query_history_service.pb.gw.go b/backend/generated-go/v1/query_history_service.pb.gw.gonew file mode 100644index 0000000000..b66a1c8bb2--- /dev/null+++ b/backend/generated-go/v1/query_history_service.pb.gw.go@@ -0,0 +1,345 @@+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.+// source: v1/query_history_service.proto++/*+Package v1 is a reverse proxy.++It translates gRPC into RESTful JSON APIs.+*/+package v1++import (+ "context"+ "errors"+ "io"+ "net/http"++ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"+ "google.golang.org/grpc"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/grpclog"+ "google.golang.org/grpc/metadata"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/proto"+)++// Suppress "imported and not used" errors+var (+ _ codes.Code+ _ io.Reader+ _ status.Status+ _ = errors.New+ _ = runtime.String+ _ = utilities.NewDoubleArray+ _ = metadata.Join+)++func request_QueryHistoryService_SearchQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, client QueryHistoryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq SearchQueryHistoriesRequest+ metadata runtime.ServerMetadata+ err error+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if req.Body != nil {+ _, _ = io.Copy(io.Discard, req.Body)+ }+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }+ msg, err := client.SearchQueryHistories(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_QueryHistoryService_SearchQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, server QueryHistoryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq SearchQueryHistoriesRequest+ metadata runtime.ServerMetadata+ err error+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }+ msg, err := server.SearchQueryHistories(ctx, &protoReq)+ return msg, metadata, err+}++var filter_QueryHistoryService_ListQueryHistories_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}++func request_QueryHistoryService_ListQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, client QueryHistoryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ListQueryHistoriesRequest+ metadata runtime.ServerMetadata+ err error+ )+ if req.Body != nil {+ _, _ = io.Copy(io.Discard, req.Body)+ }+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }+ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryHistoryService_ListQueryHistories_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := client.ListQueryHistories(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_QueryHistoryService_ListQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, server QueryHistoryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ListQueryHistoriesRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }+ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryHistoryService_ListQueryHistories_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := server.ListQueryHistories(ctx, &protoReq)+ return msg, metadata, err+}++func request_QueryHistoryService_GetQueryHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryHistoryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq GetQueryHistoryRequest+ metadata runtime.ServerMetadata+ err error+ )+ if req.Body != nil {+ _, _ = io.Copy(io.Discard, req.Body)+ }+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := client.GetQueryHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_QueryHistoryService_GetQueryHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryHistoryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq GetQueryHistoryRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := server.GetQueryHistory(ctx, &protoReq)+ return msg, metadata, err+}++// RegisterQueryHistoryServiceHandlerServer registers the http handlers for service QueryHistoryService to "mux".+// UnaryRPC :call QueryHistoryServiceServer directly.+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHistoryServiceHandlerFromEndpoint instead.+// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.+func RegisterQueryHistoryServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryHistoryServiceServer) error {+ mux.Handle(http.MethodPost, pattern_QueryHistoryService_SearchQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.QueryHistoryService/SearchQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories:search"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_QueryHistoryService_SearchQueryHistories_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_QueryHistoryService_SearchQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodGet, pattern_QueryHistoryService_ListQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.QueryHistoryService/ListQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_QueryHistoryService_ListQueryHistories_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_QueryHistoryService_ListQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodGet, pattern_QueryHistoryService_GetQueryHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.QueryHistoryService/GetQueryHistory", runtime.WithHTTPPathPattern("/v1/{name=projects/*/queryHistories/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_QueryHistoryService_GetQueryHistory_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_QueryHistoryService_GetQueryHistory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })++ return nil+}++// RegisterQueryHistoryServiceHandlerFromEndpoint is same as RegisterQueryHistoryServiceHandler but+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.+func RegisterQueryHistoryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {+ conn, err := grpc.NewClient(endpoint, opts...)+ if err != nil {+ return err+ }+ defer func() {+ if err != nil {+ if cerr := conn.Close(); cerr != nil {+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)+ }+ return+ }+ go func() {+ <-ctx.Done()+ if cerr := conn.Close(); cerr != nil {+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)+ }+ }()+ }()+ return RegisterQueryHistoryServiceHandler(ctx, mux, conn)+}++// RegisterQueryHistoryServiceHandler registers the http handlers for service QueryHistoryService to "mux".+// The handlers forward requests to the grpc endpoint over "conn".+func RegisterQueryHistoryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {+ return RegisterQueryHistoryServiceHandlerClient(ctx, mux, NewQueryHistoryServiceClient(conn))+}++// RegisterQueryHistoryServiceHandlerClient registers the http handlers for service QueryHistoryService+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryHistoryServiceClient".+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryHistoryServiceClient"+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in+// "QueryHistoryServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.+func RegisterQueryHistoryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryHistoryServiceClient) error {+ mux.Handle(http.MethodPost, pattern_QueryHistoryService_SearchQueryHistories_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.QueryHistoryService/SearchQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories:search"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_QueryHistoryService_SearchQueryHistories_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_QueryHistoryService_SearchQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodGet, pattern_QueryHistoryService_ListQueryHistories_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.QueryHistoryService/ListQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_QueryHistoryService_ListQueryHistories_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_QueryHistoryService_ListQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodGet, pattern_QueryHistoryService_GetQueryHistory_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.QueryHistoryService/GetQueryHistory", runtime.WithHTTPPathPattern("/v1/{name=projects/*/queryHistories/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_QueryHistoryService_GetQueryHistory_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_QueryHistoryService_GetQueryHistory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ return nil+}++var (+ pattern_QueryHistoryService_SearchQueryHistories_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "queryHistories"}, "search"))+ pattern_QueryHistoryService_ListQueryHistories_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "queryHistories"}, ""))+ pattern_QueryHistoryService_GetQueryHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "queryHistories", "name"}, ""))+)++var (+ forward_QueryHistoryService_SearchQueryHistories_0 = runtime.ForwardResponseMessage+ forward_QueryHistoryService_ListQueryHistories_0 = runtime.ForwardResponseMessage+ forward_QueryHistoryService_GetQueryHistory_0 = runtime.ForwardResponseMessage+)diff --git a/backend/generated-go/v1/query_history_service_equal.pb.go b/backend/generated-go/v1/query_history_service_equal.pb.gonew file mode 100644index 0000000000..53f9bf86eb--- /dev/null+++ b/backend/generated-go/v1/query_history_service_equal.pb.go@@ -0,0 +1,137 @@+// Code generated by protoc-gen-equal-go. DO NOT EDIT.+// source: v1/query_history_service.proto++package v1++func (x *SearchQueryHistoriesRequest) Equal(y *SearchQueryHistoriesRequest) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.Parent != y.Parent {+ return false+ }+ if x.PageSize != y.PageSize {+ return false+ }+ if x.PageToken != y.PageToken {+ return false+ }+ if x.Filter != y.Filter {+ return false+ }+ return true+}++func (x *SearchQueryHistoriesResponse) Equal(y *SearchQueryHistoriesResponse) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if len(x.QueryHistories) != len(y.QueryHistories) {+ return false+ }+ for i := 0; i < len(x.QueryHistories); i++ {+ if !x.QueryHistories[i].Equal(y.QueryHistories[i]) {+ return false+ }+ }+ if x.NextPageToken != y.NextPageToken {+ return false+ }+ return true+}++func (x *ListQueryHistoriesRequest) Equal(y *ListQueryHistoriesRequest) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.Parent != y.Parent {+ return false+ }+ if x.PageSize != y.PageSize {+ return false+ }+ if x.PageToken != y.PageToken {+ return false+ }+ if x.Filter != y.Filter {+ return false+ }+ return true+}++func (x *ListQueryHistoriesResponse) Equal(y *ListQueryHistoriesResponse) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if len(x.QueryHistories) != len(y.QueryHistories) {+ return false+ }+ for i := 0; i < len(x.QueryHistories); i++ {+ if !x.QueryHistories[i].Equal(y.QueryHistories[i]) {+ return false+ }+ }+ if x.NextPageToken != y.NextPageToken {+ return false+ }+ return true+}++func (x *GetQueryHistoryRequest) Equal(y *GetQueryHistoryRequest) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.Name != y.Name {+ return false+ }+ return true+}++func (x *QueryHistory) Equal(y *QueryHistory) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.Name != y.Name {+ return false+ }+ if x.Database != y.Database {+ return false+ }+ if x.Creator != y.Creator {+ return false+ }+ if p, q := x.CreateTime, y.CreateTime; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {+ return false+ }+ if x.Statement != y.Statement {+ return false+ }+ if p, q := x.Error, y.Error; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {+ return false+ }+ if p, q := x.Duration, y.Duration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {+ return false+ }+ if x.Type != y.Type {+ return false+ }+ return true+}diff --git a/backend/generated-go/v1/query_history_service_grpc.pb.go b/backend/generated-go/v1/query_history_service_grpc.pb.gonew file mode 100644index 0000000000..135617cc55--- /dev/null+++ b/backend/generated-go/v1/query_history_service_grpc.pb.go@@ -0,0 +1,213 @@+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.+// versions:+// - protoc-gen-go-grpc v1.6.2+// - protoc (unknown)+// source: v1/query_history_service.proto++package v1++import (+ context "context"+ grpc "google.golang.org/grpc"+ codes "google.golang.org/grpc/codes"+ status "google.golang.org/grpc/status"+)++// This is a compile-time assertion to ensure that this generated file+// is compatible with the grpc package it is being compiled against.+// Requires gRPC-Go v1.64.0 or later.+const _ = grpc.SupportPackageIsVersion9++const (+ QueryHistoryService_SearchQueryHistories_FullMethodName = "/bytebase.v1.QueryHistoryService/SearchQueryHistories"+ QueryHistoryService_ListQueryHistories_FullMethodName = "/bytebase.v1.QueryHistoryService/ListQueryHistories"+ QueryHistoryService_GetQueryHistory_FullMethodName = "/bytebase.v1.QueryHistoryService/GetQueryHistory"+)++// QueryHistoryServiceClient is the client API for QueryHistoryService service.+//+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.+//+// QueryHistoryService manages query history records of SQL Editor queries and exports.+type QueryHistoryServiceClient interface {+ // SearchQueryHistories searches query histories for the caller.+ // Permissions required: None (only returns caller's own query histories)+ SearchQueryHistories(ctx context.Context, in *SearchQueryHistoriesRequest, opts ...grpc.CallOption) (*SearchQueryHistoriesResponse, error)+ // ListQueryHistories lists query histories of all users in a project.+ // Permissions required: bb.queryHistories.list+ ListQueryHistories(ctx context.Context, in *ListQueryHistoriesRequest, opts ...grpc.CallOption) (*ListQueryHistoriesResponse, error)+ // GetQueryHistory gets a single query history for the caller.+ // Permissions required: None (only returns the caller's own query history)+ GetQueryHistory(ctx context.Context, in *GetQueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistory, error)+}++type queryHistoryServiceClient struct {+ cc grpc.ClientConnInterface+}++func NewQueryHistoryServiceClient(cc grpc.ClientConnInterface) QueryHistoryServiceClient {+ return &queryHistoryServiceClient{cc}+}++func (c *queryHistoryServiceClient) SearchQueryHistories(ctx context.Context, in *SearchQueryHistoriesRequest, opts ...grpc.CallOption) (*SearchQueryHistoriesResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(SearchQueryHistoriesResponse)+ err := c.cc.Invoke(ctx, QueryHistoryService_SearchQueryHistories_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *queryHistoryServiceClient) ListQueryHistories(ctx context.Context, in *ListQueryHistoriesRequest, opts ...grpc.CallOption) (*ListQueryHistoriesResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ListQueryHistoriesResponse)+ err := c.cc.Invoke(ctx, QueryHistoryService_ListQueryHistories_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *queryHistoryServiceClient) GetQueryHistory(ctx context.Context, in *GetQueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistory, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(QueryHistory)+ err := c.cc.Invoke(ctx, QueryHistoryService_GetQueryHistory_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++// QueryHistoryServiceServer is the server API for QueryHistoryService service.+// All implementations must embed UnimplementedQueryHistoryServiceServer+// for forward compatibility.+//+// QueryHistoryService manages query history records of SQL Editor queries and exports.+type QueryHistoryServiceServer interface {+ // SearchQueryHistories searches query histories for the caller.+ // Permissions required: None (only returns caller's own query histories)+ SearchQueryHistories(context.Context, *SearchQueryHistoriesRequest) (*SearchQueryHistoriesResponse, error)+ // ListQueryHistories lists query histories of all users in a project.+ // Permissions required: bb.queryHistories.list+ ListQueryHistories(context.Context, *ListQueryHistoriesRequest) (*ListQueryHistoriesResponse, error)+ // GetQueryHistory gets a single query history for the caller.+ // Permissions required: None (only returns the caller's own query history)+ GetQueryHistory(context.Context, *GetQueryHistoryRequest) (*QueryHistory, error)+ mustEmbedUnimplementedQueryHistoryServiceServer()+}++// UnimplementedQueryHistoryServiceServer must be embedded to have+// forward compatible implementations.+//+// NOTE: this should be embedded by value instead of pointer to avoid a nil+// pointer dereference when methods are called.+type UnimplementedQueryHistoryServiceServer struct{}++func (UnimplementedQueryHistoryServiceServer) SearchQueryHistories(context.Context, *SearchQueryHistoriesRequest) (*SearchQueryHistoriesResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method SearchQueryHistories not implemented")+}+func (UnimplementedQueryHistoryServiceServer) ListQueryHistories(context.Context, *ListQueryHistoriesRequest) (*ListQueryHistoriesResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method ListQueryHistories not implemented")+}+func (UnimplementedQueryHistoryServiceServer) GetQueryHistory(context.Context, *GetQueryHistoryRequest) (*QueryHistory, error) {+ return nil, status.Error(codes.Unimplemented, "method GetQueryHistory not implemented")+}+func (UnimplementedQueryHistoryServiceServer) mustEmbedUnimplementedQueryHistoryServiceServer() {}+func (UnimplementedQueryHistoryServiceServer) testEmbeddedByValue() {}++// UnsafeQueryHistoryServiceServer may be embedded to opt out of forward compatibility for this service.+// Use of this interface is not recommended, as added methods to QueryHistoryServiceServer will+// result in compilation errors.+type UnsafeQueryHistoryServiceServer interface {+ mustEmbedUnimplementedQueryHistoryServiceServer()+}++func RegisterQueryHistoryServiceServer(s grpc.ServiceRegistrar, srv QueryHistoryServiceServer) {+ // If the following call panics, it indicates UnimplementedQueryHistoryServiceServer was+ // embedded by pointer and is nil. This will cause panics if an+ // unimplemented method is ever invoked, so we test this at initialization+ // time to prevent it from happening at runtime later due to I/O.+ if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {+ t.testEmbeddedByValue()+ }+ s.RegisterService(&QueryHistoryService_ServiceDesc, srv)+}++func _QueryHistoryService_SearchQueryHistories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(SearchQueryHistoriesRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(QueryHistoryServiceServer).SearchQueryHistories(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: QueryHistoryService_SearchQueryHistories_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(QueryHistoryServiceServer).SearchQueryHistories(ctx, req.(*SearchQueryHistoriesRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _QueryHistoryService_ListQueryHistories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ListQueryHistoriesRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(QueryHistoryServiceServer).ListQueryHistories(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: QueryHistoryService_ListQueryHistories_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(QueryHistoryServiceServer).ListQueryHistories(ctx, req.(*ListQueryHistoriesRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _QueryHistoryService_GetQueryHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(GetQueryHistoryRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(QueryHistoryServiceServer).GetQueryHistory(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: QueryHistoryService_GetQueryHistory_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(QueryHistoryServiceServer).GetQueryHistory(ctx, req.(*GetQueryHistoryRequest))+ }+ return interceptor(ctx, in, info, handler)+}++// QueryHistoryService_ServiceDesc is the grpc.ServiceDesc for QueryHistoryService service.+// It's only intended for direct use with grpc.RegisterService,+// and not to be introspected or modified (even as a copy)+var QueryHistoryService_ServiceDesc = grpc.ServiceDesc{+ ServiceName: "bytebase.v1.QueryHistoryService",+ HandlerType: (*QueryHistoryServiceServer)(nil),+ Methods: []grpc.MethodDesc{+ {+ MethodName: "SearchQueryHistories",+ Handler: _QueryHistoryService_SearchQueryHistories_Handler,+ },+ {+ MethodName: "ListQueryHistories",+ Handler: _QueryHistoryService_ListQueryHistories_Handler,+ },+ {+ MethodName: "GetQueryHistory",+ Handler: _QueryHistoryService_GetQueryHistory_Handler,+ },+ },+ Streams: []grpc.StreamDesc{},+ Metadata: "v1/query_history_service.proto",+}diff --git a/backend/generated-go/v1/sql_service.pb.go b/backend/generated-go/v1/sql_service.pb.goindex cc3eca1a85..331ac3fe1d 100644--- a/backend/generated-go/v1/sql_service.pb.go+++ b/backend/generated-go/v1/sql_service.pb.go@@ -361,58 +361,6 @@ func (Advice_RuleType) EnumDescriptor() ([]byte, []int) {return file_v1_sql_service_proto_rawDescGZIP(), []int{9, 1}}-type QueryHistory_Type int32--const (- // Unspecified query history type.- QueryHistory_TYPE_UNSPECIFIED QueryHistory_Type = 0- // Query execution for data retrieval.- QueryHistory_QUERY QueryHistory_Type = 1- // Data export operation to file.- QueryHistory_EXPORT QueryHistory_Type = 2-)--// Enum value maps for QueryHistory_Type.-var (- QueryHistory_Type_name = map[int32]string{- 0: "TYPE_UNSPECIFIED",- 1: "QUERY",- 2: "EXPORT",- }- QueryHistory_Type_value = map[string]int32{- "TYPE_UNSPECIFIED": 0,- "QUERY": 1,- "EXPORT": 2,- }-)--func (x QueryHistory_Type) Enum() *QueryHistory_Type {- p := new(QueryHistory_Type)- *p = x- return p-}--func (x QueryHistory_Type) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (QueryHistory_Type) Descriptor() protoreflect.EnumDescriptor {- return file_v1_sql_service_proto_enumTypes[6].Descriptor()-}--func (QueryHistory_Type) Type() protoreflect.EnumType {- return &file_v1_sql_service_proto_enumTypes[6]-}--func (x QueryHistory_Type) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use QueryHistory_Type.Descriptor instead.-func (QueryHistory_Type) EnumDescriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{19, 0}-}-type AdminExecuteRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name is the instance name to execute the query against.@@ -1750,451 +1698,6 @@ func (x *DiffMetadataResponse) GetDiff() string {return ""}-type SearchQueryHistoriesRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The parent project to search query histories in.- // Format: projects/{project}- // The AIP-159 wildcard "projects/-" is not supported; use- // ListQueryHistories for cross-project reads.- Parent string `protobuf:"bytes,4,opt,name=parent,proto3" json:"parent,omitempty"`- // The maximum number of histories to return.- // The service may return fewer than this value.- // If unspecified, at most 10 history entries will be returned.- // The maximum value is 1000; values above 1000 will be coerced to 1000.- PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`- // A page token, received from a previous `ListQueryHistory` call.- // Provide this to retrieve the subsequent page.- PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`- // Filter is the filter to apply on the search query history- // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec- //- // Supported filter:- // - project: the project full name in "projects/{id}" format, support "==" operator.- // - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.- // - instance: the instance full name in "instances/{id}" format, support "==" operator.- // - type: the type, should be "QUERY" or "EXPORT", support "==" operator.- // - statement: the SQL statement, support ".contains()" operator.- //- // For example:- // project == "projects/{project}"- // database == "instances/{instance}/databases/{database}"- // instance == "instances/{instance}"- // type == "QUERY"- // type == "EXPORT"- // statement.contains("select")- // type == "QUERY" && statement.contains("select")- Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *SearchQueryHistoriesRequest) Reset() {- *x = SearchQueryHistoriesRequest{}- mi := &file_v1_sql_service_proto_msgTypes[14]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *SearchQueryHistoriesRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*SearchQueryHistoriesRequest) ProtoMessage() {}--func (x *SearchQueryHistoriesRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[14]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use SearchQueryHistoriesRequest.ProtoReflect.Descriptor instead.-func (*SearchQueryHistoriesRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{14}-}--func (x *SearchQueryHistoriesRequest) GetParent() string {- if x != nil {- return x.Parent- }- return ""-}--func (x *SearchQueryHistoriesRequest) GetPageSize() int32 {- if x != nil {- return x.PageSize- }- return 0-}--func (x *SearchQueryHistoriesRequest) GetPageToken() string {- if x != nil {- return x.PageToken- }- return ""-}--func (x *SearchQueryHistoriesRequest) GetFilter() string {- if x != nil {- return x.Filter- }- return ""-}--type ListQueryHistoriesRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The parent project whose query histories are listed.- // Format: projects/{project}- // Use "projects/-" to list query histories across all projects- // (https://google.aip.dev/159); this requires the bb.queryHistories.list- // permission on the workspace.- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`- // The maximum number of histories to return.- // The service may return fewer than this value.- // If unspecified, at most 10 history entries will be returned.- // The maximum value is 1000; values above 1000 will be coerced to 1000.- PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`- // A page token, received from a previous `ListQueryHistories` call.- // Provide this to retrieve the subsequent page.- PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`- // Filter is the filter to apply on the list query histories.- // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec- //- // Supported filter:- // - creator: the user full name in "users/{email}" format, support "==" operator.- //- // For example:- // creator == "users/{email}"- Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ListQueryHistoriesRequest) Reset() {- *x = ListQueryHistoriesRequest{}- mi := &file_v1_sql_service_proto_msgTypes[15]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ListQueryHistoriesRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ListQueryHistoriesRequest) ProtoMessage() {}--func (x *ListQueryHistoriesRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[15]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ListQueryHistoriesRequest.ProtoReflect.Descriptor instead.-func (*ListQueryHistoriesRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{15}-}--func (x *ListQueryHistoriesRequest) GetParent() string {- if x != nil {- return x.Parent- }- return ""-}--func (x *ListQueryHistoriesRequest) GetPageSize() int32 {- if x != nil {- return x.PageSize- }- return 0-}--func (x *ListQueryHistoriesRequest) GetPageToken() string {- if x != nil {- return x.PageToken- }- return ""-}--func (x *ListQueryHistoriesRequest) GetFilter() string {- if x != nil {- return x.Filter- }- return ""-}--type ListQueryHistoriesResponse struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The list of query histories.- QueryHistories []*QueryHistory `protobuf:"bytes,1,rep,name=query_histories,json=queryHistories,proto3" json:"query_histories,omitempty"`- // A token to retrieve next page of history.- // Pass this value in the page_token field in the subsequent call to- // `ListQueryHistories` method to retrieve the next page of history.- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ListQueryHistoriesResponse) Reset() {- *x = ListQueryHistoriesResponse{}- mi := &file_v1_sql_service_proto_msgTypes[16]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ListQueryHistoriesResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ListQueryHistoriesResponse) ProtoMessage() {}--func (x *ListQueryHistoriesResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[16]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ListQueryHistoriesResponse.ProtoReflect.Descriptor instead.-func (*ListQueryHistoriesResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{16}-}--func (x *ListQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {- if x != nil {- return x.QueryHistories- }- return nil-}--func (x *ListQueryHistoriesResponse) GetNextPageToken() string {- if x != nil {- return x.NextPageToken- }- return ""-}--type GetQueryHistoryRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The name of the query history to retrieve.- // Format: projects/{project}/queryHistories/{id}- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *GetQueryHistoryRequest) Reset() {- *x = GetQueryHistoryRequest{}- mi := &file_v1_sql_service_proto_msgTypes[17]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *GetQueryHistoryRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*GetQueryHistoryRequest) ProtoMessage() {}--func (x *GetQueryHistoryRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[17]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use GetQueryHistoryRequest.ProtoReflect.Descriptor instead.-func (*GetQueryHistoryRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{17}-}--func (x *GetQueryHistoryRequest) GetName() string {- if x != nil {- return x.Name- }- return ""-}--type SearchQueryHistoriesResponse struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The list of history.- QueryHistories []*QueryHistory `protobuf:"bytes,1,rep,name=query_histories,json=queryHistories,proto3" json:"query_histories,omitempty"`- // A token to retrieve next page of history.- // Pass this value in the page_token field in the subsequent call to- // `ListQueryHistory` method to retrieve the next page of history.- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *SearchQueryHistoriesResponse) Reset() {- *x = SearchQueryHistoriesResponse{}- mi := &file_v1_sql_service_proto_msgTypes[18]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *SearchQueryHistoriesResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*SearchQueryHistoriesResponse) ProtoMessage() {}--func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[18]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use SearchQueryHistoriesResponse.ProtoReflect.Descriptor instead.-func (*SearchQueryHistoriesResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{18}-}--func (x *SearchQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {- if x != nil {- return x.QueryHistories- }- return nil-}--func (x *SearchQueryHistoriesResponse) GetNextPageToken() string {- if x != nil {- return x.NextPageToken- }- return ""-}--type QueryHistory struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The name for the query history.- // Format: projects/{project}/queryHistories/{id}- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- // The database name to execute the query.- // Format: instances/{instance}/databases/{databaseName}- Database string `protobuf:"bytes,2,opt,name=database,proto3" json:"database,omitempty"`- Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"`- CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`- Statement string `protobuf:"bytes,5,opt,name=statement,proto3" json:"statement,omitempty"`- Error *string `protobuf:"bytes,6,opt,name=error,proto3,oneof" json:"error,omitempty"`- Duration *durationpb.Duration `protobuf:"bytes,7,opt,name=duration,proto3" json:"duration,omitempty"`- Type QueryHistory_Type `protobuf:"varint,8,opt,name=type,proto3,enum=bytebase.v1.QueryHistory_Type" json:"type,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *QueryHistory) Reset() {- *x = QueryHistory{}- mi := &file_v1_sql_service_proto_msgTypes[19]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *QueryHistory) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*QueryHistory) ProtoMessage() {}--func (x *QueryHistory) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[19]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use QueryHistory.ProtoReflect.Descriptor instead.-func (*QueryHistory) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{19}-}--func (x *QueryHistory) GetName() string {- if x != nil {- return x.Name- }- return ""-}--func (x *QueryHistory) GetDatabase() string {- if x != nil {- return x.Database- }- return ""-}--func (x *QueryHistory) GetCreator() string {- if x != nil {- return x.Creator- }- return ""-}--func (x *QueryHistory) GetCreateTime() *timestamppb.Timestamp {- if x != nil {- return x.CreateTime- }- return nil-}--func (x *QueryHistory) GetStatement() string {- if x != nil {- return x.Statement- }- return ""-}--func (x *QueryHistory) GetError() string {- if x != nil && x.Error != nil {- return *x.Error- }- return ""-}--func (x *QueryHistory) GetDuration() *durationpb.Duration {- if x != nil {- return x.Duration- }- return nil-}--func (x *QueryHistory) GetType() QueryHistory_Type {- if x != nil {- return x.Type- }- return QueryHistory_TYPE_UNSPECIFIED-}-type AICompletionRequest struct {state protoimpl.MessageState `protogen:"open.v1"`Messages []*AICompletionRequest_Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`@@ -2204,7 +1707,7 @@ type AICompletionRequest struct {func (x *AICompletionRequest) Reset() {*x = AICompletionRequest{}- mi := &file_v1_sql_service_proto_msgTypes[20]+ mi := &file_v1_sql_service_proto_msgTypes[14]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2216,7 +1719,7 @@ func (x *AICompletionRequest) String() string {func (*AICompletionRequest) ProtoMessage() {}func (x *AICompletionRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[20]+ mi := &file_v1_sql_service_proto_msgTypes[14]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2229,7 +1732,7 @@ func (x *AICompletionRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use AICompletionRequest.ProtoReflect.Descriptor instead.func (*AICompletionRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{20}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{14}}func (x *AICompletionRequest) GetMessages() []*AICompletionRequest_Message {@@ -2250,7 +1753,7 @@ type AICompletionResponse struct {func (x *AICompletionResponse) Reset() {*x = AICompletionResponse{}- mi := &file_v1_sql_service_proto_msgTypes[21]+ mi := &file_v1_sql_service_proto_msgTypes[15]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2262,7 +1765,7 @@ func (x *AICompletionResponse) String() string {func (*AICompletionResponse) ProtoMessage() {}func (x *AICompletionResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[21]+ mi := &file_v1_sql_service_proto_msgTypes[15]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2275,7 +1778,7 @@ func (x *AICompletionResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use AICompletionResponse.ProtoReflect.Descriptor instead.func (*AICompletionResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{21}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{15}}func (x *AICompletionResponse) GetCandidates() []*AICompletionResponse_Candidate {@@ -2312,7 +1815,7 @@ type QueryResult_PostgresError struct {func (x *QueryResult_PostgresError) Reset() {*x = QueryResult_PostgresError{}- mi := &file_v1_sql_service_proto_msgTypes[22]+ mi := &file_v1_sql_service_proto_msgTypes[16]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2324,7 +1827,7 @@ func (x *QueryResult_PostgresError) String() string {func (*QueryResult_PostgresError) ProtoMessage() {}func (x *QueryResult_PostgresError) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[22]+ mi := &file_v1_sql_service_proto_msgTypes[16]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2470,7 +1973,7 @@ type QueryResult_SyntaxError struct {func (x *QueryResult_SyntaxError) Reset() {*x = QueryResult_SyntaxError{}- mi := &file_v1_sql_service_proto_msgTypes[23]+ mi := &file_v1_sql_service_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2482,7 +1985,7 @@ func (x *QueryResult_SyntaxError) String() string {func (*QueryResult_SyntaxError) ProtoMessage() {}func (x *QueryResult_SyntaxError) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[23]+ mi := &file_v1_sql_service_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2517,7 +2020,7 @@ type QueryResult_CommandError struct {func (x *QueryResult_CommandError) Reset() {*x = QueryResult_CommandError{}- mi := &file_v1_sql_service_proto_msgTypes[24]+ mi := &file_v1_sql_service_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2529,7 +2032,7 @@ func (x *QueryResult_CommandError) String() string {func (*QueryResult_CommandError) ProtoMessage() {}func (x *QueryResult_CommandError) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[24]+ mi := &file_v1_sql_service_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2562,7 +2065,7 @@ type QueryResult_Message struct {func (x *QueryResult_Message) Reset() {*x = QueryResult_Message{}- mi := &file_v1_sql_service_proto_msgTypes[25]+ mi := &file_v1_sql_service_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2574,7 +2077,7 @@ func (x *QueryResult_Message) String() string {func (*QueryResult_Message) ProtoMessage() {}func (x *QueryResult_Message) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[25]+ mi := &file_v1_sql_service_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2615,7 +2118,7 @@ type RowValue_Timestamp struct {func (x *RowValue_Timestamp) Reset() {*x = RowValue_Timestamp{}- mi := &file_v1_sql_service_proto_msgTypes[26]+ mi := &file_v1_sql_service_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2627,7 +2130,7 @@ func (x *RowValue_Timestamp) String() string {func (*RowValue_Timestamp) ProtoMessage() {}func (x *RowValue_Timestamp) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[26]+ mi := &file_v1_sql_service_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2676,7 +2179,7 @@ type RowValue_TimestampTZ struct {func (x *RowValue_TimestampTZ) Reset() {*x = RowValue_TimestampTZ{}- mi := &file_v1_sql_service_proto_msgTypes[27]+ mi := &file_v1_sql_service_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2688,7 +2191,7 @@ func (x *RowValue_TimestampTZ) String() string {func (*RowValue_TimestampTZ) ProtoMessage() {}func (x *RowValue_TimestampTZ) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[27]+ mi := &file_v1_sql_service_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2742,7 +2245,7 @@ type AICompletionRequest_Message struct {func (x *AICompletionRequest_Message) Reset() {*x = AICompletionRequest_Message{}- mi := &file_v1_sql_service_proto_msgTypes[28]+ mi := &file_v1_sql_service_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2754,7 +2257,7 @@ func (x *AICompletionRequest_Message) String() string {func (*AICompletionRequest_Message) ProtoMessage() {}func (x *AICompletionRequest_Message) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[28]+ mi := &file_v1_sql_service_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2767,7 +2270,7 @@ func (x *AICompletionRequest_Message) ProtoReflect() protoreflect.Message {// Deprecated: Use AICompletionRequest_Message.ProtoReflect.Descriptor instead.func (*AICompletionRequest_Message) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{20, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{14, 0}}func (x *AICompletionRequest_Message) GetRole() string {@@ -2793,7 +2296,7 @@ type AICompletionResponse_Candidate struct {func (x *AICompletionResponse_Candidate) Reset() {*x = AICompletionResponse_Candidate{}- mi := &file_v1_sql_service_proto_msgTypes[29]+ mi := &file_v1_sql_service_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2805,7 +2308,7 @@ func (x *AICompletionResponse_Candidate) String() string {func (*AICompletionResponse_Candidate) ProtoMessage() {}func (x *AICompletionResponse_Candidate) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[29]+ mi := &file_v1_sql_service_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2818,7 +2321,7 @@ func (x *AICompletionResponse_Candidate) ProtoReflect() protoreflect.Message {// Deprecated: Use AICompletionResponse_Candidate.ProtoReflect.Descriptor instead.func (*AICompletionResponse_Candidate) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{15, 0}}func (x *AICompletionResponse_Candidate) GetContent() *AICompletionResponse_Candidate_Content {@@ -2838,7 +2341,7 @@ type AICompletionResponse_Candidate_Content struct {func (x *AICompletionResponse_Candidate_Content) Reset() {*x = AICompletionResponse_Candidate_Content{}- mi := &file_v1_sql_service_proto_msgTypes[30]+ mi := &file_v1_sql_service_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2850,7 +2353,7 @@ func (x *AICompletionResponse_Candidate_Content) String() string {func (*AICompletionResponse_Candidate_Content) ProtoMessage() {}func (x *AICompletionResponse_Candidate_Content) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[30]+ mi := &file_v1_sql_service_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2863,7 +2366,7 @@ func (x *AICompletionResponse_Candidate_Content) ProtoReflect() protoreflect.Mes// Deprecated: Use AICompletionResponse_Candidate_Content.ProtoReflect.Descriptor instead.func (*AICompletionResponse_Candidate_Content) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{15, 0, 0}}func (x *AICompletionResponse_Candidate_Content) GetParts() []*AICompletionResponse_Candidate_Content_Part {@@ -2882,7 +2385,7 @@ type AICompletionResponse_Candidate_Content_Part struct {func (x *AICompletionResponse_Candidate_Content_Part) Reset() {*x = AICompletionResponse_Candidate_Content_Part{}- mi := &file_v1_sql_service_proto_msgTypes[31]+ mi := &file_v1_sql_service_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2894,7 +2397,7 @@ func (x *AICompletionResponse_Candidate_Content_Part) String() string {func (*AICompletionResponse_Candidate_Content_Part) ProtoMessage() {}func (x *AICompletionResponse_Candidate_Content_Part) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[31]+ mi := &file_v1_sql_service_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2907,7 +2410,7 @@ func (x *AICompletionResponse_Candidate_Content_Part) ProtoReflect() protoreflec// Deprecated: Use AICompletionResponse_Candidate_Content_Part.ProtoReflect.Descriptor instead.func (*AICompletionResponse_Candidate_Content_Part) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0, 0, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{15, 0, 0, 0}}func (x *AICompletionResponse_Candidate_Content_Part) GetText() string {@@ -2921,7 +2424,7 @@ var File_v1_sql_service_proto protoreflect.FileDescriptorconst file_v1_sql_service_proto_rawDesc = "" +"\n" +- "\x14v1/sql_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x19v1/database_service.proto\"\xd5\x01\n" ++ "\x14v1/sql_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x19v1/database_service.proto\x1a\x1ev1/query_history_service.proto\"\xd5\x01\n" +"\x13AdminExecuteRequest\x121\n" +"\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" +"\x15bytebase.com/DatabaseR\x04name\x12\x1c\n" +@@ -3099,44 +2602,7 @@ const file_v1_sql_service_proto_rawDesc = "" +"\x0ftarget_metadata\x18\x02 \x01(\v2\x1d.bytebase.v1.DatabaseMetadataB\x03\xe0A\x02R\x0etargetMetadata\x12+\n" +"\x06engine\x18\x03 \x01(\x0e2\x13.bytebase.v1.EngineR\x06engine\"*\n" +"\x14DiffMetadataResponse\x12\x12\n" +- "\x04diff\x18\x01 \x01(\tR\x04diff\"\x8e\x01\n" +- "\x1bSearchQueryHistoriesRequest\x12\x1b\n" +- "\x06parent\x18\x04 \x01(\tB\x03\xe0A\x02R\x06parent\x12\x1b\n" +- "\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" +- "\n" +- "page_token\x18\x02 \x01(\tR\tpageToken\x12\x16\n" +- "\x06filter\x18\x03 \x01(\tR\x06filter\"\xa5\x01\n" +- "\x19ListQueryHistoriesRequest\x124\n" +- "\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +- "\x14bytebase.com/ProjectR\x06parent\x12\x1b\n" +- "\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x1d\n" +- "\n" +- "page_token\x18\x03 \x01(\tR\tpageToken\x12\x16\n" +- "\x06filter\x18\x04 \x01(\tR\x06filter\"\x8d\x01\n" +- "\x1aListQueryHistoriesResponse\x12G\n" +- "\x0fquery_histories\x18\x01 \x03(\v2\x19.bytebase.v1.QueryHistoryB\x03\xe0A\x03R\x0equeryHistories\x12&\n" +- "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"1\n" +- "\x16GetQueryHistoryRequest\x12\x17\n" +- "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"\x8f\x01\n" +- "\x1cSearchQueryHistoriesResponse\x12G\n" +- "\x0fquery_histories\x18\x01 \x03(\v2\x19.bytebase.v1.QueryHistoryB\x03\xe0A\x03R\x0equeryHistories\x12&\n" +- "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x9b\x03\n" +- "\fQueryHistory\x12\x17\n" +- "\x04name\x18\x01 \x01(\tB\x03\xe0A\x03R\x04name\x12\x1f\n" +- "\bdatabase\x18\x02 \x01(\tB\x03\xe0A\x03R\bdatabase\x12\x1d\n" +- "\acreator\x18\x03 \x01(\tB\x03\xe0A\x03R\acreator\x12@\n" +- "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +- "createTime\x12!\n" +- "\tstatement\x18\x05 \x01(\tB\x03\xe0A\x03R\tstatement\x12\x1e\n" +- "\x05error\x18\x06 \x01(\tB\x03\xe0A\x03H\x00R\x05error\x88\x01\x01\x12:\n" +- "\bduration\x18\a \x01(\v2\x19.google.protobuf.DurationB\x03\xe0A\x03R\bduration\x122\n" +- "\x04type\x18\b \x01(\x0e2\x1e.bytebase.v1.QueryHistory.TypeR\x04type\"3\n" +- "\x04Type\x12\x14\n" +- "\x10TYPE_UNSPECIFIED\x10\x00\x12\t\n" +- "\x05QUERY\x10\x01\x12\n" +- "\n" +- "\x06EXPORT\x10\x02B\b\n" +- "\x06_error\"\x94\x01\n" ++ "\x04diff\x18\x01 \x01(\tR\x04diff\"\x94\x01\n" +"\x13AICompletionRequest\x12D\n" +"\bmessages\x18\x01 \x03(\v2(.bytebase.v1.AICompletionRequest.MessageR\bmessages\x1a7\n" +"\aMessage\x12\x12\n" +@@ -3151,15 +2617,14 @@ const file_v1_sql_service_proto_rawDesc = "" +"\aContent\x12N\n" +"\x05parts\x18\x01 \x03(\v28.bytebase.v1.AICompletionResponse.Candidate.Content.PartR\x05parts\x1a\x1a\n" +"\x04Part\x12\x12\n" +- "\x04text\x18\x01 \x01(\tR\x04text2\xab\n" +- "\n" ++ "\x04text\x18\x01 \x01(\tR\x04text2\x8c\t\n" +"\n" +"SQLService\x12\x8f\x01\n" +"\x05Query\x12\x19.bytebase.v1.QueryRequest\x1a\x1a.bytebase.v1.QueryResponse\"O\x8a\xea0\x10bb.databases.get\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02-:\x01*\"(/v1/{name=instances/*/databases/*}:query\x12\x89\x01\n" +- "\fAdminExecute\x12 .bytebase.v1.AdminExecuteRequest\x1a!.bytebase.v1.AdminExecuteResponse\"0\x8a\xea0\fbb.sql.admin\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x12\x12\x10/v1:adminExecute(\x010\x01\x12\xb2\x01\n" +- "\x14SearchQueryHistories\x12(.bytebase.v1.SearchQueryHistoriesRequest\x1a).bytebase.v1.SearchQueryHistoriesResponse\"E\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x022:\x01*\"-/v1/{parent=projects/*}/queryHistories:search\x12\xbc\x01\n" +- "\x12ListQueryHistories\x12&.bytebase.v1.ListQueryHistoriesRequest\x1a'.bytebase.v1.ListQueryHistoriesResponse\"U\xdaA\x06parent\x8a\xea0\x16bb.queryHistories.list\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=projects/*}/queryHistories\x12\x85\x01\n" +- "\x0fGetQueryHistory\x12#.bytebase.v1.GetQueryHistoryRequest\x1a\x19.bytebase.v1.QueryHistory\"2\x90\xea0\x02\x82\xd3\xe4\x93\x02(\x12&/v1/{name=projects/*/queryHistories/*}\x12\x84\x02\n" ++ "\fAdminExecute\x12 .bytebase.v1.AdminExecuteRequest\x1a!.bytebase.v1.AdminExecuteResponse\"0\x8a\xea0\fbb.sql.admin\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x12\x12\x10/v1:adminExecute(\x010\x01\x12t\n" ++ "\x14SearchQueryHistories\x12(.bytebase.v1.SearchQueryHistoriesRequest\x1a).bytebase.v1.SearchQueryHistoriesResponse\"\a\x90\xea0\x02\x88\x02\x01\x12\x88\x01\n" ++ "\x12ListQueryHistories\x12&.bytebase.v1.ListQueryHistoriesRequest\x1a'.bytebase.v1.ListQueryHistoriesResponse\"!\x8a\xea0\x16bb.queryHistories.list\x90\xea0\x01\x88\x02\x01\x12Z\n" ++ "\x0fGetQueryHistory\x12#.bytebase.v1.GetQueryHistoryRequest\x1a\x19.bytebase.v1.QueryHistory\"\a\x90\xea0\x02\x88\x02\x01\x12\x84\x02\n" +"\x06Export\x12\x1a.bytebase.v1.ExportRequest\x1a\x1b.bytebase.v1.ExportResponse\"\xc0\x01\x8a\xea0\x10bb.databases.get\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x9d\x01:\x01*Z1:\x01*\",/v1/{name=projects/*/plans/*/rollout}:exportZ::\x01*\"5/v1/{name=projects/*/plans/*/rollout/stages/*}:export\")/v1/{name=instances/*/databases/*}:export\x12\x81\x01\n" +"\fDiffMetadata\x12 .bytebase.v1.DiffMetadataRequest\x1a!.bytebase.v1.DiffMetadataResponse\",\x80\xea0\x01\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/schemaDesign:diffMetadata\x12x\n" +"\fAICompletion\x12 .bytebase.v1.AICompletionRequest\x1a!.bytebase.v1.AICompletionResponse\"#\x90\xea0\x02\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v1/sql/aiCompletionB\xa5\x01\n" +@@ -3177,8 +2642,8 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {return file_v1_sql_service_proto_rawDescData}-var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 7)-var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 32)+var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)+var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 26)var file_v1_sql_service_proto_goTypes = []any{(QueryOption_RedisRunCommandsOn)(0), // 0: bytebase.v1.QueryOption.RedisRunCommandsOn(QueryOption_MSSQLExplainFormat)(0), // 1: bytebase.v1.QueryOption.MSSQLExplainFormat@@ -3186,111 +2651,105 @@ var file_v1_sql_service_proto_goTypes = []any{(QueryResult_Message_Level)(0), // 3: bytebase.v1.QueryResult.Message.Level(Advice_Level)(0), // 4: bytebase.v1.Advice.Level(Advice_RuleType)(0), // 5: bytebase.v1.Advice.RuleType- (QueryHistory_Type)(0), // 6: bytebase.v1.QueryHistory.Type- (*AdminExecuteRequest)(nil), // 7: bytebase.v1.AdminExecuteRequest- (*AdminExecuteResponse)(nil), // 8: bytebase.v1.AdminExecuteResponse- (*QueryRequest)(nil), // 9: bytebase.v1.QueryRequest- (*QueryResponse)(nil), // 10: bytebase.v1.QueryResponse- (*QueryOption)(nil), // 11: bytebase.v1.QueryOption- (*QueryResult)(nil), // 12: bytebase.v1.QueryResult- (*MaskingReason)(nil), // 13: bytebase.v1.MaskingReason- (*QueryRow)(nil), // 14: bytebase.v1.QueryRow- (*RowValue)(nil), // 15: bytebase.v1.RowValue- (*Advice)(nil), // 16: bytebase.v1.Advice- (*ExportRequest)(nil), // 17: bytebase.v1.ExportRequest- (*ExportResponse)(nil), // 18: bytebase.v1.ExportResponse- (*DiffMetadataRequest)(nil), // 19: bytebase.v1.DiffMetadataRequest- (*DiffMetadataResponse)(nil), // 20: bytebase.v1.DiffMetadataResponse- (*SearchQueryHistoriesRequest)(nil), // 21: bytebase.v1.SearchQueryHistoriesRequest- (*ListQueryHistoriesRequest)(nil), // 22: bytebase.v1.ListQueryHistoriesRequest- (*ListQueryHistoriesResponse)(nil), // 23: bytebase.v1.ListQueryHistoriesResponse- (*GetQueryHistoryRequest)(nil), // 24: bytebase.v1.GetQueryHistoryRequest- (*SearchQueryHistoriesResponse)(nil), // 25: bytebase.v1.SearchQueryHistoriesResponse- (*QueryHistory)(nil), // 26: bytebase.v1.QueryHistory- (*AICompletionRequest)(nil), // 27: bytebase.v1.AICompletionRequest- (*AICompletionResponse)(nil), // 28: bytebase.v1.AICompletionResponse- (*QueryResult_PostgresError)(nil), // 29: bytebase.v1.QueryResult.PostgresError- (*QueryResult_SyntaxError)(nil), // 30: bytebase.v1.QueryResult.SyntaxError- (*QueryResult_CommandError)(nil), // 31: bytebase.v1.QueryResult.CommandError- (*QueryResult_Message)(nil), // 32: bytebase.v1.QueryResult.Message- (*RowValue_Timestamp)(nil), // 33: bytebase.v1.RowValue.Timestamp- (*RowValue_TimestampTZ)(nil), // 34: bytebase.v1.RowValue.TimestampTZ- (*AICompletionRequest_Message)(nil), // 35: bytebase.v1.AICompletionRequest.Message- (*AICompletionResponse_Candidate)(nil), // 36: bytebase.v1.AICompletionResponse.Candidate- (*AICompletionResponse_Candidate_Content)(nil), // 37: bytebase.v1.AICompletionResponse.Candidate.Content- (*AICompletionResponse_Candidate_Content_Part)(nil), // 38: bytebase.v1.AICompletionResponse.Candidate.Content.Part- (*durationpb.Duration)(nil), // 39: google.protobuf.Duration- (*PermissionDeniedDetail)(nil), // 40: bytebase.v1.PermissionDeniedDetail- (structpb.NullValue)(0), // 41: google.protobuf.NullValue- (*structpb.Value)(nil), // 42: google.protobuf.Value- (*Position)(nil), // 43: bytebase.v1.Position- (ExportFormat)(0), // 44: bytebase.v1.ExportFormat- (*DatabaseMetadata)(nil), // 45: bytebase.v1.DatabaseMetadata- (Engine)(0), // 46: bytebase.v1.Engine- (*timestamppb.Timestamp)(nil), // 47: google.protobuf.Timestamp+ (*AdminExecuteRequest)(nil), // 6: bytebase.v1.AdminExecuteRequest+ (*AdminExecuteResponse)(nil), // 7: bytebase.v1.AdminExecuteResponse+ (*QueryRequest)(nil), // 8: bytebase.v1.QueryRequest+ (*QueryResponse)(nil), // 9: bytebase.v1.QueryResponse+ (*QueryOption)(nil), // 10: bytebase.v1.QueryOption+ (*QueryResult)(nil), // 11: bytebase.v1.QueryResult+ (*MaskingReason)(nil), // 12: bytebase.v1.MaskingReason+ (*QueryRow)(nil), // 13: bytebase.v1.QueryRow+ (*RowValue)(nil), // 14: bytebase.v1.RowValue+ (*Advice)(nil), // 15: bytebase.v1.Advice+ (*ExportRequest)(nil), // 16: bytebase.v1.ExportRequest+ (*ExportResponse)(nil), // 17: bytebase.v1.ExportResponse+ (*DiffMetadataRequest)(nil), // 18: bytebase.v1.DiffMetadataRequest+ (*DiffMetadataResponse)(nil), // 19: bytebase.v1.DiffMetadataResponse+ (*AICompletionRequest)(nil), // 20: bytebase.v1.AICompletionRequest+ (*AICompletionResponse)(nil), // 21: bytebase.v1.AICompletionResponse+ (*QueryResult_PostgresError)(nil), // 22: bytebase.v1.QueryResult.PostgresError+ (*QueryResult_SyntaxError)(nil), // 23: bytebase.v1.QueryResult.SyntaxError+ (*QueryResult_CommandError)(nil), // 24: bytebase.v1.QueryResult.CommandError+ (*QueryResult_Message)(nil), // 25: bytebase.v1.QueryResult.Message+ (*RowValue_Timestamp)(nil), // 26: bytebase.v1.RowValue.Timestamp+ (*RowValue_TimestampTZ)(nil), // 27: bytebase.v1.RowValue.TimestampTZ+ (*AICompletionRequest_Message)(nil), // 28: bytebase.v1.AICompletionRequest.Message+ (*AICompletionResponse_Candidate)(nil), // 29: bytebase.v1.AICompletionResponse.Candidate+ (*AICompletionResponse_Candidate_Content)(nil), // 30: bytebase.v1.AICompletionResponse.Candidate.Content+ (*AICompletionResponse_Candidate_Content_Part)(nil), // 31: bytebase.v1.AICompletionResponse.Candidate.Content.Part+ (*durationpb.Duration)(nil), // 32: google.protobuf.Duration+ (*PermissionDeniedDetail)(nil), // 33: bytebase.v1.PermissionDeniedDetail+ (structpb.NullValue)(0), // 34: google.protobuf.NullValue+ (*structpb.Value)(nil), // 35: google.protobuf.Value+ (*Position)(nil), // 36: bytebase.v1.Position+ (ExportFormat)(0), // 37: bytebase.v1.ExportFormat+ (*DatabaseMetadata)(nil), // 38: bytebase.v1.DatabaseMetadata+ (Engine)(0), // 39: bytebase.v1.Engine+ (*timestamppb.Timestamp)(nil), // 40: google.protobuf.Timestamp+ (*SearchQueryHistoriesRequest)(nil), // 41: bytebase.v1.SearchQueryHistoriesRequest+ (*ListQueryHistoriesRequest)(nil), // 42: bytebase.v1.ListQueryHistoriesRequest+ (*GetQueryHistoryRequest)(nil), // 43: bytebase.v1.GetQueryHistoryRequest+ (*SearchQueryHistoriesResponse)(nil), // 44: bytebase.v1.SearchQueryHistoriesResponse+ (*ListQueryHistoriesResponse)(nil), // 45: bytebase.v1.ListQueryHistoriesResponse+ (*QueryHistory)(nil), // 46: bytebase.v1.QueryHistory}var file_v1_sql_service_proto_depIdxs = []int32{- 12, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult- 11, // 1: bytebase.v1.QueryRequest.query_option:type_name -> bytebase.v1.QueryOption- 12, // 2: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult+ 11, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult+ 10, // 1: bytebase.v1.QueryRequest.query_option:type_name -> bytebase.v1.QueryOption+ 11, // 2: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult0, // 3: bytebase.v1.QueryOption.redis_run_commands_on:type_name -> bytebase.v1.QueryOption.RedisRunCommandsOn1, // 4: bytebase.v1.QueryOption.mssql_explain_format:type_name -> bytebase.v1.QueryOption.MSSQLExplainFormat- 14, // 5: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow- 39, // 6: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration- 29, // 7: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError- 30, // 8: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError- 40, // 9: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.PermissionDeniedDetail- 31, // 10: bytebase.v1.QueryResult.command_error:type_name -> bytebase.v1.QueryResult.CommandError- 32, // 11: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message- 13, // 12: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason- 15, // 13: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue- 41, // 14: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue- 42, // 15: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value- 33, // 16: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp- 34, // 17: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ+ 13, // 5: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow+ 32, // 6: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration+ 22, // 7: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError+ 23, // 8: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError+ 33, // 9: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.PermissionDeniedDetail+ 24, // 10: bytebase.v1.QueryResult.command_error:type_name -> bytebase.v1.QueryResult.CommandError+ 25, // 11: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message+ 12, // 12: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason+ 14, // 13: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue+ 34, // 14: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue+ 35, // 15: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value+ 26, // 16: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp+ 27, // 17: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ4, // 18: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Level- 43, // 19: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position- 43, // 20: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position+ 36, // 19: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position+ 36, // 20: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position5, // 21: bytebase.v1.Advice.rule_type:type_name -> bytebase.v1.Advice.RuleType- 44, // 22: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat- 45, // 23: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata- 45, // 24: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata- 46, // 25: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine- 26, // 26: bytebase.v1.ListQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory- 26, // 27: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory- 47, // 28: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp- 39, // 29: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration- 6, // 30: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type- 35, // 31: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message- 36, // 32: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate- 43, // 33: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position- 2, // 34: bytebase.v1.QueryResult.CommandError.command_type:type_name -> bytebase.v1.QueryResult.CommandError.Type- 3, // 35: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level- 47, // 36: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp- 47, // 37: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp- 37, // 38: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content- 38, // 39: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part- 9, // 40: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest- 7, // 41: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest- 21, // 42: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest- 22, // 43: bytebase.v1.SQLService.ListQueryHistories:input_type -> bytebase.v1.ListQueryHistoriesRequest- 24, // 44: bytebase.v1.SQLService.GetQueryHistory:input_type -> bytebase.v1.GetQueryHistoryRequest- 17, // 45: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest- 19, // 46: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest- 27, // 47: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest- 10, // 48: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse- 8, // 49: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse- 25, // 50: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse- 23, // 51: bytebase.v1.SQLService.ListQueryHistories:output_type -> bytebase.v1.ListQueryHistoriesResponse- 26, // 52: bytebase.v1.SQLService.GetQueryHistory:output_type -> bytebase.v1.QueryHistory- 18, // 53: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse- 20, // 54: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse- 28, // 55: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse- 48, // [48:56] is the sub-list for method output_type- 40, // [40:48] is the sub-list for method input_type- 40, // [40:40] is the sub-list for extension type_name- 40, // [40:40] is the sub-list for extension extendee- 0, // [0:40] is the sub-list for field type_name+ 37, // 22: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat+ 38, // 23: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata+ 38, // 24: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata+ 39, // 25: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine+ 28, // 26: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message+ 29, // 27: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate+ 36, // 28: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position+ 2, // 29: bytebase.v1.QueryResult.CommandError.command_type:type_name -> bytebase.v1.QueryResult.CommandError.Type+ 3, // 30: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level+ 40, // 31: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp+ 40, // 32: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp+ 30, // 33: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content+ 31, // 34: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part+ 8, // 35: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest+ 6, // 36: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest+ 41, // 37: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest+ 42, // 38: bytebase.v1.SQLService.ListQueryHistories:input_type -> bytebase.v1.ListQueryHistoriesRequest+ 43, // 39: bytebase.v1.SQLService.GetQueryHistory:input_type -> bytebase.v1.GetQueryHistoryRequest+ 16, // 40: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest+ 18, // 41: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest+ 20, // 42: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest+ 9, // 43: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse+ 7, // 44: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse+ 44, // 45: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse+ 45, // 46: bytebase.v1.SQLService.ListQueryHistories:output_type -> bytebase.v1.ListQueryHistoriesResponse+ 46, // 47: bytebase.v1.SQLService.GetQueryHistory:output_type -> bytebase.v1.QueryHistory+ 17, // 48: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse+ 19, // 49: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse+ 21, // 50: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse+ 43, // [43:51] is the sub-list for method output_type+ 35, // [35:43] is the sub-list for method input_type+ 35, // [35:35] is the sub-list for extension type_name+ 35, // [35:35] is the sub-list for extension extendee+ 0, // [0:35] is the sub-list for field type_name}func init() { file_v1_sql_service_proto_init() }@@ -3301,6 +2760,7 @@ func file_v1_sql_service_proto_init() {file_v1_annotation_proto_init()file_v1_common_proto_init()file_v1_database_service_proto_init()+ file_v1_query_history_service_proto_init()file_v1_sql_service_proto_msgTypes[0].OneofWrappers = []any{}file_v1_sql_service_proto_msgTypes[2].OneofWrappers = []any{}file_v1_sql_service_proto_msgTypes[5].OneofWrappers = []any{@@ -3325,14 +2785,13 @@ func file_v1_sql_service_proto_init() {(*RowValue_TimestampTzValue)(nil),}file_v1_sql_service_proto_msgTypes[10].OneofWrappers = []any{}- file_v1_sql_service_proto_msgTypes[19].OneofWrappers = []any{}type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_sql_service_proto_rawDesc), len(file_v1_sql_service_proto_rawDesc)),- NumEnums: 7,- NumMessages: 32,+ NumEnums: 6,+ NumMessages: 26,NumExtensions: 0,NumServices: 1,},diff --git a/backend/generated-go/v1/sql_service.pb.gw.go b/backend/generated-go/v1/sql_service.pb.gw.goindex 9e349efb22..d238de25f9 100644--- a/backend/generated-go/v1/sql_service.pb.gw.go+++ b/backend/generated-go/v1/sql_service.pb.gw.go@@ -123,143 +123,6 @@ func request_SQLService_AdminExecute_0(ctx context.Context, marshaler runtime.Mareturn stream, metadata, nil}-func request_SQLService_SearchQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq SearchQueryHistoriesRequest- metadata runtime.ServerMetadata- err error- )- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if req.Body != nil {- _, _ = io.Copy(io.Discard, req.Body)- }- val, ok := pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }- msg, err := client.SearchQueryHistories(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_SQLService_SearchQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, server SQLServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq SearchQueryHistoriesRequest- metadata runtime.ServerMetadata- err error- )- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- val, ok := pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }- msg, err := server.SearchQueryHistories(ctx, &protoReq)- return msg, metadata, err-}--var filter_SQLService_ListQueryHistories_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}--func request_SQLService_ListQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq ListQueryHistoriesRequest- metadata runtime.ServerMetadata- err error- )- if req.Body != nil {- _, _ = io.Copy(io.Discard, req.Body)- }- val, ok := pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }- if err := req.ParseForm(); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SQLService_ListQueryHistories_0); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := client.ListQueryHistories(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_SQLService_ListQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, server SQLServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq ListQueryHistoriesRequest- metadata runtime.ServerMetadata- err error- )- val, ok := pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }- if err := req.ParseForm(); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SQLService_ListQueryHistories_0); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := server.ListQueryHistories(ctx, &protoReq)- return msg, metadata, err-}--func request_SQLService_GetQueryHistory_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq GetQueryHistoryRequest- metadata runtime.ServerMetadata- err error- )- if req.Body != nil {- _, _ = io.Copy(io.Discard, req.Body)- }- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := client.GetQueryHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_SQLService_GetQueryHistory_0(ctx context.Context, marshaler runtime.Marshaler, server SQLServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq GetQueryHistoryRequest- metadata runtime.ServerMetadata- err error- )- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := server.GetQueryHistory(ctx, &protoReq)- return msg, metadata, err-}-func request_SQLService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var (protoReq ExportRequest@@ -482,66 +345,6 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return})- mux.Handle(http.MethodPost, pattern_SQLService_SearchQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {- ctx, cancel := context.WithCancel(req.Context())- defer cancel()- var stream runtime.ServerTransportStream- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SQLService/SearchQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories:search"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_SQLService_SearchQueryHistories_0(annotatedContext, inboundMarshaler, server, req, pathParams)- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)- if err != nil {- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)- return- }- forward_SQLService_SearchQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodGet, pattern_SQLService_ListQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {- ctx, cancel := context.WithCancel(req.Context())- defer cancel()- var stream runtime.ServerTransportStream- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SQLService/ListQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_SQLService_ListQueryHistories_0(annotatedContext, inboundMarshaler, server, req, pathParams)- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)- if err != nil {- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)- return- }- forward_SQLService_ListQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodGet, pattern_SQLService_GetQueryHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {- ctx, cancel := context.WithCancel(req.Context())- defer cancel()- var stream runtime.ServerTransportStream- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SQLService/GetQueryHistory", runtime.WithHTTPPathPattern("/v1/{name=projects/*/queryHistories/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_SQLService_GetQueryHistory_0(annotatedContext, inboundMarshaler, server, req, pathParams)- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)- if err != nil {- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)- return- }- forward_SQLService_GetQueryHistory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })mux.Handle(http.MethodPost, pattern_SQLService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -716,57 +519,6 @@ func RegisterSQLServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,}forward_SQLService_AdminExecute_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)})- mux.Handle(http.MethodPost, pattern_SQLService_SearchQueryHistories_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/SearchQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories:search"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_SQLService_SearchQueryHistories_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_SearchQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodGet, pattern_SQLService_ListQueryHistories_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/ListQueryHistories", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/queryHistories"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_SQLService_ListQueryHistories_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_ListQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodGet, pattern_SQLService_GetQueryHistory_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/GetQueryHistory", runtime.WithHTTPPathPattern("/v1/{name=projects/*/queryHistories/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_SQLService_GetQueryHistory_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_GetQueryHistory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })mux.Handle(http.MethodPost, pattern_SQLService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -856,27 +608,21 @@ func RegisterSQLServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,}var (- pattern_SQLService_Query_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "databases", "name"}, "query"))- pattern_SQLService_AdminExecute_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"v1"}, "adminExecute"))- pattern_SQLService_SearchQueryHistories_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "queryHistories"}, "search"))- pattern_SQLService_ListQueryHistories_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "queryHistories"}, ""))- pattern_SQLService_GetQueryHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "queryHistories", "name"}, ""))- pattern_SQLService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "databases", "name"}, "export"))- pattern_SQLService_Export_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 4, 5, 5, 4}, []string{"v1", "projects", "plans", "rollout", "name"}, "export"))- pattern_SQLService_Export_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 2, 4, 1, 0, 4, 7, 5, 5}, []string{"v1", "projects", "plans", "rollout", "stages", "name"}, "export"))- pattern_SQLService_DiffMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "schemaDesign"}, "diffMetadata"))- pattern_SQLService_AICompletion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "sql", "aiCompletion"}, ""))+ pattern_SQLService_Query_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "databases", "name"}, "query"))+ pattern_SQLService_AdminExecute_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"v1"}, "adminExecute"))+ pattern_SQLService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "databases", "name"}, "export"))+ pattern_SQLService_Export_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 4, 5, 5, 4}, []string{"v1", "projects", "plans", "rollout", "name"}, "export"))+ pattern_SQLService_Export_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 2, 4, 1, 0, 4, 7, 5, 5}, []string{"v1", "projects", "plans", "rollout", "stages", "name"}, "export"))+ pattern_SQLService_DiffMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "schemaDesign"}, "diffMetadata"))+ pattern_SQLService_AICompletion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "sql", "aiCompletion"}, "")))var (- forward_SQLService_Query_0 = runtime.ForwardResponseMessage- forward_SQLService_AdminExecute_0 = runtime.ForwardResponseStream- forward_SQLService_SearchQueryHistories_0 = runtime.ForwardResponseMessage- forward_SQLService_ListQueryHistories_0 = runtime.ForwardResponseMessage- forward_SQLService_GetQueryHistory_0 = runtime.ForwardResponseMessage- forward_SQLService_Export_0 = runtime.ForwardResponseMessage- forward_SQLService_Export_1 = runtime.ForwardResponseMessage- forward_SQLService_Export_2 = runtime.ForwardResponseMessage- forward_SQLService_DiffMetadata_0 = runtime.ForwardResponseMessage- forward_SQLService_AICompletion_0 = runtime.ForwardResponseMessage+ forward_SQLService_Query_0 = runtime.ForwardResponseMessage+ forward_SQLService_AdminExecute_0 = runtime.ForwardResponseStream+ forward_SQLService_Export_0 = runtime.ForwardResponseMessage+ forward_SQLService_Export_1 = runtime.ForwardResponseMessage+ forward_SQLService_Export_2 = runtime.ForwardResponseMessage+ forward_SQLService_DiffMetadata_0 = runtime.ForwardResponseMessage+ forward_SQLService_AICompletion_0 = runtime.ForwardResponseMessage)diff --git a/backend/generated-go/v1/sql_service_equal.pb.go b/backend/generated-go/v1/sql_service_equal.pb.goindex 1f7a6587ac..a34dcb5fce 100644--- a/backend/generated-go/v1/sql_service_equal.pb.go+++ b/backend/generated-go/v1/sql_service_equal.pb.go@@ -551,139 +551,6 @@ func (x *DiffMetadataResponse) Equal(y *DiffMetadataResponse) bool {return true}-func (x *SearchQueryHistoriesRequest) Equal(y *SearchQueryHistoriesRequest) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if x.Parent != y.Parent {- return false- }- if x.PageSize != y.PageSize {- return false- }- if x.PageToken != y.PageToken {- return false- }- if x.Filter != y.Filter {- return false- }- return true-}--func (x *ListQueryHistoriesRequest) Equal(y *ListQueryHistoriesRequest) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if x.Parent != y.Parent {- return false- }- if x.PageSize != y.PageSize {- return false- }- if x.PageToken != y.PageToken {- return false- }- if x.Filter != y.Filter {- return false- }- return true-}--func (x *ListQueryHistoriesResponse) Equal(y *ListQueryHistoriesResponse) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if len(x.QueryHistories) != len(y.QueryHistories) {- return false- }- for i := 0; i < len(x.QueryHistories); i++ {- if !x.QueryHistories[i].Equal(y.QueryHistories[i]) {- return false- }- }- if x.NextPageToken != y.NextPageToken {- return false- }- return true-}--func (x *GetQueryHistoryRequest) Equal(y *GetQueryHistoryRequest) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if x.Name != y.Name {- return false- }- return true-}--func (x *SearchQueryHistoriesResponse) Equal(y *SearchQueryHistoriesResponse) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if len(x.QueryHistories) != len(y.QueryHistories) {- return false- }- for i := 0; i < len(x.QueryHistories); i++ {- if !x.QueryHistories[i].Equal(y.QueryHistories[i]) {- return false- }- }- if x.NextPageToken != y.NextPageToken {- return false- }- return true-}--func (x *QueryHistory) Equal(y *QueryHistory) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if x.Name != y.Name {- return false- }- if x.Database != y.Database {- return false- }- if x.Creator != y.Creator {- return false- }- if p, q := x.CreateTime, y.CreateTime; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {- return false- }- if x.Statement != y.Statement {- return false- }- if p, q := x.Error, y.Error; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {- return false- }- if p, q := x.Duration, y.Duration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {- return false- }- if x.Type != y.Type {- return false- }- return true-}-func (x *AICompletionRequest_Message) Equal(y *AICompletionRequest_Message) bool {if x == y {return truediff --git a/backend/generated-go/v1/sql_service_grpc.pb.go b/backend/generated-go/v1/sql_service_grpc.pb.goindex 3a7e4ad755..4def3edad7 100644--- a/backend/generated-go/v1/sql_service_grpc.pb.go+++ b/backend/generated-go/v1/sql_service_grpc.pb.go@@ -41,13 +41,22 @@ type SQLServiceClient interface {// Executes SQL with admin privileges via streaming connection.// Permissions required: bb.sql.adminAdminExecute(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AdminExecuteRequest, AdminExecuteResponse], error)- // SearchQueryHistories searches query histories for the caller.+ // Deprecated: Do not use.+ // Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns caller's own query histories)SearchQueryHistories(ctx context.Context, in *SearchQueryHistoriesRequest, opts ...grpc.CallOption) (*SearchQueryHistoriesResponse, error)- // ListQueryHistories lists query histories of all users in a project.+ // Deprecated: Do not use.+ // Deprecated: use QueryHistoryService.ListQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: bb.queryHistories.listListQueryHistories(ctx context.Context, in *ListQueryHistoriesRequest, opts ...grpc.CallOption) (*ListQueryHistoriesResponse, error)- // GetQueryHistory gets a single query history for the caller.+ // Deprecated: Do not use.+ // Deprecated: use QueryHistoryService.GetQueryHistory instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns the caller's own query history)GetQueryHistory(ctx context.Context, in *GetQueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistory, error)// Exports query results to a file format.@@ -92,6 +101,7 @@ func (c *sQLServiceClient) AdminExecute(ctx context.Context, opts ...grpc.CallOp// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.type SQLService_AdminExecuteClient = grpc.BidiStreamingClient[AdminExecuteRequest, AdminExecuteResponse]+// Deprecated: Do not use.func (c *sQLServiceClient) SearchQueryHistories(ctx context.Context, in *SearchQueryHistoriesRequest, opts ...grpc.CallOption) (*SearchQueryHistoriesResponse, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(SearchQueryHistoriesResponse)@@ -102,6 +112,7 @@ func (c *sQLServiceClient) SearchQueryHistories(ctx context.Context, in *SearchQreturn out, nil}+// Deprecated: Do not use.func (c *sQLServiceClient) ListQueryHistories(ctx context.Context, in *ListQueryHistoriesRequest, opts ...grpc.CallOption) (*ListQueryHistoriesResponse, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(ListQueryHistoriesResponse)@@ -112,6 +123,7 @@ func (c *sQLServiceClient) ListQueryHistories(ctx context.Context, in *ListQueryreturn out, nil}+// Deprecated: Do not use.func (c *sQLServiceClient) GetQueryHistory(ctx context.Context, in *GetQueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistory, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(QueryHistory)@@ -164,13 +176,22 @@ type SQLServiceServer interface {// Executes SQL with admin privileges via streaming connection.// Permissions required: bb.sql.adminAdminExecute(grpc.BidiStreamingServer[AdminExecuteRequest, AdminExecuteResponse]) error- // SearchQueryHistories searches query histories for the caller.+ // Deprecated: Do not use.+ // Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns caller's own query histories)SearchQueryHistories(context.Context, *SearchQueryHistoriesRequest) (*SearchQueryHistoriesResponse, error)- // ListQueryHistories lists query histories of all users in a project.+ // Deprecated: Do not use.+ // Deprecated: use QueryHistoryService.ListQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: bb.queryHistories.listListQueryHistories(context.Context, *ListQueryHistoriesRequest) (*ListQueryHistoriesResponse, error)- // GetQueryHistory gets a single query history for the caller.+ // Deprecated: Do not use.+ // Deprecated: use QueryHistoryService.GetQueryHistory instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns the caller's own query history)GetQueryHistory(context.Context, *GetQueryHistoryRequest) (*QueryHistory, error)// Exports query results to a file format.diff --git a/backend/generated-go/v1/v1connect/query_history_service.connect.go b/backend/generated-go/v1/v1connect/query_history_service.connect.gonew file mode 100644index 0000000000..017e8dd25e--- /dev/null+++ b/backend/generated-go/v1/v1connect/query_history_service.connect.go@@ -0,0 +1,179 @@+// Code generated by protoc-gen-connect-go. DO NOT EDIT.+//+// Source: v1/query_history_service.proto++package v1connect++import (+ connect "connectrpc.com/connect"+ context "context"+ errors "errors"+ v1 "github.com/bytebase/bytebase/backend/generated-go/v1"+ http "net/http"+ strings "strings"+)++// This is a compile-time assertion to ensure that this generated file and the connect package are+// compatible. If you get a compiler error that this constant is not defined, this code was+// generated with a version of connect newer than the one compiled into your binary. You can fix the+// problem by either regenerating this code with an older version of connect or updating the connect+// version compiled into your binary.+const _ = connect.IsAtLeastVersion1_13_0++const (+ // QueryHistoryServiceName is the fully-qualified name of the QueryHistoryService service.+ QueryHistoryServiceName = "bytebase.v1.QueryHistoryService"+)++// These constants are the fully-qualified names of the RPCs defined in this package. They're+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.+//+// Note that these are different from the fully-qualified method names used by+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a+// period.+const (+ // QueryHistoryServiceSearchQueryHistoriesProcedure is the fully-qualified name of the+ // QueryHistoryService's SearchQueryHistories RPC.+ QueryHistoryServiceSearchQueryHistoriesProcedure = "/bytebase.v1.QueryHistoryService/SearchQueryHistories"+ // QueryHistoryServiceListQueryHistoriesProcedure is the fully-qualified name of the+ // QueryHistoryService's ListQueryHistories RPC.+ QueryHistoryServiceListQueryHistoriesProcedure = "/bytebase.v1.QueryHistoryService/ListQueryHistories"+ // QueryHistoryServiceGetQueryHistoryProcedure is the fully-qualified name of the+ // QueryHistoryService's GetQueryHistory RPC.+ QueryHistoryServiceGetQueryHistoryProcedure = "/bytebase.v1.QueryHistoryService/GetQueryHistory"+)++// QueryHistoryServiceClient is a client for the bytebase.v1.QueryHistoryService service.+type QueryHistoryServiceClient interface {+ // SearchQueryHistories searches query histories for the caller.+ // Permissions required: None (only returns caller's own query histories)+ SearchQueryHistories(context.Context, *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error)+ // ListQueryHistories lists query histories of all users in a project.+ // Permissions required: bb.queryHistories.list+ ListQueryHistories(context.Context, *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error)+ // GetQueryHistory gets a single query history for the caller.+ // Permissions required: None (only returns the caller's own query history)+ GetQueryHistory(context.Context, *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error)+}++// NewQueryHistoryServiceClient constructs a client for the bytebase.v1.QueryHistoryService service.+// By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped+// responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the+// connect.WithGRPC() or connect.WithGRPCWeb() options.+//+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,+// http://api.acme.com or https://acme.com/grpc).+func NewQueryHistoryServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) QueryHistoryServiceClient {+ baseURL = strings.TrimRight(baseURL, "/")+ queryHistoryServiceMethods := v1.File_v1_query_history_service_proto.Services().ByName("QueryHistoryService").Methods()+ return &queryHistoryServiceClient{+ searchQueryHistories: connect.NewClient[v1.SearchQueryHistoriesRequest, v1.SearchQueryHistoriesResponse](+ httpClient,+ baseURL+QueryHistoryServiceSearchQueryHistoriesProcedure,+ connect.WithSchema(queryHistoryServiceMethods.ByName("SearchQueryHistories")),+ connect.WithClientOptions(opts...),+ ),+ listQueryHistories: connect.NewClient[v1.ListQueryHistoriesRequest, v1.ListQueryHistoriesResponse](+ httpClient,+ baseURL+QueryHistoryServiceListQueryHistoriesProcedure,+ connect.WithSchema(queryHistoryServiceMethods.ByName("ListQueryHistories")),+ connect.WithClientOptions(opts...),+ ),+ getQueryHistory: connect.NewClient[v1.GetQueryHistoryRequest, v1.QueryHistory](+ httpClient,+ baseURL+QueryHistoryServiceGetQueryHistoryProcedure,+ connect.WithSchema(queryHistoryServiceMethods.ByName("GetQueryHistory")),+ connect.WithClientOptions(opts...),+ ),+ }+}++// queryHistoryServiceClient implements QueryHistoryServiceClient.+type queryHistoryServiceClient struct {+ searchQueryHistories *connect.Client[v1.SearchQueryHistoriesRequest, v1.SearchQueryHistoriesResponse]+ listQueryHistories *connect.Client[v1.ListQueryHistoriesRequest, v1.ListQueryHistoriesResponse]+ getQueryHistory *connect.Client[v1.GetQueryHistoryRequest, v1.QueryHistory]+}++// SearchQueryHistories calls bytebase.v1.QueryHistoryService.SearchQueryHistories.+func (c *queryHistoryServiceClient) SearchQueryHistories(ctx context.Context, req *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error) {+ return c.searchQueryHistories.CallUnary(ctx, req)+}++// ListQueryHistories calls bytebase.v1.QueryHistoryService.ListQueryHistories.+func (c *queryHistoryServiceClient) ListQueryHistories(ctx context.Context, req *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error) {+ return c.listQueryHistories.CallUnary(ctx, req)+}++// GetQueryHistory calls bytebase.v1.QueryHistoryService.GetQueryHistory.+func (c *queryHistoryServiceClient) GetQueryHistory(ctx context.Context, req *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error) {+ return c.getQueryHistory.CallUnary(ctx, req)+}++// QueryHistoryServiceHandler is an implementation of the bytebase.v1.QueryHistoryService service.+type QueryHistoryServiceHandler interface {+ // SearchQueryHistories searches query histories for the caller.+ // Permissions required: None (only returns caller's own query histories)+ SearchQueryHistories(context.Context, *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error)+ // ListQueryHistories lists query histories of all users in a project.+ // Permissions required: bb.queryHistories.list+ ListQueryHistories(context.Context, *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error)+ // GetQueryHistory gets a single query history for the caller.+ // Permissions required: None (only returns the caller's own query history)+ GetQueryHistory(context.Context, *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error)+}++// NewQueryHistoryServiceHandler builds an HTTP handler from the service implementation. It returns+// the path on which to mount the handler and the handler itself.+//+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf+// and JSON codecs. They also support gzip compression.+func NewQueryHistoryServiceHandler(svc QueryHistoryServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {+ queryHistoryServiceMethods := v1.File_v1_query_history_service_proto.Services().ByName("QueryHistoryService").Methods()+ queryHistoryServiceSearchQueryHistoriesHandler := connect.NewUnaryHandler(+ QueryHistoryServiceSearchQueryHistoriesProcedure,+ svc.SearchQueryHistories,+ connect.WithSchema(queryHistoryServiceMethods.ByName("SearchQueryHistories")),+ connect.WithHandlerOptions(opts...),+ )+ queryHistoryServiceListQueryHistoriesHandler := connect.NewUnaryHandler(+ QueryHistoryServiceListQueryHistoriesProcedure,+ svc.ListQueryHistories,+ connect.WithSchema(queryHistoryServiceMethods.ByName("ListQueryHistories")),+ connect.WithHandlerOptions(opts...),+ )+ queryHistoryServiceGetQueryHistoryHandler := connect.NewUnaryHandler(+ QueryHistoryServiceGetQueryHistoryProcedure,+ svc.GetQueryHistory,+ connect.WithSchema(queryHistoryServiceMethods.ByName("GetQueryHistory")),+ connect.WithHandlerOptions(opts...),+ )+ return "/bytebase.v1.QueryHistoryService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch r.URL.Path {+ case QueryHistoryServiceSearchQueryHistoriesProcedure:+ queryHistoryServiceSearchQueryHistoriesHandler.ServeHTTP(w, r)+ case QueryHistoryServiceListQueryHistoriesProcedure:+ queryHistoryServiceListQueryHistoriesHandler.ServeHTTP(w, r)+ case QueryHistoryServiceGetQueryHistoryProcedure:+ queryHistoryServiceGetQueryHistoryHandler.ServeHTTP(w, r)+ default:+ http.NotFound(w, r)+ }+ })+}++// UnimplementedQueryHistoryServiceHandler returns CodeUnimplemented from all methods.+type UnimplementedQueryHistoryServiceHandler struct{}++func (UnimplementedQueryHistoryServiceHandler) SearchQueryHistories(context.Context, *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error) {+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.QueryHistoryService.SearchQueryHistories is not implemented"))+}++func (UnimplementedQueryHistoryServiceHandler) ListQueryHistories(context.Context, *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error) {+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.QueryHistoryService.ListQueryHistories is not implemented"))+}++func (UnimplementedQueryHistoryServiceHandler) GetQueryHistory(context.Context, *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error) {+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.QueryHistoryService.GetQueryHistory is not implemented"))+}diff --git a/backend/generated-go/v1/v1connect/sql_service.connect.go b/backend/generated-go/v1/v1connect/sql_service.connect.goindex fc8bfd1e57..4677aa02b2 100644--- a/backend/generated-go/v1/v1connect/sql_service.connect.go+++ b/backend/generated-go/v1/v1connect/sql_service.connect.go@@ -62,14 +62,26 @@ type SQLServiceClient interface {// Executes SQL with admin privileges via streaming connection.// Permissions required: bb.sql.adminAdminExecute(context.Context) *connect.BidiStreamForClient[v1.AdminExecuteRequest, v1.AdminExecuteResponse]- // SearchQueryHistories searches query histories for the caller.+ // Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns caller's own query histories)+ //+ // Deprecated: do not use.SearchQueryHistories(context.Context, *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error)- // ListQueryHistories lists query histories of all users in a project.+ // Deprecated: use QueryHistoryService.ListQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: bb.queryHistories.list+ //+ // Deprecated: do not use.ListQueryHistories(context.Context, *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error)- // GetQueryHistory gets a single query history for the caller.+ // Deprecated: use QueryHistoryService.GetQueryHistory instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns the caller's own query history)+ //+ // Deprecated: do not use.GetQueryHistory(context.Context, *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error)// Exports query results to a file format.// Permissions required: bb.databases.get@@ -167,16 +179,22 @@ func (c *sQLServiceClient) AdminExecute(ctx context.Context) *connect.BidiStream}// SearchQueryHistories calls bytebase.v1.SQLService.SearchQueryHistories.+//+// Deprecated: do not use.func (c *sQLServiceClient) SearchQueryHistories(ctx context.Context, req *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error) {return c.searchQueryHistories.CallUnary(ctx, req)}// ListQueryHistories calls bytebase.v1.SQLService.ListQueryHistories.+//+// Deprecated: do not use.func (c *sQLServiceClient) ListQueryHistories(ctx context.Context, req *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error) {return c.listQueryHistories.CallUnary(ctx, req)}// GetQueryHistory calls bytebase.v1.SQLService.GetQueryHistory.+//+// Deprecated: do not use.func (c *sQLServiceClient) GetQueryHistory(ctx context.Context, req *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error) {return c.getQueryHistory.CallUnary(ctx, req)}@@ -204,14 +222,26 @@ type SQLServiceHandler interface {// Executes SQL with admin privileges via streaming connection.// Permissions required: bb.sql.adminAdminExecute(context.Context, *connect.BidiStream[v1.AdminExecuteRequest, v1.AdminExecuteResponse]) error- // SearchQueryHistories searches query histories for the caller.+ // Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns caller's own query histories)+ //+ // Deprecated: do not use.SearchQueryHistories(context.Context, *connect.Request[v1.SearchQueryHistoriesRequest]) (*connect.Response[v1.SearchQueryHistoriesResponse], error)- // ListQueryHistories lists query histories of all users in a project.+ // Deprecated: use QueryHistoryService.ListQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: bb.queryHistories.list+ //+ // Deprecated: do not use.ListQueryHistories(context.Context, *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error)- // GetQueryHistory gets a single query history for the caller.+ // Deprecated: use QueryHistoryService.GetQueryHistory instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns the caller's own query history)+ //+ // Deprecated: do not use.GetQueryHistory(context.Context, *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error)// Exports query results to a file format.// Permissions required: bb.databases.getdiff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.goindex 260b1f87ef..e51b00498d 100644--- a/backend/server/grpc_routes.go+++ b/backend/server/grpc_routes.go@@ -108,6 +108,7 @@ func configureGrpcRouters(orgPolicyService := apiv1.NewOrgPolicyService(stores, licenseService, iamManager)planService := apiv1.NewPlanService(stores, bus, iamManager, webhookManager, licenseService)projectService := apiv1.NewProjectService(stores, profile, iamManager)+ queryHistoryService := apiv1.NewQueryHistoryService(stores)releaseService := apiv1.NewReleaseService(stores, sheetManager, dbFactory, licenseService)reviewConfigService := apiv1.NewReviewConfigService(stores)revisionService := apiv1.NewRevisionService(stores)@@ -115,7 +116,7 @@ func configureGrpcRouters(rolloutService := apiv1.NewRolloutService(stores, dbFactory, bus, webhookManager, iamManager)settingService := apiv1.NewSettingService(stores, profile, licenseService, iamManager)sheetService := apiv1.NewSheetService(stores)- sqlService := apiv1.NewSQLService(stores, schemaSyncer, dbFactory, licenseService, iamManager)+ sqlService := apiv1.NewSQLService(stores, schemaSyncer, dbFactory, licenseService, iamManager, queryHistoryService)subscriptionService := apiv1.NewSubscriptionService(profile, stores, licenseService)userService := apiv1.NewUserService(stores, licenseService, profile, iamManager)serviceAccountService := apiv1.NewServiceAccountService(stores, profile, iamManager)@@ -199,6 +200,9 @@ func configureGrpcRouters(projectPath, projectHandler := v1connect.NewProjectServiceHandler(projectService, handlerOpts)connectHandlers[projectPath] = projectHandler+ queryHistoryPath, queryHistoryHandler := v1connect.NewQueryHistoryServiceHandler(queryHistoryService, handlerOpts)+ connectHandlers[queryHistoryPath] = queryHistoryHandler+releasePath, releaseHandler := v1connect.NewReleaseServiceHandler(releaseService, handlerOpts)connectHandlers[releasePath] = releaseHandler@@ -261,6 +265,7 @@ func configureGrpcRouters(v1connect.OrgPolicyServiceName,v1connect.PlanServiceName,v1connect.ProjectServiceName,+ v1connect.QueryHistoryServiceName,v1connect.ReleaseServiceName,v1connect.ReviewConfigServiceName,v1connect.RevisionServiceName,@@ -349,6 +354,9 @@ func configureGrpcRouters(if err := v1pb.RegisterProjectServiceHandler(ctx, mux, grpcConn); err != nil {return err}+ if err := v1pb.RegisterQueryHistoryServiceHandler(ctx, mux, grpcConn); err != nil {+ return err+ }if err := v1pb.RegisterReleaseServiceHandler(ctx, mux, grpcConn); err != nil {return err}diff --git a/backend/tests/query_history_test.go b/backend/tests/query_history_test.goindex 65f089d7c8..f6f55de3a0 100644--- a/backend/tests/query_history_test.go+++ b/backend/tests/query_history_test.go@@ -15,6 +15,8 @@ import (// TestListQueryHistories covers BYT-9892: ListQueryHistories exposes a// project's query histories across users, gated by bb.queryHistories.list on the// project, while SearchQueryHistories and GetQueryHistory stay caller-scoped.+// It also pins the deprecated SQLService aliases delegating to+// QueryHistoryService with identical results and auth until their removal.func TestListQueryHistories(t *testing.T) {t.Parallel()a := require.New(t)@@ -102,7 +104,7 @@ func TestListQueryHistories(t *testing.T) {a.Len(otherQueryResp.Msg.Results, 1)// Grab one history name for the GetQueryHistory checks below.- searchResp, err := ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ searchResp, err := ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{Parent: ctl.project.Name,}))a.NoError(err)@@ -133,13 +135,13 @@ func TestListQueryHistories(t *testing.T) {// 4. Without bb.queryHistories.list: List is denied, Get hides existence.ctl.authInterceptor.token = auditorToken- _, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ _, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: ctl.project.Name,}))a.Error(err)a.Equal(connect.CodePermissionDenied, connect.CodeOf(err))- _, err = ctl.sqlServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{+ _, err = ctl.queryHistoryServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{Name: historyName,}))a.Error(err)@@ -174,7 +176,7 @@ func TestListQueryHistories(t *testing.T) {// 6. With the grant: the auditor lists other users' histories.ctl.authInterceptor.token = auditorToken- listResp, err := ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ listResp, err := ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: ctl.project.Name,}))a.NoError(err)@@ -192,7 +194,7 @@ func TestListQueryHistories(t *testing.T) {}// The grant is on ctl.project only, so listing the other project is denied.- _, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ _, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: otherProject.Name,}))a.Error(err)@@ -201,7 +203,7 @@ func TestListQueryHistories(t *testing.T) {// The owner (workspace admin) listing the other project sees only that// project's single history.ctl.authInterceptor.token = ownerToken- otherListResp, err := ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ otherListResp, err := ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: otherProject.Name,}))a.NoError(err)@@ -211,7 +213,7 @@ func TestListQueryHistories(t *testing.T) {ctl.authInterceptor.token = auditorToken// Creator filter pins to the given user.- listResp, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ listResp, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: ctl.project.Name,Filter: fmt.Sprintf("creator == \"users/%s\"", ownerEmail),}))@@ -219,7 +221,7 @@ func TestListQueryHistories(t *testing.T) {a.GreaterOrEqual(len(listResp.Msg.QueryHistories), 2)// Filtering by a creator with no histories returns empty.- listResp, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ listResp, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: ctl.project.Name,Filter: fmt.Sprintf("creator == \"users/%s\"", auditorEmail),}))@@ -227,7 +229,7 @@ func TestListQueryHistories(t *testing.T) {a.Empty(listResp.Msg.QueryHistories)// Only the creator filter is supported.- _, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ _, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: ctl.project.Name,Filter: `type == "QUERY"`,}))@@ -236,14 +238,14 @@ func TestListQueryHistories(t *testing.T) {// GetQueryHistory stays creator-only: even with the grant, the// non-creator cannot resolve an individual history.- _, err = ctl.sqlServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{+ _, err = ctl.queryHistoryServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{Name: historyName,}))a.Error(err)a.Equal(connect.CodeNotFound, connect.CodeOf(err))// SearchQueryHistories stays caller-scoped: the auditor sees nothing.- searchResp, err = ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ searchResp, err = ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{Parent: ctl.project.Name,}))a.NoError(err)@@ -251,7 +253,7 @@ func TestListQueryHistories(t *testing.T) {// 7. Cross-project listing via the AIP-159 wildcard parent "projects/-"// requires a workspace-level grant, so the project-scoped auditor is denied.- _, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ _, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: "projects/-",}))a.Error(err)@@ -260,7 +262,7 @@ func TestListQueryHistories(t *testing.T) {// The owner (workspace admin) lists across all projects and sees rows from// both projects, each named under its own project.ctl.authInterceptor.token = ownerToken- wildcardResp, err := ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ wildcardResp, err := ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: "projects/-",}))a.NoError(err)@@ -281,7 +283,7 @@ func TestListQueryHistories(t *testing.T) {a.Equal(1, otherProjectCount)// The creator filter composes with the wildcard parent.- wildcardResp, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ wildcardResp, err = ctl.queryHistoryServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{Parent: "projects/-",Filter: fmt.Sprintf("creator == \"users/%s\"", auditorEmail),}))@@ -291,7 +293,7 @@ func TestListQueryHistories(t *testing.T) {// 8. SearchQueryHistories requires a concrete parent project and stays// caller-scoped; cross-project reads are reserved for the IAM-gated// ListQueryHistories.- searchResp, err = ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ searchResp, err = ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{Parent: ctl.project.Name,}))a.NoError(err)@@ -301,7 +303,7 @@ func TestListQueryHistories(t *testing.T) {a.NotEqual(otherStatement, history.Statement)}- searchResp, err = ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ searchResp, err = ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{Parent: otherProject.Name,}))a.NoError(err)@@ -309,22 +311,69 @@ func TestListQueryHistories(t *testing.T) {a.Equal(otherStatement, searchResp.Msg.QueryHistories[0].Statement)// The AIP-159 wildcard parent is rejected.- _, err = ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ _, err = ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{Parent: "projects/-",}))a.Error(err)a.Equal(connect.CodeInvalidArgument, connect.CodeOf(err))// The parent is required.- _, err = ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{}))+ _, err = ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{}))a.Error(err)a.Equal(connect.CodeInvalidArgument, connect.CodeOf(err))// A nonexistent parent project is rejected, consistent with// ListQueryHistories.- _, err = ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ _, err = ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{Parent: "projects/no-such-project",}))a.Error(err)a.Equal(connect.CodeNotFound, connect.CodeOf(err))++ // 9. The deprecated SQLService method names keep working as delegating+ // aliases of QueryHistoryService until they are removed.+ aliasSearchResp, err := ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{ //nolint:staticcheck // Pinning the deprecated alias until removal.+ Parent: ctl.project.Name,+ }))+ a.NoError(err)+ newSearchResp, err := ctl.queryHistoryServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ Parent: ctl.project.Name,+ }))+ a.NoError(err)+ a.Equal(len(newSearchResp.Msg.QueryHistories), len(aliasSearchResp.Msg.QueryHistories))+ for i, history := range aliasSearchResp.Msg.QueryHistories {+ a.Equal(newSearchResp.Msg.QueryHistories[i].Name, history.Name)+ }++ aliasListResp, err := ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{ //nolint:staticcheck // Pinning the deprecated alias until removal.+ Parent: otherProject.Name,+ }))+ a.NoError(err)+ a.Len(aliasListResp.Msg.QueryHistories, 1)+ a.Equal(otherStatement, aliasListResp.Msg.QueryHistories[0].Statement)++ // Both method names resolve the same individual history for its creator.+ getResp, err := ctl.queryHistoryServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{+ Name: historyName,+ }))+ a.NoError(err)+ a.Equal(historyName, getResp.Msg.Name)+ aliasGetResp, err := ctl.sqlServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{ //nolint:staticcheck // Pinning the deprecated alias until removal.+ Name: historyName,+ }))+ a.NoError(err)+ a.Equal(historyName, aliasGetResp.Msg.Name)++ // The aliases enforce the same IAM and caller scoping.+ ctl.authInterceptor.token = auditorToken+ _, err = ctl.sqlServiceClient.GetQueryHistory(ctx, connect.NewRequest(&v1pb.GetQueryHistoryRequest{ //nolint:staticcheck // Pinning the deprecated alias until removal.+ Name: historyName,+ }))+ a.Error(err)+ a.Equal(connect.CodeNotFound, connect.CodeOf(err))+ _, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{ //nolint:staticcheck // Pinning the deprecated alias until removal.+ Parent: otherProject.Name,+ }))+ a.Error(err)+ a.Equal(connect.CodePermissionDenied, connect.CodeOf(err))}diff --git a/backend/tests/tests.go b/backend/tests/tests.goindex 8a83d5632c..594c159141 100644--- a/backend/tests/tests.go+++ b/backend/tests/tests.go@@ -103,6 +103,7 @@ type controller struct {databaseCatalogServiceClient v1connect.DatabaseCatalogServiceClientsheetServiceClient v1connect.SheetServiceClientsqlServiceClient v1connect.SQLServiceClient+ queryHistoryServiceClient v1connect.QueryHistoryServiceClientsubscriptionServiceClient v1connect.SubscriptionServiceClientactuatorServiceClient v1connect.ActuatorServiceClientworkspaceServiceClient v1connect.WorkspaceServiceClient@@ -296,6 +297,7 @@ func (ctl *controller) start(ctx context.Context, port int) (context.Context, erctl.databaseCatalogServiceClient = v1connect.NewDatabaseCatalogServiceClient(ctl.client, baseURL, interceptors)ctl.sheetServiceClient = v1connect.NewSheetServiceClient(ctl.client, baseURL, interceptors)ctl.sqlServiceClient = v1connect.NewSQLServiceClient(ctl.client, baseURL, interceptors)+ ctl.queryHistoryServiceClient = v1connect.NewQueryHistoryServiceClient(ctl.client, baseURL, interceptors)ctl.subscriptionServiceClient = v1connect.NewSubscriptionServiceClient(ctl.client, baseURL, interceptors)ctl.actuatorServiceClient = v1connect.NewActuatorServiceClient(ctl.client, baseURL, interceptors)ctl.workspaceServiceClient = v1connect.NewWorkspaceServiceClient(ctl.client, baseURL, interceptors)diff --git a/docs/plans/saas/07.api-resource-patterns.md b/docs/plans/saas/07.api-resource-patterns.mdindex 64697a9bfa..400c33e1b8 100644--- a/docs/plans/saas/07.api-resource-patterns.md+++ b/docs/plans/saas/07.api-resource-patterns.md@@ -79,6 +79,8 @@ These APIs are scoped to a project. ACL validates the project belongs to the wor| ProjectService | GetIamPolicy, SetIamPolicy | resource: `projects/{project}` || ProjectService | AddWebhook, TestWebhook | project: `projects/{project}` || ProjectService | UpdateWebhook, RemoveWebhook | name: `projects/{project}/webhooks/{webhook}` |+| QueryHistoryService | SearchQueryHistories (caller-scoped), ListQueryHistories (also accepts wildcard `projects/-` for workspace-wide reads) | parent: `projects/{project}` |+| QueryHistoryService | GetQueryHistory (caller-scoped) | name: `projects/{project}/queryHistories/{queryHistory}` || ReleaseService | ListReleases, CreateRelease, CheckRelease, ListReleaseCategories | parent: `projects/{project}` || ReleaseService | GetRelease, UpdateRelease, DeleteRelease, UndeleteRelease | name: `projects/{project}/releases/{release}` || RolloutService | ListRollouts | parent: `projects/{project}` |@@ -158,9 +160,12 @@ Accepts:- `workspaces/{workspace}` resource-### SQLService — DiffMetadata / AICompletion / SearchQueryHistories+### SQLService — DiffMetadata / AICompletion- Workspace-level utility methods (no resource parent)+- The query history RPCs moved to QueryHistoryService (see the+ `projects/{project}` parent table); SQLService keeps deprecated delegating+ aliases without HTTP bindings until their removal (date TBD)---diff --git a/docs/superpowers/specs/2026-07-29-query-history-service-extraction-design.md b/docs/superpowers/specs/2026-07-29-query-history-service-extraction-design.mdnew file mode 100644index 0000000000..7addd1a2ec--- /dev/null+++ b/docs/superpowers/specs/2026-07-29-query-history-service-extraction-design.md@@ -0,0 +1,200 @@+# QueryHistoryService Extraction Design++**Date**: 2026-07-29+**Status**: Approved (amended: keep SQLService aliases as deprecated proxies)+**Ships in**: 3.21 (current release 3.20.1); legacy alias removal in a future+release, date TBD++## Summary++Extract `SearchQueryHistories`, `ListQueryHistories`, and `GetQueryHistory`+from `SQLService` into a new standalone `QueryHistoryService`, following the+per-resource service pattern (`ChangelogService` and `RevisionService` are the+structural analogs). Unlike the ChangelogService extraction's clean cut, the+old `bytebase.v1.SQLService` methods are **kept as deprecated delegating+proxies** for a safe upgrade transition, and removed in a future release+(date TBD).++Rationale for diverging from the changelog decision: the query history RPCs+are called continuously by the SQL Editor over the Connect protocol+(`/bytebase.v1.SQLService/SearchQueryHistories` etc.). During a rolling+upgrade, browsers holding a cached pre-3.21 frontend bundle keep issuing the+old method names against a new backend; without aliases the History pane+breaks until a hard refresh. Changelogs had no such hot browser-side caller.++After the move, `SQLService`'s non-deprecated surface holds only execution+and utility RPCs: `Query`, `AdminExecute`, `Export`, `DiffMetadata`,+`AICompletion`.++## Goals++- `QueryHistoryService` owns the query history resource+ (`projects/{project}/queryHistories/{id}`) and serves the REST routes.+- Zero behavior change: same permissions, same REST paths, same wire format,+ same pagination semantics, same caller-scoping and existence-hiding errors —+ on both the new methods and the deprecated aliases.++## Non-goals++- No store-layer changes (`backend/store/query_history.go` untouched).+- The write path stays where it is: `createQueryHistory` is an internal store+ write invoked by `Query`/`AdminExecute`/`Export` inside `SQLService`, not an+ RPC. `QueryHistoryService` is read-only, like `ChangelogService` (whose rows+ are written by task runs).+- No new RPCs, no permission changes (`bb.queryHistories.list` stays), no+ resource-name changes, no new `google.api.resource` annotation for+ QueryHistory (it has none today).+- No commitment to a specific alias-removal release in this design; removal is+ a future labeled-breaking change, date TBD.++## Background++- `SQLService` mixes two concerns: SQL execution (Query/AdminExecute/Export+ plus utilities) and the query history child resource of Project. The history+ RPCs are the only project-parented resource CRUD in the service.+- The six messages to move (`SearchQueryHistoriesRequest/Response`,+ `ListQueryHistoriesRequest/Response`, `GetQueryHistoryRequest`,+ `QueryHistory` with its `Type` enum) are referenced by no other proto file.+ Package stays `bytebase.v1`, so fully-qualified names and binary/JSON wire+ format are unchanged. The alias RPCs reference the moved messages via+ `import "v1/query_history_service.proto"` — same types, so alias and new+ method are wire-identical.+- Authorization is annotation-driven: `backend/api/auth/auth.go` resolves the+ method descriptor from the invoked full method name via+ `protoregistry.GlobalFiles` and reads the extensions. The aliases keep their+ `bytebase.v1.permission` / `auth_method` annotations, so both paths enforce+ identical auth — `ListQueryHistories` (IAM, `bb.queryHistories.list`) and+ the two CUSTOM caller-scoped RPCs — with no auth code changes.+- Recent hardening carries over verbatim on both paths: SearchQueryHistories+ rejects the AIP-159 wildcard parent (#21064); ListQueryHistories supports+ "projects/-" gated on workspace-level permission.+- `buf.yaml` lints with the BASIC category; `RPC_REQUEST_RESPONSE_UNIQUE`+ (DEFAULT category) is not enforced, so the alias RPCs may share+ request/response types with the new service.++## Design++### 1. Proto++**New `proto/v1/v1/query_history_service.proto`**, modeled on+`changelog_service.proto`: `QueryHistoryService` with the three RPCs — HTTP+bindings under `/v1/{parent=projects/*}/queryHistories`, `method_signature`,+`bytebase.v1.permission`, and `auth_method` annotations carried over+unchanged — plus the six messages moved verbatim (field numbers, comments,+resource references unchanged).++**`sql_service.proto`** keeps the three RPCs as aliases with:++- `option deprecated = true;` and a comment pointing at+ `QueryHistoryService` and the TBD removal;+- **no `google.api.http` bindings** — the REST routes are served solely by+ `QueryHistoryService`'s gateway registration, so the gateway mux never sees+ duplicate paths and the OpenAPI spec lists each REST operation once+ (operationIds become `QueryHistoryService_*`);+- `method_signature` dropped with the bindings (the+ `google/api/client.proto` import had no other users in this file);+- `bytebase.v1.permission` / `auth_method` annotations kept identical.++The six message definitions leave `sql_service.proto`; it imports+`v1/query_history_service.proto` for the alias signatures.++### 2. Backend++- `backend/api/v1/query_history_service.go`: `QueryHistoryService` struct+ (embeds `v1connect.UnimplementedQueryHistoryServiceHandler`, holds `store` —+ the only dependency the moved code uses), `NewQueryHistoryService(store)`.+ Moves wholesale from `sql_service.go`: `SearchQueryHistories`,+ `ListQueryHistories`, `GetQueryHistory`, `paginatedQueryHistories`,+ `resolveQueryHistoryParent`, plus `convertToV1QueryHistory` from+ `sql_service_converter.go` (stays a method — it needs the store for the+ creator lookup). `createQueryHistory` stays in `sql_service.go`.+- `SQLService` gains a `queryHistoryService *QueryHistoryService` field+ (constructed first, injected via `NewSQLService`) and keeps three one-line+ deprecated methods that delegate:+ `func (s *SQLService) SearchQueryHistories(ctx, req) { return s.queryHistoryService.SearchQueryHistories(ctx, req) }`+ — identical semantics by construction, no duplicated logic.+- Registration in `backend/server/grpc_routes.go` mirrors `ChangelogService`,+ four touchpoints: construct, Connect handler → `connectHandlers`, static+ reflector list, and `v1pb.RegisterQueryHistoryServiceHandler` for the+ gateway (sole server of the REST routes). The SQLService Connect handler+ continues to serve the alias method paths.++### 3. Frontend++- `queryHistoryServiceClientConnect` added in `frontend/src/api/index.ts`;+ the 3.21 bundle uses only the new service (aliases exist for *older* cached+ bundles, not for new code).+- Call sites repointed: `modules/sql-editor/store/queryHistory.ts`+ (search + get) and `components/WorkspaceSetupGuide.tsx` (search).+- Type imports repointed from `proto-es/v1/sql_service_pb` to+ `proto-es/v1/query_history_service_pb` across `utils/v1/queryHistory.ts`,+ the sql-editor store types/`HistoryPane`, and their tests.++### 4. Generated artifacts, MCP, and docs++- `buf generate` regenerates `backend/generated-go`,+ `frontend/src/types/proto-es`, `proto/gen/grpc-doc`, and+ `backend/api/mcp/gen/openapi.yaml`. The deprecated aliases carry+ `deprecated: true` in generated specs; `generate_openapi_index.js` already+ skips deprecated operations generically (built for exactly this case during+ the changelog work), so agents only see `QueryHistoryService`.+- The agent `serviceDirectory` in `frontend/src/modules/agent/logic/prompt.ts`+ gains a QueryHistoryService entry.+- Resource-pattern table in `docs/plans/saas/07.api-resource-patterns.md`+ updated: query histories move out of the "SQLService workspace-level+ utility" bucket (stale since #21064 anyway) into their own project-parented+ service entry.++## Compatibility (3.21)++| Surface | Impact |+|---|---|+| REST `POST /v1/projects/*/queryHistories:search`, `GET .../queryHistories[/*]` | None — identical paths, payloads, auth; served by QueryHistoryService's gateway registration |+| gRPC/Connect `bytebase.v1.SQLService/SearchQueryHistories`, `ListQueryHistories`, `GetQueryHistory` | **Kept — deprecated delegating proxies**, wire-identical behavior; removal in a future release, date TBD |+| Cached pre-3.21 frontend bundles during rolling upgrade | Keep working via the aliases (the motivating case) |+| Terraform provider, bytebase-action | Unaffected (REST-only / no query history usage) |+| IAM (`bb.queryHistories.list`), caller-scoping, resource names, page tokens | Unchanged |+| Published OpenAPI operationIds | `SQLService_*` → `QueryHistoryService_*` for the REST operations — SDK regen concern only; paths unchanged |+| Audit log | No change — none of the three RPCs carry `audit = true` |++Not a breaking release: nothing is removed in 3.21. `buf breaking` (FILE+rules) still flags the message moves between files and the dropped HTTP+options on the aliases; no CI job enforces it, and the wire surface is+compatible. The breaking label belongs to the future alias-removal release.++## Rollout++- **3.21**: ship extraction + aliases; release notes announce the+ deprecation and point gRPC/Connect callers at+ `bytebase.v1.QueryHistoryService` (REST users need no changes).+- **Future release (TBD)**: remove the aliases with `--label breaking`,+ mirroring the ChangelogService removal notes.++## Testing++- E2E: `backend/tests/query_history_test.go` migrates to a new+ `queryHistoryServiceClient` wired in `tests.go`; it already covers all three+ RPCs, IAM gating, wildcard-parent behavior, and existence hiding. Added+ alias assertions pin the delegation: the deprecated+ `sqlServiceClient.SearchQueryHistories` / `GetQueryHistory` /+ `ListQueryHistories` return the same results as the new client until the+ aliases are removed.+- Frontend: sql-editor store tests mock the new client; full suite green.+- Standard gates: `buf format/lint`, `golangci-lint`, `go build`, targeted+ e2e, `pnpm fix/check/type-check/test`.++## Alternatives considered++1. **Clean cut, no aliases (the ChangelogService choice)** — rejected here:+ unlike changelogs, query history has a hot browser-side Connect caller+ (the SQL Editor History pane), so removal without a transition window+ breaks cached bundles mid-upgrade. Decision 2026-07-29 (Danny).+2. **Aliases with duplicated HTTP bindings on both services** — rejected:+ duplicate gateway routes make the serving handler registration-order+ dependent and double every REST operation in generated specs.+3. **Runtime route rewrite instead of proto aliases** — rejected for the same+ reasons as in the changelog design: per-protocol plumbing, invisible in+ generated docs/SDKs, more code than the thing it replaces.+4. **Deprecated delegating proxies, REST on the new service only (chosen)** —+ smallest transition shim, wire-identical by construction, visible as+ deprecated in every generated artifact, and removable in one future PR.diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.tsindex a2b9569d7b..f3051164cc 100644--- a/frontend/src/api/index.ts+++ b/frontend/src/api/index.ts@@ -18,6 +18,7 @@ import { IssueService } from "@/types/proto-es/v1/issue_service_pb";import { OrgPolicyService } from "@/types/proto-es/v1/org_policy_service_pb";import { PlanService } from "@/types/proto-es/v1/plan_service_pb";import { ProjectService } from "@/types/proto-es/v1/project_service_pb";+import { QueryHistoryService } from "@/types/proto-es/v1/query_history_service_pb";import { ReleaseService } from "@/types/proto-es/v1/release_service_pb";import { ReviewConfigService } from "@/types/proto-es/v1/review_config_service_pb";import { RevisionService } from "@/types/proto-es/v1/revision_service_pb";@@ -165,6 +166,11 @@ export const worksheetServiceClientConnect = createClient(export const sqlServiceClientConnect = createClient(SQLService, transport);+export const queryHistoryServiceClientConnect = createClient(+ QueryHistoryService,+ transport+);+export const planServiceClientConnect = createClient(PlanService, transport);export const projectServiceClientConnect = createClient(diff --git a/frontend/src/components/WorkspaceSetupGuide.test.tsx b/frontend/src/components/WorkspaceSetupGuide.test.tsxindex d4376f7e40..88b2e09a30 100644--- a/frontend/src/components/WorkspaceSetupGuide.test.tsx+++ b/frontend/src/components/WorkspaceSetupGuide.test.tsx@@ -125,7 +125,7 @@ vi.mock("@/stores/app", () => {});vi.mock("@/api", () => ({- sqlServiceClientConnect: {+ queryHistoryServiceClientConnect: {searchQueryHistories: mocks.searchQueryHistories,},}));diff --git a/frontend/src/components/WorkspaceSetupGuide.tsx b/frontend/src/components/WorkspaceSetupGuide.tsxindex 98456556ea..55595661ee 100644--- a/frontend/src/components/WorkspaceSetupGuide.tsx+++ b/frontend/src/components/WorkspaceSetupGuide.tsx@@ -2,7 +2,7 @@ import { create } from "@bufbuild/protobuf";import { CheckCircle, Circle, X } from "lucide-react";import { useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";-import { sqlServiceClientConnect } from "@/api";+import { queryHistoryServiceClientConnect } from "@/api";import { createBehaviorMetric } from "@/app/analytics/behavior";import { behaviorAnalytics } from "@/app/analytics/provider";import { type RouteTarget, router, useCurrentRoute } from "@/app/router";@@ -29,7 +29,7 @@ import {} from "@/lib/productIntro";import { cn } from "@/lib/utils";import { useAppStore } from "@/stores/app";-import { SearchQueryHistoriesRequestSchema } from "@/types/proto-es/v1/sql_service_pb";+import { SearchQueryHistoriesRequestSchema } from "@/types/proto-es/v1/query_history_service_pb";import {extractDatabaseResourceName,extractProjectResourceName,@@ -191,7 +191,7 @@ export function WorkspaceSetupGuide() {// requires (it has no cross-project wildcard).try {const queryHistoryResult =- await sqlServiceClientConnect.searchQueryHistories(+ await queryHistoryServiceClientConnect.searchQueryHistories(create(SearchQueryHistoriesRequestSchema, {parent: projectName,pageSize: 1,diff --git a/frontend/src/modules/agent/logic/prompt.ts b/frontend/src/modules/agent/logic/prompt.tsindex 4d698c6567..bc47e021f7 100644--- a/frontend/src/modules/agent/logic/prompt.ts+++ b/frontend/src/modules/agent/logic/prompt.ts@@ -7,6 +7,7 @@ Database Management:SQL & Queries:- SQLService: execute SQL queries, export query results, SQL check/lint, parse SQL, differencing+- QueryHistoryService: query/export history records of SQL Editor sessions- SheetService: internal saved SQL sheets (system use)- WorksheetService: user-facing saved SQL worksheetsdiff --git a/frontend/src/modules/sql-editor/components/HistoryPane.tsx b/frontend/src/modules/sql-editor/components/HistoryPane.tsxindex d96a978112..afe99eb8ff 100644--- a/frontend/src/modules/sql-editor/components/HistoryPane.tsx+++ b/frontend/src/modules/sql-editor/components/HistoryPane.tsx@@ -28,7 +28,7 @@ import {} from "@/modules/sql-editor/store/tab";import { useAppStore } from "@/stores/app";import { DEBOUNCE_SEARCH_DELAY, getDateForPbTimestampProtoEs } from "@/types";-import type { QueryHistory } from "@/types/proto-es/v1/sql_service_pb";+import type { QueryHistory } from "@/types/proto-es/v1/query_history_service_pb";import { extractProjectResourceName, extractQueryHistoryUID } from "@/utils";import { HistorySearchInput } from "./HistorySearchInput";diff --git a/frontend/src/modules/sql-editor/store/queryHistory.test.ts b/frontend/src/modules/sql-editor/store/queryHistory.test.tsindex 795fb26ac8..8bee484c90 100644--- a/frontend/src/modules/sql-editor/store/queryHistory.test.ts+++ b/frontend/src/modules/sql-editor/store/queryHistory.test.ts@@ -19,7 +19,7 @@ const searchQueryHistoriesMock = vi.fn();// Stub the connect client so the slice's `mergeLatest` /// `fetchQueryHistoryList` calls hit a deterministic in-memory fake.vi.mock("@/api", () => ({- sqlServiceClientConnect: {+ queryHistoryServiceClientConnect: {searchQueryHistories: (...args: unknown[]) =>searchQueryHistoriesMock(...args),},diff --git a/frontend/src/modules/sql-editor/store/queryHistory.ts b/frontend/src/modules/sql-editor/store/queryHistory.tsindex f4c9ea4879..a44d998eca 100644--- a/frontend/src/modules/sql-editor/store/queryHistory.ts+++ b/frontend/src/modules/sql-editor/store/queryHistory.ts@@ -1,11 +1,11 @@import { create } from "@bufbuild/protobuf";-import { sqlServiceClientConnect } from "@/api";-import type { QueryHistory } from "@/types/proto-es/v1/sql_service_pb";+import { queryHistoryServiceClientConnect } from "@/api";+import type { QueryHistory } from "@/types/proto-es/v1/query_history_service_pb";import {GetQueryHistoryRequestSchema,SearchQueryHistoriesRequestSchema,SearchQueryHistoriesResponseSchema,-} from "@/types/proto-es/v1/sql_service_pb";+} from "@/types/proto-es/v1/query_history_service_pb";import { isValidDatabaseName } from "@/types/v1/database";import { isValidProjectName } from "@/types/v1/project";import { escapeCELStringLiteral } from "@/utils/v1/cel";@@ -68,7 +68,8 @@ export const createQueryHistorySlice: SQLEditorSliceCreator<pageToken,filter: getListQueryHistoryFilter(filter),});- const resp = await sqlServiceClientConnect.searchQueryHistories(request);+ const resp =+ await queryHistoryServiceClientConnect.searchQueryHistories(request);set((s) => {const prev = s.queryHistoryByKey[key] ?? EMPTY_ENTRY;@@ -121,7 +122,7 @@ export const createQueryHistorySlice: SQLEditorSliceCreator<return EMPTY_RESPONSE;}const key = getQueryHistoryCacheKey(filter);- const resp = await sqlServiceClientConnect.searchQueryHistories(+ const resp = await queryHistoryServiceClientConnect.searchQueryHistories(create(SearchQueryHistoriesRequestSchema, {parent: filter.project,pageSize: 5,@@ -150,7 +151,7 @@ export const createQueryHistorySlice: SQLEditorSliceCreator<},fetchQueryHistory: async (name) => {- return await sqlServiceClientConnect.getQueryHistory(+ return await queryHistoryServiceClientConnect.getQueryHistory(create(GetQueryHistoryRequestSchema, { name }));},diff --git a/frontend/src/modules/sql-editor/store/types.ts b/frontend/src/modules/sql-editor/store/types.tsindex f8e9e8924a..5d451f0bd8 100644--- a/frontend/src/modules/sql-editor/store/types.ts+++ b/frontend/src/modules/sql-editor/store/types.ts@@ -10,7 +10,7 @@ import type {import type {QueryHistory,SearchQueryHistoriesResponse,-} from "@/types/proto-es/v1/sql_service_pb";+} from "@/types/proto-es/v1/query_history_service_pb";export type AsidePanelTab = "SCHEMA" | "WORKSHEET" | "HISTORY" | "ACCESS";diff --git a/frontend/src/types/proto-es/v1/query_history_service_pb.d.ts b/frontend/src/types/proto-es/v1/query_history_service_pb.d.tsnew file mode 100644index 0000000000..e7e539d94b--- /dev/null+++ b/frontend/src/types/proto-es/v1/query_history_service_pb.d.ts@@ -0,0 +1,332 @@+// @generated by protoc-gen-es v2.12.0+// @generated from file v1/query_history_service.proto (package bytebase.v1, syntax proto3)+/* eslint-disable */++import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";+import type { Message } from "@bufbuild/protobuf";+import type { Duration, Timestamp } from "@bufbuild/protobuf/wkt";++/**+ * Describes the file v1/query_history_service.proto.+ */+export declare const file_v1_query_history_service: GenFile;++/**+ * @generated from message bytebase.v1.SearchQueryHistoriesRequest+ */+export declare type SearchQueryHistoriesRequest = Message<"bytebase.v1.SearchQueryHistoriesRequest"> & {+ /**+ * The parent project to search query histories in.+ * Format: projects/{project}+ * The AIP-159 wildcard "projects/-" is not supported; use+ * ListQueryHistories for cross-project reads.+ *+ * @generated from field: string parent = 4;+ */+ parent: string;++ /**+ * The maximum number of histories to return.+ * The service may return fewer than this value.+ * If unspecified, at most 10 history entries will be returned.+ * The maximum value is 1000; values above 1000 will be coerced to 1000.+ *+ * @generated from field: int32 page_size = 1;+ */+ pageSize: number;++ /**+ * A page token, received from a previous `ListQueryHistory` call.+ * Provide this to retrieve the subsequent page.+ *+ * @generated from field: string page_token = 2;+ */+ pageToken: string;++ /**+ * Filter is the filter to apply on the search query history+ * The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+ *+ * Supported filter:+ * - project: the project full name in "projects/{id}" format, support "==" operator.+ * - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.+ * - instance: the instance full name in "instances/{id}" format, support "==" operator.+ * - type: the type, should be "QUERY" or "EXPORT", support "==" operator.+ * - statement: the SQL statement, support ".contains()" operator.+ *+ * For example:+ * project == "projects/{project}"+ * database == "instances/{instance}/databases/{database}"+ * instance == "instances/{instance}"+ * type == "QUERY"+ * type == "EXPORT"+ * statement.contains("select")+ * type == "QUERY" && statement.contains("select")+ *+ * @generated from field: string filter = 3;+ */+ filter: string;+};++/**+ * Describes the message bytebase.v1.SearchQueryHistoriesRequest.+ * Use `create(SearchQueryHistoriesRequestSchema)` to create a new message.+ */+export declare const SearchQueryHistoriesRequestSchema: GenMessage<SearchQueryHistoriesRequest>;++/**+ * @generated from message bytebase.v1.SearchQueryHistoriesResponse+ */+export declare type SearchQueryHistoriesResponse = Message<"bytebase.v1.SearchQueryHistoriesResponse"> & {+ /**+ * The list of history.+ *+ * @generated from field: repeated bytebase.v1.QueryHistory query_histories = 1;+ */+ queryHistories: QueryHistory[];++ /**+ * A token to retrieve next page of history.+ * Pass this value in the page_token field in the subsequent call to+ * `ListQueryHistory` method to retrieve the next page of history.+ *+ * @generated from field: string next_page_token = 2;+ */+ nextPageToken: string;+};++/**+ * Describes the message bytebase.v1.SearchQueryHistoriesResponse.+ * Use `create(SearchQueryHistoriesResponseSchema)` to create a new message.+ */+export declare const SearchQueryHistoriesResponseSchema: GenMessage<SearchQueryHistoriesResponse>;++/**+ * @generated from message bytebase.v1.ListQueryHistoriesRequest+ */+export declare type ListQueryHistoriesRequest = Message<"bytebase.v1.ListQueryHistoriesRequest"> & {+ /**+ * The parent project whose query histories are listed.+ * Format: projects/{project}+ * Use "projects/-" to list query histories across all projects+ * (https://google.aip.dev/159); this requires the bb.queryHistories.list+ * permission on the workspace.+ *+ * @generated from field: string parent = 1;+ */+ parent: string;++ /**+ * The maximum number of histories to return.+ * The service may return fewer than this value.+ * If unspecified, at most 10 history entries will be returned.+ * The maximum value is 1000; values above 1000 will be coerced to 1000.+ *+ * @generated from field: int32 page_size = 2;+ */+ pageSize: number;++ /**+ * A page token, received from a previous `ListQueryHistories` call.+ * Provide this to retrieve the subsequent page.+ *+ * @generated from field: string page_token = 3;+ */+ pageToken: string;++ /**+ * Filter is the filter to apply on the list query histories.+ * The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+ *+ * Supported filter:+ * - creator: the user full name in "users/{email}" format, support "==" operator.+ *+ * For example:+ * creator == "users/{email}"+ *+ * @generated from field: string filter = 4;+ */+ filter: string;+};++/**+ * Describes the message bytebase.v1.ListQueryHistoriesRequest.+ * Use `create(ListQueryHistoriesRequestSchema)` to create a new message.+ */+export declare const ListQueryHistoriesRequestSchema: GenMessage<ListQueryHistoriesRequest>;++/**+ * @generated from message bytebase.v1.ListQueryHistoriesResponse+ */+export declare type ListQueryHistoriesResponse = Message<"bytebase.v1.ListQueryHistoriesResponse"> & {+ /**+ * The list of query histories.+ *+ * @generated from field: repeated bytebase.v1.QueryHistory query_histories = 1;+ */+ queryHistories: QueryHistory[];++ /**+ * A token to retrieve next page of history.+ * Pass this value in the page_token field in the subsequent call to+ * `ListQueryHistories` method to retrieve the next page of history.+ *+ * @generated from field: string next_page_token = 2;+ */+ nextPageToken: string;+};++/**+ * Describes the message bytebase.v1.ListQueryHistoriesResponse.+ * Use `create(ListQueryHistoriesResponseSchema)` to create a new message.+ */+export declare const ListQueryHistoriesResponseSchema: GenMessage<ListQueryHistoriesResponse>;++/**+ * @generated from message bytebase.v1.GetQueryHistoryRequest+ */+export declare type GetQueryHistoryRequest = Message<"bytebase.v1.GetQueryHistoryRequest"> & {+ /**+ * The name of the query history to retrieve.+ * Format: projects/{project}/queryHistories/{id}+ *+ * @generated from field: string name = 1;+ */+ name: string;+};++/**+ * Describes the message bytebase.v1.GetQueryHistoryRequest.+ * Use `create(GetQueryHistoryRequestSchema)` to create a new message.+ */+export declare const GetQueryHistoryRequestSchema: GenMessage<GetQueryHistoryRequest>;++/**+ * @generated from message bytebase.v1.QueryHistory+ */+export declare type QueryHistory = Message<"bytebase.v1.QueryHistory"> & {+ /**+ * The name for the query history.+ * Format: projects/{project}/queryHistories/{id}+ *+ * @generated from field: string name = 1;+ */+ name: string;++ /**+ * The database name to execute the query.+ * Format: instances/{instance}/databases/{databaseName}+ *+ * @generated from field: string database = 2;+ */+ database: string;++ /**+ * @generated from field: string creator = 3;+ */+ creator: string;++ /**+ * @generated from field: google.protobuf.Timestamp create_time = 4;+ */+ createTime?: Timestamp | undefined;++ /**+ * @generated from field: string statement = 5;+ */+ statement: string;++ /**+ * @generated from field: optional string error = 6;+ */+ error?: string | undefined;++ /**+ * @generated from field: google.protobuf.Duration duration = 7;+ */+ duration?: Duration | undefined;++ /**+ * @generated from field: bytebase.v1.QueryHistory.Type type = 8;+ */+ type: QueryHistory_Type;+};++/**+ * Describes the message bytebase.v1.QueryHistory.+ * Use `create(QueryHistorySchema)` to create a new message.+ */+export declare const QueryHistorySchema: GenMessage<QueryHistory>;++/**+ * @generated from enum bytebase.v1.QueryHistory.Type+ */+export enum QueryHistory_Type {+ /**+ * Unspecified query history type.+ *+ * @generated from enum value: TYPE_UNSPECIFIED = 0;+ */+ TYPE_UNSPECIFIED = 0,++ /**+ * Query execution for data retrieval.+ *+ * @generated from enum value: QUERY = 1;+ */+ QUERY = 1,++ /**+ * Data export operation to file.+ *+ * @generated from enum value: EXPORT = 2;+ */+ EXPORT = 2,+}++/**+ * Describes the enum bytebase.v1.QueryHistory.Type.+ */+export declare const QueryHistory_TypeSchema: GenEnum<QueryHistory_Type>;++/**+ * QueryHistoryService manages query history records of SQL Editor queries and exports.+ *+ * @generated from service bytebase.v1.QueryHistoryService+ */+export declare const QueryHistoryService: GenService<{+ /**+ * SearchQueryHistories searches query histories for the caller.+ * Permissions required: None (only returns caller's own query histories)+ *+ * @generated from rpc bytebase.v1.QueryHistoryService.SearchQueryHistories+ */+ searchQueryHistories: {+ methodKind: "unary";+ input: typeof SearchQueryHistoriesRequestSchema;+ output: typeof SearchQueryHistoriesResponseSchema;+ },+ /**+ * ListQueryHistories lists query histories of all users in a project.+ * Permissions required: bb.queryHistories.list+ *+ * @generated from rpc bytebase.v1.QueryHistoryService.ListQueryHistories+ */+ listQueryHistories: {+ methodKind: "unary";+ input: typeof ListQueryHistoriesRequestSchema;+ output: typeof ListQueryHistoriesResponseSchema;+ },+ /**+ * GetQueryHistory gets a single query history for the caller.+ * Permissions required: None (only returns the caller's own query history)+ *+ * @generated from rpc bytebase.v1.QueryHistoryService.GetQueryHistory+ */+ getQueryHistory: {+ methodKind: "unary";+ input: typeof GetQueryHistoryRequestSchema;+ output: typeof QueryHistorySchema;+ },+}>;+diff --git a/frontend/src/types/proto-es/v1/query_history_service_pb.js b/frontend/src/types/proto-es/v1/query_history_service_pb.jsnew file mode 100644index 0000000000..224be62736--- /dev/null+++ b/frontend/src/types/proto-es/v1/query_history_service_pb.js@@ -0,0 +1,80 @@+// @generated by protoc-gen-es v2.12.0+// @generated from file v1/query_history_service.proto (package bytebase.v1, syntax proto3)+/* eslint-disable */++import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";+import { file_google_api_annotations } from "../google/api/annotations_pb";+import { file_google_api_client } from "../google/api/client_pb";+import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";+import { file_google_api_resource } from "../google/api/resource_pb";+import { file_google_protobuf_duration, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";+import { file_v1_annotation } from "./annotation_pb";++/**+ * Describes the file v1/query_history_service.proto.+ */+export const file_v1_query_history_service = /*@__PURE__*/+ fileDesc("Ch52MS9xdWVyeV9oaXN0b3J5X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxImkKG1NlYXJjaFF1ZXJ5SGlzdG9yaWVzUmVxdWVzdBITCgZwYXJlbnQYBCABKAlCA+BBAhIRCglwYWdlX3NpemUYASABKAUSEgoKcGFnZV90b2tlbhgCIAEoCRIOCgZmaWx0ZXIYAyABKAkicAocU2VhcmNoUXVlcnlIaXN0b3JpZXNSZXNwb25zZRI3Cg9xdWVyeV9oaXN0b3JpZXMYASADKAsyGS5ieXRlYmFzZS52MS5RdWVyeUhpc3RvcnlCA+BBAxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkigAEKGUxpc3RRdWVyeUhpc3Rvcmllc1JlcXVlc3QSLAoGcGFyZW50GAEgASgJQhzgQQL6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EhEKCXBhZ2Vfc2l6ZRgCIAEoBRISCgpwYWdlX3Rva2VuGAMgASgJEg4KBmZpbHRlchgEIAEoCSJuChpMaXN0UXVlcnlIaXN0b3JpZXNSZXNwb25zZRI3Cg9xdWVyeV9oaXN0b3JpZXMYASADKAsyGS5ieXRlYmFzZS52MS5RdWVyeUhpc3RvcnlCA+BBAxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiKwoWR2V0UXVlcnlIaXN0b3J5UmVxdWVzdBIRCgRuYW1lGAEgASgJQgPgQQIi1AIKDFF1ZXJ5SGlzdG9yeRIRCgRuYW1lGAEgASgJQgPgQQMSFQoIZGF0YWJhc2UYAiABKAlCA+BBAxIUCgdjcmVhdG9yGAMgASgJQgPgQQMSNAoLY3JlYXRlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSFgoJc3RhdGVtZW50GAUgASgJQgPgQQMSFwoFZXJyb3IYBiABKAlCA+BBA0gAiAEBEjAKCGR1cmF0aW9uGAcgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uQgPgQQMSLAoEdHlwZRgIIAEoDjIeLmJ5dGViYXNlLnYxLlF1ZXJ5SGlzdG9yeS5UeXBlIjMKBFR5cGUSFAoQVFlQRV9VTlNQRUNJRklFRBAAEgkKBVFVRVJZEAESCgoGRVhQT1JUEAJCCAoGX2Vycm9yMpEEChNRdWVyeUhpc3RvcnlTZXJ2aWNlErIBChRTZWFyY2hRdWVyeUhpc3RvcmllcxIoLmJ5dGViYXNlLnYxLlNlYXJjaFF1ZXJ5SGlzdG9yaWVzUmVxdWVzdBopLmJ5dGViYXNlLnYxLlNlYXJjaFF1ZXJ5SGlzdG9yaWVzUmVzcG9uc2UiRdpBBnBhcmVudJDqMAKC0+STAjI6ASoiLS92MS97cGFyZW50PXByb2plY3RzLyp9L3F1ZXJ5SGlzdG9yaWVzOnNlYXJjaBK8AQoSTGlzdFF1ZXJ5SGlzdG9yaWVzEiYuYnl0ZWJhc2UudjEuTGlzdFF1ZXJ5SGlzdG9yaWVzUmVxdWVzdBonLmJ5dGViYXNlLnYxLkxpc3RRdWVyeUhpc3Rvcmllc1Jlc3BvbnNlIlXaQQZwYXJlbnSK6jAWYmIucXVlcnlIaXN0b3JpZXMubGlzdJDqMAGC0+STAigSJi92MS97cGFyZW50PXByb2plY3RzLyp9L3F1ZXJ5SGlzdG9yaWVzEoUBCg9HZXRRdWVyeUhpc3RvcnkSIy5ieXRlYmFzZS52MS5HZXRRdWVyeUhpc3RvcnlSZXF1ZXN0GhkuYnl0ZWJhc2UudjEuUXVlcnlIaXN0b3J5IjKQ6jACgtPkkwIoEiYvdjEve25hbWU9cHJvamVjdHMvKi9xdWVyeUhpc3Rvcmllcy8qfUKuAQoPY29tLmJ5dGViYXNlLnYxQhhRdWVyeUhpc3RvcnlTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_timestamp, file_v1_annotation]);++/**+ * Describes the message bytebase.v1.SearchQueryHistoriesRequest.+ * Use `create(SearchQueryHistoriesRequestSchema)` to create a new message.+ */+export const SearchQueryHistoriesRequestSchema = /*@__PURE__*/+ messageDesc(file_v1_query_history_service, 0);++/**+ * Describes the message bytebase.v1.SearchQueryHistoriesResponse.+ * Use `create(SearchQueryHistoriesResponseSchema)` to create a new message.+ */+export const SearchQueryHistoriesResponseSchema = /*@__PURE__*/+ messageDesc(file_v1_query_history_service, 1);++/**+ * Describes the message bytebase.v1.ListQueryHistoriesRequest.+ * Use `create(ListQueryHistoriesRequestSchema)` to create a new message.+ */+export const ListQueryHistoriesRequestSchema = /*@__PURE__*/+ messageDesc(file_v1_query_history_service, 2);++/**+ * Describes the message bytebase.v1.ListQueryHistoriesResponse.+ * Use `create(ListQueryHistoriesResponseSchema)` to create a new message.+ */+export const ListQueryHistoriesResponseSchema = /*@__PURE__*/+ messageDesc(file_v1_query_history_service, 3);++/**+ * Describes the message bytebase.v1.GetQueryHistoryRequest.+ * Use `create(GetQueryHistoryRequestSchema)` to create a new message.+ */+export const GetQueryHistoryRequestSchema = /*@__PURE__*/+ messageDesc(file_v1_query_history_service, 4);++/**+ * Describes the message bytebase.v1.QueryHistory.+ * Use `create(QueryHistorySchema)` to create a new message.+ */+export const QueryHistorySchema = /*@__PURE__*/+ messageDesc(file_v1_query_history_service, 5);++/**+ * Describes the enum bytebase.v1.QueryHistory.Type.+ */+export const QueryHistory_TypeSchema = /*@__PURE__*/+ enumDesc(file_v1_query_history_service, 5, 0);++/**+ * @generated from enum bytebase.v1.QueryHistory.Type+ */+export const QueryHistory_Type = /*@__PURE__*/+ tsEnum(QueryHistory_TypeSchema);++/**+ * QueryHistoryService manages query history records of SQL Editor queries and exports.+ *+ * @generated from service bytebase.v1.QueryHistoryService+ */+export const QueryHistoryService = /*@__PURE__*/+ serviceDesc(file_v1_query_history_service, 0);+diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts b/frontend/src/types/proto-es/v1/sql_service_pb.d.tsindex c9342c3d69..dd3ceda67d 100644--- a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts@@ -7,6 +7,7 @@ import type { Message } from "@bufbuild/protobuf";import type { Duration, NullValue, Timestamp, Value } from "@bufbuild/protobuf/wkt";import type { Engine, ExportFormat, PermissionDeniedDetail, Position } from "./common_pb";import type { DatabaseMetadata } from "./database_service_pb";+import type { GetQueryHistoryRequestSchema, ListQueryHistoriesRequestSchema, ListQueryHistoriesResponseSchema, QueryHistorySchema, SearchQueryHistoriesRequestSchema, SearchQueryHistoriesResponseSchema } from "./query_history_service_pb";/*** Describes the file v1/sql_service.proto.@@ -1148,284 +1149,6 @@ export declare type DiffMetadataResponse = Message<"bytebase.v1.DiffMetadataResp*/export declare const DiffMetadataResponseSchema: GenMessage<DiffMetadataResponse>;-/**- * @generated from message bytebase.v1.SearchQueryHistoriesRequest- */-export declare type SearchQueryHistoriesRequest = Message<"bytebase.v1.SearchQueryHistoriesRequest"> & {- /**- * The parent project to search query histories in.- * Format: projects/{project}- * The AIP-159 wildcard "projects/-" is not supported; use- * ListQueryHistories for cross-project reads.- *- * @generated from field: string parent = 4;- */- parent: string;-- /**- * The maximum number of histories to return.- * The service may return fewer than this value.- * If unspecified, at most 10 history entries will be returned.- * The maximum value is 1000; values above 1000 will be coerced to 1000.- *- * @generated from field: int32 page_size = 1;- */- pageSize: number;-- /**- * A page token, received from a previous `ListQueryHistory` call.- * Provide this to retrieve the subsequent page.- *- * @generated from field: string page_token = 2;- */- pageToken: string;-- /**- * Filter is the filter to apply on the search query history- * The syntax and semantics of CEL are documented at https://github.com/google/cel-spec- *- * Supported filter:- * - project: the project full name in "projects/{id}" format, support "==" operator.- * - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.- * - instance: the instance full name in "instances/{id}" format, support "==" operator.- * - type: the type, should be "QUERY" or "EXPORT", support "==" operator.- * - statement: the SQL statement, support ".contains()" operator.- *- * For example:- * project == "projects/{project}"- * database == "instances/{instance}/databases/{database}"- * instance == "instances/{instance}"- * type == "QUERY"- * type == "EXPORT"- * statement.contains("select")- * type == "QUERY" && statement.contains("select")- *- * @generated from field: string filter = 3;- */- filter: string;-};--/**- * Describes the message bytebase.v1.SearchQueryHistoriesRequest.- * Use `create(SearchQueryHistoriesRequestSchema)` to create a new message.- */-export declare const SearchQueryHistoriesRequestSchema: GenMessage<SearchQueryHistoriesRequest>;--/**- * @generated from message bytebase.v1.ListQueryHistoriesRequest- */-export declare type ListQueryHistoriesRequest = Message<"bytebase.v1.ListQueryHistoriesRequest"> & {- /**- * The parent project whose query histories are listed.- * Format: projects/{project}- * Use "projects/-" to list query histories across all projects- * (https://google.aip.dev/159); this requires the bb.queryHistories.list- * permission on the workspace.- *- * @generated from field: string parent = 1;- */- parent: string;-- /**- * The maximum number of histories to return.- * The service may return fewer than this value.- * If unspecified, at most 10 history entries will be returned.- * The maximum value is 1000; values above 1000 will be coerced to 1000.- *- * @generated from field: int32 page_size = 2;- */- pageSize: number;-- /**- * A page token, received from a previous `ListQueryHistories` call.- * Provide this to retrieve the subsequent page.- *- * @generated from field: string page_token = 3;- */- pageToken: string;-- /**- * Filter is the filter to apply on the list query histories.- * The syntax and semantics of CEL are documented at https://github.com/google/cel-spec- *- * Supported filter:- * - creator: the user full name in "users/{email}" format, support "==" operator.- *- * For example:- * creator == "users/{email}"- *- * @generated from field: string filter = 4;- */- filter: string;-};--/**- * Describes the message bytebase.v1.ListQueryHistoriesRequest.- * Use `create(ListQueryHistoriesRequestSchema)` to create a new message.- */-export declare const ListQueryHistoriesRequestSchema: GenMessage<ListQueryHistoriesRequest>;--/**- * @generated from message bytebase.v1.ListQueryHistoriesResponse- */-export declare type ListQueryHistoriesResponse = Message<"bytebase.v1.ListQueryHistoriesResponse"> & {- /**- * The list of query histories.- *- * @generated from field: repeated bytebase.v1.QueryHistory query_histories = 1;- */- queryHistories: QueryHistory[];-- /**- * A token to retrieve next page of history.- * Pass this value in the page_token field in the subsequent call to- * `ListQueryHistories` method to retrieve the next page of history.- *- * @generated from field: string next_page_token = 2;- */- nextPageToken: string;-};--/**- * Describes the message bytebase.v1.ListQueryHistoriesResponse.- * Use `create(ListQueryHistoriesResponseSchema)` to create a new message.- */-export declare const ListQueryHistoriesResponseSchema: GenMessage<ListQueryHistoriesResponse>;--/**- * @generated from message bytebase.v1.GetQueryHistoryRequest- */-export declare type GetQueryHistoryRequest = Message<"bytebase.v1.GetQueryHistoryRequest"> & {- /**- * The name of the query history to retrieve.- * Format: projects/{project}/queryHistories/{id}- *- * @generated from field: string name = 1;- */- name: string;-};--/**- * Describes the message bytebase.v1.GetQueryHistoryRequest.- * Use `create(GetQueryHistoryRequestSchema)` to create a new message.- */-export declare const GetQueryHistoryRequestSchema: GenMessage<GetQueryHistoryRequest>;--/**- * @generated from message bytebase.v1.SearchQueryHistoriesResponse- */-export declare type SearchQueryHistoriesResponse = Message<"bytebase.v1.SearchQueryHistoriesResponse"> & {- /**- * The list of history.- *- * @generated from field: repeated bytebase.v1.QueryHistory query_histories = 1;- */- queryHistories: QueryHistory[];-- /**- * A token to retrieve next page of history.- * Pass this value in the page_token field in the subsequent call to- * `ListQueryHistory` method to retrieve the next page of history.- *- * @generated from field: string next_page_token = 2;- */- nextPageToken: string;-};--/**- * Describes the message bytebase.v1.SearchQueryHistoriesResponse.- * Use `create(SearchQueryHistoriesResponseSchema)` to create a new message.- */-export declare const SearchQueryHistoriesResponseSchema: GenMessage<SearchQueryHistoriesResponse>;--/**- * @generated from message bytebase.v1.QueryHistory- */-export declare type QueryHistory = Message<"bytebase.v1.QueryHistory"> & {- /**- * The name for the query history.- * Format: projects/{project}/queryHistories/{id}- *- * @generated from field: string name = 1;- */- name: string;-- /**- * The database name to execute the query.- * Format: instances/{instance}/databases/{databaseName}- *- * @generated from field: string database = 2;- */- database: string;-- /**- * @generated from field: string creator = 3;- */- creator: string;-- /**- * @generated from field: google.protobuf.Timestamp create_time = 4;- */- createTime?: Timestamp | undefined;-- /**- * @generated from field: string statement = 5;- */- statement: string;-- /**- * @generated from field: optional string error = 6;- */- error?: string | undefined;-- /**- * @generated from field: google.protobuf.Duration duration = 7;- */- duration?: Duration | undefined;-- /**- * @generated from field: bytebase.v1.QueryHistory.Type type = 8;- */- type: QueryHistory_Type;-};--/**- * Describes the message bytebase.v1.QueryHistory.- * Use `create(QueryHistorySchema)` to create a new message.- */-export declare const QueryHistorySchema: GenMessage<QueryHistory>;--/**- * @generated from enum bytebase.v1.QueryHistory.Type- */-export enum QueryHistory_Type {- /**- * Unspecified query history type.- *- * @generated from enum value: TYPE_UNSPECIFIED = 0;- */- TYPE_UNSPECIFIED = 0,-- /**- * Query execution for data retrieval.- *- * @generated from enum value: QUERY = 1;- */- QUERY = 1,-- /**- * Data export operation to file.- *- * @generated from enum value: EXPORT = 2;- */- EXPORT = 2,-}--/**- * Describes the enum bytebase.v1.QueryHistory.Type.- */-export declare const QueryHistory_TypeSchema: GenEnum<QueryHistory_Type>;-/*** @generated from message bytebase.v1.AICompletionRequest*/@@ -1561,10 +1284,13 @@ export declare const SQLService: GenService<{output: typeof AdminExecuteResponseSchema;},/**- * SearchQueryHistories searches query histories for the caller.+ * Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ * Delegating alias kept for upgrade transition; will be removed in a future release.+ * No HTTP binding: the REST route is served by QueryHistoryService.* Permissions required: None (only returns caller's own query histories)** @generated from rpc bytebase.v1.SQLService.SearchQueryHistories+ * @deprecated*/searchQueryHistories: {methodKind: "unary";@@ -1572,10 +1298,13 @@ export declare const SQLService: GenService<{output: typeof SearchQueryHistoriesResponseSchema;},/**- * ListQueryHistories lists query histories of all users in a project.+ * Deprecated: use QueryHistoryService.ListQueryHistories instead.+ * Delegating alias kept for upgrade transition; will be removed in a future release.+ * No HTTP binding: the REST route is served by QueryHistoryService.* Permissions required: bb.queryHistories.list** @generated from rpc bytebase.v1.SQLService.ListQueryHistories+ * @deprecated*/listQueryHistories: {methodKind: "unary";@@ -1583,10 +1312,13 @@ export declare const SQLService: GenService<{output: typeof ListQueryHistoriesResponseSchema;},/**- * GetQueryHistory gets a single query history for the caller.+ * Deprecated: use QueryHistoryService.GetQueryHistory instead.+ * Delegating alias kept for upgrade transition; will be removed in a future release.+ * No HTTP binding: the REST route is served by QueryHistoryService.* Permissions required: None (only returns the caller's own query history)** @generated from rpc bytebase.v1.SQLService.GetQueryHistory+ * @deprecated*/getQueryHistory: {methodKind: "unary";diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.js b/frontend/src/types/proto-es/v1/sql_service_pb.jsindex 3e223f93a8..f765f5dae0 100644--- a/frontend/src/types/proto-es/v1/sql_service_pb.js+++ b/frontend/src/types/proto-es/v1/sql_service_pb.js@@ -4,19 +4,19 @@import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";import { file_google_api_annotations } from "../google/api/annotations_pb";-import { file_google_api_client } from "../google/api/client_pb";import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";import { file_google_api_resource } from "../google/api/resource_pb";import { file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";import { file_v1_annotation } from "./annotation_pb";import { file_v1_common } from "./common_pb";import { file_v1_database_service } from "./database_service_pb";+import { file_v1_query_history_service } from "./query_history_service_pb";/*** Describes the file v1/sql_service.proto.*/export const file_v1_sql_service = /*@__PURE__*/- fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiqgEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAIgASgJEg0KBWxpbWl0GAMgASgFEhMKBnNjaGVtYRgEIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgFIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lciJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQi/AEKDFF1ZXJ5UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglzdGF0ZW1lbnQYAiABKAkSDQoFbGltaXQYAyABKAUSFgoOZGF0YV9zb3VyY2VfaWQYBCABKAkSDwoHZXhwbGFpbhgFIAEoCBITCgZzY2hlbWEYBiABKAlIAIgBARIuCgxxdWVyeV9vcHRpb24YByABKAsyGC5ieXRlYmFzZS52MS5RdWVyeU9wdGlvbhIWCgljb250YWluZXIYCCABKAlIAYgBAUIJCgdfc2NoZW1hQgwKCl9jb250YWluZXIiWAoNUXVlcnlSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQSHAoUYXBwbGllZF9hY2Nlc3NfZ3JhbnQYAiABKAki+QIKC1F1ZXJ5T3B0aW9uEkoKFXJlZGlzX3J1bl9jb21tYW5kc19vbhgBIAEoDjIrLmJ5dGViYXNlLnYxLlF1ZXJ5T3B0aW9uLlJlZGlzUnVuQ29tbWFuZHNPbhJJChRtc3NxbF9leHBsYWluX2Zvcm1hdBgCIAEoDjIrLmJ5dGViYXNlLnYxLlF1ZXJ5T3B0aW9uLk1TU1FMRXhwbGFpbkZvcm1hdCJbChJSZWRpc1J1bkNvbW1hbmRzT24SJQohUkVESVNfUlVOX0NPTU1BTkRTX09OX1VOU1BFQ0lGSUVEEAASDwoLU0lOR0xFX05PREUQARINCglBTExfTk9ERVMQAiJ2ChJNU1NRTEV4cGxhaW5Gb3JtYXQSJAogTVNTUUxfRVhQTEFJTl9GT1JNQVRfVU5TUEVDSUZJRUQQABIcChhNU1NRTF9FWFBMQUlOX0ZPUk1BVF9BTEwQARIcChhNU1NRTF9FWFBMQUlOX0ZPUk1BVF9YTUwQAiKYCgoLUXVlcnlSZXN1bHQSFAoMY29sdW1uX25hbWVzGAEgAygJEhkKEWNvbHVtbl90eXBlX25hbWVzGAIgAygJEiMKBHJvd3MYAyADKAsyFS5ieXRlYmFzZS52MS5RdWVyeVJvdxISCgpyb3dzX2NvdW50GAQgASgDEg0KBWVycm9yGAUgASgJEioKB2xhdGVuY3kYBiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SEQoJc3RhdGVtZW50GAcgASgJEkAKDnBvc3RncmVzX2Vycm9yGAggASgLMiYuYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuUG9zdGdyZXNFcnJvckgAEjwKDHN5bnRheF9lcnJvchgJIAEoCzIkLmJ5dGViYXNlLnYxLlF1ZXJ5UmVzdWx0LlN5bnRheEVycm9ySAASQAoRcGVybWlzc2lvbl9kZW5pZWQYCiABKAsyIy5ieXRlYmFzZS52MS5QZXJtaXNzaW9uRGVuaWVkRGV0YWlsSAASPgoNY29tbWFuZF9lcnJvchgNIAEoCzIlLmJ5dGViYXNlLnYxLlF1ZXJ5UmVzdWx0LkNvbW1hbmRFcnJvckgAEjIKCG1lc3NhZ2VzGAsgAygLMiAuYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuTWVzc2FnZRIqCgZtYXNrZWQYDCADKAsyGi5ieXRlYmFzZS52MS5NYXNraW5nUmVhc29uGs4CCg1Qb3N0Z3Jlc0Vycm9yEhAKCHNldmVyaXR5GAEgASgJEgwKBGNvZGUYAiABKAkSDwoHbWVzc2FnZRgDIAEoCRIOCgZkZXRhaWwYBCABKAkSDAoEaGludBgFIAEoCRIQCghwb3NpdGlvbhgGIAEoBRIZChFpbnRlcm5hbF9wb3NpdGlvbhgHIAEoBRIWCg5pbnRlcm5hbF9xdWVyeRgIIAEoCRINCgV3aGVyZRgJIAEoCRITCgtzY2hlbWFfbmFtZRgKIAEoCRISCgp0YWJsZV9uYW1lGAsgASgJEhMKC2NvbHVtbl9uYW1lGAwgASgJEhYKDmRhdGFfdHlwZV9uYW1lGA0gASgJEhcKD2NvbnN0cmFpbnRfbmFtZRgOIAEoCRIMCgRmaWxlGA8gASgJEgwKBGxpbmUYECABKAUSDwoHcm91dGluZRgRIAEoCRo8CgtTeW50YXhFcnJvchItCg5zdGFydF9wb3NpdGlvbhgBIAEoCzIVLmJ5dGViYXNlLnYxLlBvc2l0aW9uGpMBCgxDb21tYW5kRXJyb3ISQAoMY29tbWFuZF90eXBlGAEgASgOMiouYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuQ29tbWFuZEVycm9yLlR5cGUiQQoEVHlwZRIUChBUWVBFX1VOU1BFQ0lGSUVEEAASBwoDRERMEAESBwoDRE1MEAISEQoNTk9OX1JFQURfT05MWRADGrcBCgdNZXNzYWdlEjUKBWxldmVsGAEgASgOMiYuYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuTWVzc2FnZS5MZXZlbBIPCgdjb250ZW50GAIgASgJImQKBUxldmVsEhUKEUxFVkVMX1VOU1BFQ0lGSUVEEAASCAoESU5GTxABEgsKB1dBUk5JTkcQAhIJCgVERUJVRxADEgcKA0xPRxAEEgoKBk5PVElDRRAFEg0KCUVYQ0VQVElPThAGQhAKDmRldGFpbGVkX2Vycm9yIr0BCg1NYXNraW5nUmVhc29uEhgKEHNlbWFudGljX3R5cGVfaWQYASABKAkSGwoTc2VtYW50aWNfdHlwZV90aXRsZRgCIAEoCRIXCg9tYXNraW5nX3J1bGVfaWQYAyABKAkSEQoJYWxnb3JpdGhtGAQgASgJEg8KB2NvbnRleHQYBSABKAkSHAoUY2xhc3NpZmljYXRpb25fbGV2ZWwYBiABKAUSGgoSc2VtYW50aWNfdHlwZV9pY29uGAcgASgJIjEKCFF1ZXJ5Um93EiUKBnZhbHVlcxgBIAMoCzIVLmJ5dGViYXNlLnYxLlJvd1ZhbHVlIowFCghSb3dWYWx1ZRIwCgpudWxsX3ZhbHVlGAEgASgOMhouZ29vZ2xlLnByb3RvYnVmLk51bGxWYWx1ZUgAEhQKCmJvb2xfdmFsdWUYAiABKAhIABIVCgtieXRlc192YWx1ZRgDIAEoDEgAEhYKDGRvdWJsZV92YWx1ZRgEIAEoAUgAEhUKC2Zsb2F0X3ZhbHVlGAUgASgCSAASFQoLaW50MzJfdmFsdWUYBiABKAVIABIVCgtpbnQ2NF92YWx1ZRgHIAEoA0gAEhYKDHN0cmluZ192YWx1ZRgIIAEoCUgAEhYKDHVpbnQzMl92YWx1ZRgJIAEoDUgAEhYKDHVpbnQ2NF92YWx1ZRgKIAEoBEgAEi0KC3ZhbHVlX3ZhbHVlGAsgASgLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlSAASOgoPdGltZXN0YW1wX3ZhbHVlGAwgASgLMh8uYnl0ZWJhc2UudjEuUm93VmFsdWUuVGltZXN0YW1wSAASPwoSdGltZXN0YW1wX3R6X3ZhbHVlGA0gASgLMiEuYnl0ZWJhc2UudjEuUm93VmFsdWUuVGltZXN0YW1wVFpIABpTCglUaW1lc3RhbXASNAoQZ29vZ2xlX3RpbWVzdGFtcBgBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASEAoIYWNjdXJhY3kYAiABKAUacwoLVGltZXN0YW1wVFoSNAoQZ29vZ2xlX3RpbWVzdGFtcBgBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASDAoEem9uZRgCIAEoCRIOCgZvZmZzZXQYAyABKAUSEAoIYWNjdXJhY3kYBCABKAVCBgoEa2luZCKDAwoGQWR2aWNlEikKBnN0YXR1cxgBIAEoDjIZLmJ5dGViYXNlLnYxLkFkdmljZS5MZXZlbBIMCgRjb2RlGAIgASgFEg0KBXRpdGxlGAMgASgJEg8KB2NvbnRlbnQYBCABKAkSLQoOc3RhcnRfcG9zaXRpb24YBSABKAsyFS5ieXRlYmFzZS52MS5Qb3NpdGlvbhIrCgxlbmRfcG9zaXRpb24YBiABKAsyFS5ieXRlYmFzZS52MS5Qb3NpdGlvbhIvCglydWxlX3R5cGUYByABKA4yHC5ieXRlYmFzZS52MS5BZHZpY2UuUnVsZVR5cGUiSgoFTGV2ZWwSHAoYQURWSUNFX0xFVkVMX1VOU1BFQ0lGSUVEEAASCwoHU1VDQ0VTUxABEgsKB1dBUk5JTkcQAhIJCgVFUlJPUhADIkcKCFJ1bGVUeXBlEhkKFVJVTEVfVFlQRV9VTlNQRUNJRklFRBAAEhAKDFBBUlNFUl9CQVNFRBABEg4KCkFJX1BPV0VSRUQQAiLiAQoNRXhwb3J0UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglzdGF0ZW1lbnQYAiABKAkSDQoFbGltaXQYAyABKAUSKQoGZm9ybWF0GAQgASgOMhkuYnl0ZWJhc2UudjEuRXhwb3J0Rm9ybWF0Eg0KBWFkbWluGAUgASgIEhAKCHBhc3N3b3JkGAYgASgJEhYKDmRhdGFfc291cmNlX2lkGAcgASgJEhMKBnNjaGVtYRgIIAEoCUgAiAEBQgkKB19zY2hlbWEiPwoORXhwb3J0UmVzcG9uc2USDwoHY29udGVudBgBIAEoDBIcChRhcHBsaWVkX2FjY2Vzc19ncmFudBgCIAEoCSK0AQoTRGlmZk1ldGFkYXRhUmVxdWVzdBI7Cg9zb3VyY2VfbWV0YWRhdGEYASABKAsyHS5ieXRlYmFzZS52MS5EYXRhYmFzZU1ldGFkYXRhQgPgQQISOwoPdGFyZ2V0X21ldGFkYXRhGAIgASgLMh0uYnl0ZWJhc2UudjEuRGF0YWJhc2VNZXRhZGF0YUID4EECEiMKBmVuZ2luZRgDIAEoDjITLmJ5dGViYXNlLnYxLkVuZ2luZSIkChREaWZmTWV0YWRhdGFSZXNwb25zZRIMCgRkaWZmGAEgASgJImkKG1NlYXJjaFF1ZXJ5SGlzdG9yaWVzUmVxdWVzdBITCgZwYXJlbnQYBCABKAlCA+BBAhIRCglwYWdlX3NpemUYASABKAUSEgoKcGFnZV90b2tlbhgCIAEoCRIOCgZmaWx0ZXIYAyABKAkigAEKGUxpc3RRdWVyeUhpc3Rvcmllc1JlcXVlc3QSLAoGcGFyZW50GAEgASgJQhzgQQL6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EhEKCXBhZ2Vfc2l6ZRgCIAEoBRISCgpwYWdlX3Rva2VuGAMgASgJEg4KBmZpbHRlchgEIAEoCSJuChpMaXN0UXVlcnlIaXN0b3JpZXNSZXNwb25zZRI3Cg9xdWVyeV9oaXN0b3JpZXMYASADKAsyGS5ieXRlYmFzZS52MS5RdWVyeUhpc3RvcnlCA+BBAxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiKwoWR2V0UXVlcnlIaXN0b3J5UmVxdWVzdBIRCgRuYW1lGAEgASgJQgPgQQIicAocU2VhcmNoUXVlcnlIaXN0b3JpZXNSZXNwb25zZRI3Cg9xdWVyeV9oaXN0b3JpZXMYASADKAsyGS5ieXRlYmFzZS52MS5RdWVyeUhpc3RvcnlCA+BBAxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAki1AIKDFF1ZXJ5SGlzdG9yeRIRCgRuYW1lGAEgASgJQgPgQQMSFQoIZGF0YWJhc2UYAiABKAlCA+BBAxIUCgdjcmVhdG9yGAMgASgJQgPgQQMSNAoLY3JlYXRlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSFgoJc3RhdGVtZW50GAUgASgJQgPgQQMSFwoFZXJyb3IYBiABKAlCA+BBA0gAiAEBEjAKCGR1cmF0aW9uGAcgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uQgPgQQMSLAoEdHlwZRgIIAEoDjIeLmJ5dGViYXNlLnYxLlF1ZXJ5SGlzdG9yeS5UeXBlIjMKBFR5cGUSFAoQVFlQRV9VTlNQRUNJRklFRBAAEgkKBVFVRVJZEAESCgoGRVhQT1JUEAJCCAoGX2Vycm9yInsKE0FJQ29tcGxldGlvblJlcXVlc3QSOgoIbWVzc2FnZXMYASADKAsyKC5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXF1ZXN0Lk1lc3NhZ2UaKAoHTWVzc2FnZRIMCgRyb2xlGAEgASgJEg8KB2NvbnRlbnQYAiABKAkilQIKFEFJQ29tcGxldGlvblJlc3BvbnNlEj8KCmNhbmRpZGF0ZXMYASADKAsyKy5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXNwb25zZS5DYW5kaWRhdGUauwEKCUNhbmRpZGF0ZRJECgdjb250ZW50GAEgASgLMjMuYnl0ZWJhc2UudjEuQUlDb21wbGV0aW9uUmVzcG9uc2UuQ2FuZGlkYXRlLkNvbnRlbnQaaAoHQ29udGVudBJHCgVwYXJ0cxgBIAMoCzI4LmJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlc3BvbnNlLkNhbmRpZGF0ZS5Db250ZW50LlBhcnQaFAoEUGFydBIMCgR0ZXh0GAEgASgJMqsKCgpTUUxTZXJ2aWNlEo8BCgVRdWVyeRIZLmJ5dGViYXNlLnYxLlF1ZXJ5UmVxdWVzdBoaLmJ5dGViYXNlLnYxLlF1ZXJ5UmVzcG9uc2UiT4rqMBBiYi5kYXRhYmFzZXMuZ2V0kOowAZjqMAGC0+STAi06ASoiKC92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKn06cXVlcnkSiQEKDEFkbWluRXhlY3V0ZRIgLmJ5dGViYXNlLnYxLkFkbWluRXhlY3V0ZVJlcXVlc3QaIS5ieXRlYmFzZS52MS5BZG1pbkV4ZWN1dGVSZXNwb25zZSIwiuowDGJiLnNxbC5hZG1pbpDqMAGY6jABgtPkkwISEhAvdjE6YWRtaW5FeGVjdXRlKAEwARKyAQoUU2VhcmNoUXVlcnlIaXN0b3JpZXMSKC5ieXRlYmFzZS52MS5TZWFyY2hRdWVyeUhpc3Rvcmllc1JlcXVlc3QaKS5ieXRlYmFzZS52MS5TZWFyY2hRdWVyeUhpc3Rvcmllc1Jlc3BvbnNlIkXaQQZwYXJlbnSQ6jACgtPkkwIyOgEqIi0vdjEve3BhcmVudD1wcm9qZWN0cy8qfS9xdWVyeUhpc3RvcmllczpzZWFyY2gSvAEKEkxpc3RRdWVyeUhpc3RvcmllcxImLmJ5dGViYXNlLnYxLkxpc3RRdWVyeUhpc3Rvcmllc1JlcXVlc3QaJy5ieXRlYmFzZS52MS5MaXN0UXVlcnlIaXN0b3JpZXNSZXNwb25zZSJV2kEGcGFyZW50iuowFmJiLnF1ZXJ5SGlzdG9yaWVzLmxpc3SQ6jABgtPkkwIoEiYvdjEve3BhcmVudD1wcm9qZWN0cy8qfS9xdWVyeUhpc3RvcmllcxKFAQoPR2V0UXVlcnlIaXN0b3J5EiMuYnl0ZWJhc2UudjEuR2V0UXVlcnlIaXN0b3J5UmVxdWVzdBoZLmJ5dGViYXNlLnYxLlF1ZXJ5SGlzdG9yeSIykOowAoLT5JMCKBImL3YxL3tuYW1lPXByb2plY3RzLyovcXVlcnlIaXN0b3JpZXMvKn0ShAIKBkV4cG9ydBIaLmJ5dGViYXNlLnYxLkV4cG9ydFJlcXVlc3QaGy5ieXRlYmFzZS52MS5FeHBvcnRSZXNwb25zZSLAAYrqMBBiYi5kYXRhYmFzZXMuZ2V0kOowAZjqMAGC0+STAp0BOgEqWjE6ASoiLC92MS97bmFtZT1wcm9qZWN0cy8qL3BsYW5zLyovcm9sbG91dH06ZXhwb3J0Wjo6ASoiNS92MS97bmFtZT1wcm9qZWN0cy8qL3BsYW5zLyovcm9sbG91dC9zdGFnZXMvKn06ZXhwb3J0IikvdjEve25hbWU9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyp9OmV4cG9ydBKBAQoMRGlmZk1ldGFkYXRhEiAuYnl0ZWJhc2UudjEuRGlmZk1ldGFkYXRhUmVxdWVzdBohLmJ5dGViYXNlLnYxLkRpZmZNZXRhZGF0YVJlc3BvbnNlIiyA6jABgtPkkwIiOgEqIh0vdjEvc2NoZW1hRGVzaWduOmRpZmZNZXRhZGF0YRJ4CgxBSUNvbXBsZXRpb24SIC5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXF1ZXN0GiEuYnl0ZWJhc2UudjEuQUlDb21wbGV0aW9uUmVzcG9uc2UiI5DqMAKC0+STAhk6ASoiFC92MS9zcWwvYWlDb21wbGV0aW9uQqUBCg9jb20uYnl0ZWJhc2UudjFCD1NxbFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_service]);+ fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiqgEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAIgASgJEg0KBWxpbWl0GAMgASgFEhMKBnNjaGVtYRgEIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgFIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lciJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQi/AEKDFF1ZXJ5UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglzdGF0ZW1lbnQYAiABKAkSDQoFbGltaXQYAyABKAUSFgoOZGF0YV9zb3VyY2VfaWQYBCABKAkSDwoHZXhwbGFpbhgFIAEoCBITCgZzY2hlbWEYBiABKAlIAIgBARIuCgxxdWVyeV9vcHRpb24YByABKAsyGC5ieXRlYmFzZS52MS5RdWVyeU9wdGlvbhIWCgljb250YWluZXIYCCABKAlIAYgBAUIJCgdfc2NoZW1hQgwKCl9jb250YWluZXIiWAoNUXVlcnlSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQSHAoUYXBwbGllZF9hY2Nlc3NfZ3JhbnQYAiABKAki+QIKC1F1ZXJ5T3B0aW9uEkoKFXJlZGlzX3J1bl9jb21tYW5kc19vbhgBIAEoDjIrLmJ5dGViYXNlLnYxLlF1ZXJ5T3B0aW9uLlJlZGlzUnVuQ29tbWFuZHNPbhJJChRtc3NxbF9leHBsYWluX2Zvcm1hdBgCIAEoDjIrLmJ5dGViYXNlLnYxLlF1ZXJ5T3B0aW9uLk1TU1FMRXhwbGFpbkZvcm1hdCJbChJSZWRpc1J1bkNvbW1hbmRzT24SJQohUkVESVNfUlVOX0NPTU1BTkRTX09OX1VOU1BFQ0lGSUVEEAASDwoLU0lOR0xFX05PREUQARINCglBTExfTk9ERVMQAiJ2ChJNU1NRTEV4cGxhaW5Gb3JtYXQSJAogTVNTUUxfRVhQTEFJTl9GT1JNQVRfVU5TUEVDSUZJRUQQABIcChhNU1NRTF9FWFBMQUlOX0ZPUk1BVF9BTEwQARIcChhNU1NRTF9FWFBMQUlOX0ZPUk1BVF9YTUwQAiKYCgoLUXVlcnlSZXN1bHQSFAoMY29sdW1uX25hbWVzGAEgAygJEhkKEWNvbHVtbl90eXBlX25hbWVzGAIgAygJEiMKBHJvd3MYAyADKAsyFS5ieXRlYmFzZS52MS5RdWVyeVJvdxISCgpyb3dzX2NvdW50GAQgASgDEg0KBWVycm9yGAUgASgJEioKB2xhdGVuY3kYBiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SEQoJc3RhdGVtZW50GAcgASgJEkAKDnBvc3RncmVzX2Vycm9yGAggASgLMiYuYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuUG9zdGdyZXNFcnJvckgAEjwKDHN5bnRheF9lcnJvchgJIAEoCzIkLmJ5dGViYXNlLnYxLlF1ZXJ5UmVzdWx0LlN5bnRheEVycm9ySAASQAoRcGVybWlzc2lvbl9kZW5pZWQYCiABKAsyIy5ieXRlYmFzZS52MS5QZXJtaXNzaW9uRGVuaWVkRGV0YWlsSAASPgoNY29tbWFuZF9lcnJvchgNIAEoCzIlLmJ5dGViYXNlLnYxLlF1ZXJ5UmVzdWx0LkNvbW1hbmRFcnJvckgAEjIKCG1lc3NhZ2VzGAsgAygLMiAuYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuTWVzc2FnZRIqCgZtYXNrZWQYDCADKAsyGi5ieXRlYmFzZS52MS5NYXNraW5nUmVhc29uGs4CCg1Qb3N0Z3Jlc0Vycm9yEhAKCHNldmVyaXR5GAEgASgJEgwKBGNvZGUYAiABKAkSDwoHbWVzc2FnZRgDIAEoCRIOCgZkZXRhaWwYBCABKAkSDAoEaGludBgFIAEoCRIQCghwb3NpdGlvbhgGIAEoBRIZChFpbnRlcm5hbF9wb3NpdGlvbhgHIAEoBRIWCg5pbnRlcm5hbF9xdWVyeRgIIAEoCRINCgV3aGVyZRgJIAEoCRITCgtzY2hlbWFfbmFtZRgKIAEoCRISCgp0YWJsZV9uYW1lGAsgASgJEhMKC2NvbHVtbl9uYW1lGAwgASgJEhYKDmRhdGFfdHlwZV9uYW1lGA0gASgJEhcKD2NvbnN0cmFpbnRfbmFtZRgOIAEoCRIMCgRmaWxlGA8gASgJEgwKBGxpbmUYECABKAUSDwoHcm91dGluZRgRIAEoCRo8CgtTeW50YXhFcnJvchItCg5zdGFydF9wb3NpdGlvbhgBIAEoCzIVLmJ5dGViYXNlLnYxLlBvc2l0aW9uGpMBCgxDb21tYW5kRXJyb3ISQAoMY29tbWFuZF90eXBlGAEgASgOMiouYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuQ29tbWFuZEVycm9yLlR5cGUiQQoEVHlwZRIUChBUWVBFX1VOU1BFQ0lGSUVEEAASBwoDRERMEAESBwoDRE1MEAISEQoNTk9OX1JFQURfT05MWRADGrcBCgdNZXNzYWdlEjUKBWxldmVsGAEgASgOMiYuYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQuTWVzc2FnZS5MZXZlbBIPCgdjb250ZW50GAIgASgJImQKBUxldmVsEhUKEUxFVkVMX1VOU1BFQ0lGSUVEEAASCAoESU5GTxABEgsKB1dBUk5JTkcQAhIJCgVERUJVRxADEgcKA0xPRxAEEgoKBk5PVElDRRAFEg0KCUVYQ0VQVElPThAGQhAKDmRldGFpbGVkX2Vycm9yIr0BCg1NYXNraW5nUmVhc29uEhgKEHNlbWFudGljX3R5cGVfaWQYASABKAkSGwoTc2VtYW50aWNfdHlwZV90aXRsZRgCIAEoCRIXCg9tYXNraW5nX3J1bGVfaWQYAyABKAkSEQoJYWxnb3JpdGhtGAQgASgJEg8KB2NvbnRleHQYBSABKAkSHAoUY2xhc3NpZmljYXRpb25fbGV2ZWwYBiABKAUSGgoSc2VtYW50aWNfdHlwZV9pY29uGAcgASgJIjEKCFF1ZXJ5Um93EiUKBnZhbHVlcxgBIAMoCzIVLmJ5dGViYXNlLnYxLlJvd1ZhbHVlIowFCghSb3dWYWx1ZRIwCgpudWxsX3ZhbHVlGAEgASgOMhouZ29vZ2xlLnByb3RvYnVmLk51bGxWYWx1ZUgAEhQKCmJvb2xfdmFsdWUYAiABKAhIABIVCgtieXRlc192YWx1ZRgDIAEoDEgAEhYKDGRvdWJsZV92YWx1ZRgEIAEoAUgAEhUKC2Zsb2F0X3ZhbHVlGAUgASgCSAASFQoLaW50MzJfdmFsdWUYBiABKAVIABIVCgtpbnQ2NF92YWx1ZRgHIAEoA0gAEhYKDHN0cmluZ192YWx1ZRgIIAEoCUgAEhYKDHVpbnQzMl92YWx1ZRgJIAEoDUgAEhYKDHVpbnQ2NF92YWx1ZRgKIAEoBEgAEi0KC3ZhbHVlX3ZhbHVlGAsgASgLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlSAASOgoPdGltZXN0YW1wX3ZhbHVlGAwgASgLMh8uYnl0ZWJhc2UudjEuUm93VmFsdWUuVGltZXN0YW1wSAASPwoSdGltZXN0YW1wX3R6X3ZhbHVlGA0gASgLMiEuYnl0ZWJhc2UudjEuUm93VmFsdWUuVGltZXN0YW1wVFpIABpTCglUaW1lc3RhbXASNAoQZ29vZ2xlX3RpbWVzdGFtcBgBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASEAoIYWNjdXJhY3kYAiABKAUacwoLVGltZXN0YW1wVFoSNAoQZ29vZ2xlX3RpbWVzdGFtcBgBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASDAoEem9uZRgCIAEoCRIOCgZvZmZzZXQYAyABKAUSEAoIYWNjdXJhY3kYBCABKAVCBgoEa2luZCKDAwoGQWR2aWNlEikKBnN0YXR1cxgBIAEoDjIZLmJ5dGViYXNlLnYxLkFkdmljZS5MZXZlbBIMCgRjb2RlGAIgASgFEg0KBXRpdGxlGAMgASgJEg8KB2NvbnRlbnQYBCABKAkSLQoOc3RhcnRfcG9zaXRpb24YBSABKAsyFS5ieXRlYmFzZS52MS5Qb3NpdGlvbhIrCgxlbmRfcG9zaXRpb24YBiABKAsyFS5ieXRlYmFzZS52MS5Qb3NpdGlvbhIvCglydWxlX3R5cGUYByABKA4yHC5ieXRlYmFzZS52MS5BZHZpY2UuUnVsZVR5cGUiSgoFTGV2ZWwSHAoYQURWSUNFX0xFVkVMX1VOU1BFQ0lGSUVEEAASCwoHU1VDQ0VTUxABEgsKB1dBUk5JTkcQAhIJCgVFUlJPUhADIkcKCFJ1bGVUeXBlEhkKFVJVTEVfVFlQRV9VTlNQRUNJRklFRBAAEhAKDFBBUlNFUl9CQVNFRBABEg4KCkFJX1BPV0VSRUQQAiLiAQoNRXhwb3J0UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglzdGF0ZW1lbnQYAiABKAkSDQoFbGltaXQYAyABKAUSKQoGZm9ybWF0GAQgASgOMhkuYnl0ZWJhc2UudjEuRXhwb3J0Rm9ybWF0Eg0KBWFkbWluGAUgASgIEhAKCHBhc3N3b3JkGAYgASgJEhYKDmRhdGFfc291cmNlX2lkGAcgASgJEhMKBnNjaGVtYRgIIAEoCUgAiAEBQgkKB19zY2hlbWEiPwoORXhwb3J0UmVzcG9uc2USDwoHY29udGVudBgBIAEoDBIcChRhcHBsaWVkX2FjY2Vzc19ncmFudBgCIAEoCSK0AQoTRGlmZk1ldGFkYXRhUmVxdWVzdBI7Cg9zb3VyY2VfbWV0YWRhdGEYASABKAsyHS5ieXRlYmFzZS52MS5EYXRhYmFzZU1ldGFkYXRhQgPgQQISOwoPdGFyZ2V0X21ldGFkYXRhGAIgASgLMh0uYnl0ZWJhc2UudjEuRGF0YWJhc2VNZXRhZGF0YUID4EECEiMKBmVuZ2luZRgDIAEoDjITLmJ5dGViYXNlLnYxLkVuZ2luZSIkChREaWZmTWV0YWRhdGFSZXNwb25zZRIMCgRkaWZmGAEgASgJInsKE0FJQ29tcGxldGlvblJlcXVlc3QSOgoIbWVzc2FnZXMYASADKAsyKC5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXF1ZXN0Lk1lc3NhZ2UaKAoHTWVzc2FnZRIMCgRyb2xlGAEgASgJEg8KB2NvbnRlbnQYAiABKAkilQIKFEFJQ29tcGxldGlvblJlc3BvbnNlEj8KCmNhbmRpZGF0ZXMYASADKAsyKy5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXNwb25zZS5DYW5kaWRhdGUauwEKCUNhbmRpZGF0ZRJECgdjb250ZW50GAEgASgLMjMuYnl0ZWJhc2UudjEuQUlDb21wbGV0aW9uUmVzcG9uc2UuQ2FuZGlkYXRlLkNvbnRlbnQaaAoHQ29udGVudBJHCgVwYXJ0cxgBIAMoCzI4LmJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlc3BvbnNlLkNhbmRpZGF0ZS5Db250ZW50LlBhcnQaFAoEUGFydBIMCgR0ZXh0GAEgASgJMowJCgpTUUxTZXJ2aWNlEo8BCgVRdWVyeRIZLmJ5dGViYXNlLnYxLlF1ZXJ5UmVxdWVzdBoaLmJ5dGViYXNlLnYxLlF1ZXJ5UmVzcG9uc2UiT4rqMBBiYi5kYXRhYmFzZXMuZ2V0kOowAZjqMAGC0+STAi06ASoiKC92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKn06cXVlcnkSiQEKDEFkbWluRXhlY3V0ZRIgLmJ5dGViYXNlLnYxLkFkbWluRXhlY3V0ZVJlcXVlc3QaIS5ieXRlYmFzZS52MS5BZG1pbkV4ZWN1dGVSZXNwb25zZSIwiuowDGJiLnNxbC5hZG1pbpDqMAGY6jABgtPkkwISEhAvdjE6YWRtaW5FeGVjdXRlKAEwARJ0ChRTZWFyY2hRdWVyeUhpc3RvcmllcxIoLmJ5dGViYXNlLnYxLlNlYXJjaFF1ZXJ5SGlzdG9yaWVzUmVxdWVzdBopLmJ5dGViYXNlLnYxLlNlYXJjaFF1ZXJ5SGlzdG9yaWVzUmVzcG9uc2UiB4gCAZDqMAISiAEKEkxpc3RRdWVyeUhpc3RvcmllcxImLmJ5dGViYXNlLnYxLkxpc3RRdWVyeUhpc3Rvcmllc1JlcXVlc3QaJy5ieXRlYmFzZS52MS5MaXN0UXVlcnlIaXN0b3JpZXNSZXNwb25zZSIhiAIBiuowFmJiLnF1ZXJ5SGlzdG9yaWVzLmxpc3SQ6jABEloKD0dldFF1ZXJ5SGlzdG9yeRIjLmJ5dGViYXNlLnYxLkdldFF1ZXJ5SGlzdG9yeVJlcXVlc3QaGS5ieXRlYmFzZS52MS5RdWVyeUhpc3RvcnkiB4gCAZDqMAIShAIKBkV4cG9ydBIaLmJ5dGViYXNlLnYxLkV4cG9ydFJlcXVlc3QaGy5ieXRlYmFzZS52MS5FeHBvcnRSZXNwb25zZSLAAYrqMBBiYi5kYXRhYmFzZXMuZ2V0kOowAZjqMAGC0+STAp0BOgEqWjE6ASoiLC92MS97bmFtZT1wcm9qZWN0cy8qL3BsYW5zLyovcm9sbG91dH06ZXhwb3J0Wjo6ASoiNS92MS97bmFtZT1wcm9qZWN0cy8qL3BsYW5zLyovcm9sbG91dC9zdGFnZXMvKn06ZXhwb3J0IikvdjEve25hbWU9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyp9OmV4cG9ydBKBAQoMRGlmZk1ldGFkYXRhEiAuYnl0ZWJhc2UudjEuRGlmZk1ldGFkYXRhUmVxdWVzdBohLmJ5dGViYXNlLnYxLkRpZmZNZXRhZGF0YVJlc3BvbnNlIiyA6jABgtPkkwIiOgEqIh0vdjEvc2NoZW1hRGVzaWduOmRpZmZNZXRhZGF0YRJ4CgxBSUNvbXBsZXRpb24SIC5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXF1ZXN0GiEuYnl0ZWJhc2UudjEuQUlDb21wbGV0aW9uUmVzcG9uc2UiI5DqMAKC0+STAhk6ASoiFC92MS9zcWwvYWlDb21wbGV0aW9uQqUBCg9jb20uYnl0ZWJhc2UudjFCD1NxbFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_service, file_v1_query_history_service]);/*** Describes the message bytebase.v1.AdminExecuteRequest.@@ -234,101 +234,47 @@ export const DiffMetadataRequestSchema = /*@__PURE__*/export const DiffMetadataResponseSchema = /*@__PURE__*/messageDesc(file_v1_sql_service, 13);-/**- * Describes the message bytebase.v1.SearchQueryHistoriesRequest.- * Use `create(SearchQueryHistoriesRequestSchema)` to create a new message.- */-export const SearchQueryHistoriesRequestSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 14);--/**- * Describes the message bytebase.v1.ListQueryHistoriesRequest.- * Use `create(ListQueryHistoriesRequestSchema)` to create a new message.- */-export const ListQueryHistoriesRequestSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 15);--/**- * Describes the message bytebase.v1.ListQueryHistoriesResponse.- * Use `create(ListQueryHistoriesResponseSchema)` to create a new message.- */-export const ListQueryHistoriesResponseSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 16);--/**- * Describes the message bytebase.v1.GetQueryHistoryRequest.- * Use `create(GetQueryHistoryRequestSchema)` to create a new message.- */-export const GetQueryHistoryRequestSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 17);--/**- * Describes the message bytebase.v1.SearchQueryHistoriesResponse.- * Use `create(SearchQueryHistoriesResponseSchema)` to create a new message.- */-export const SearchQueryHistoriesResponseSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 18);--/**- * Describes the message bytebase.v1.QueryHistory.- * Use `create(QueryHistorySchema)` to create a new message.- */-export const QueryHistorySchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 19);--/**- * Describes the enum bytebase.v1.QueryHistory.Type.- */-export const QueryHistory_TypeSchema = /*@__PURE__*/- enumDesc(file_v1_sql_service, 19, 0);--/**- * @generated from enum bytebase.v1.QueryHistory.Type- */-export const QueryHistory_Type = /*@__PURE__*/- tsEnum(QueryHistory_TypeSchema);-/*** Describes the message bytebase.v1.AICompletionRequest.* Use `create(AICompletionRequestSchema)` to create a new message.*/export const AICompletionRequestSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 20);+ messageDesc(file_v1_sql_service, 14);/*** Describes the message bytebase.v1.AICompletionRequest.Message.* Use `create(AICompletionRequest_MessageSchema)` to create a new message.*/export const AICompletionRequest_MessageSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 20, 0);+ messageDesc(file_v1_sql_service, 14, 0);/*** Describes the message bytebase.v1.AICompletionResponse.* Use `create(AICompletionResponseSchema)` to create a new message.*/export const AICompletionResponseSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 21);+ messageDesc(file_v1_sql_service, 15);/*** Describes the message bytebase.v1.AICompletionResponse.Candidate.* Use `create(AICompletionResponse_CandidateSchema)` to create a new message.*/export const AICompletionResponse_CandidateSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 21, 0);+ messageDesc(file_v1_sql_service, 15, 0);/*** Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.* Use `create(AICompletionResponse_Candidate_ContentSchema)` to create a new message.*/export const AICompletionResponse_Candidate_ContentSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 21, 0, 0);+ messageDesc(file_v1_sql_service, 15, 0, 0);/*** Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.Part.* Use `create(AICompletionResponse_Candidate_Content_PartSchema)` to create a new message.*/export const AICompletionResponse_Candidate_Content_PartSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 21, 0, 0, 0);+ messageDesc(file_v1_sql_service, 15, 0, 0, 0);/*** SQLService executes SQL queries and manages query operations.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 0c9c2d9e51..b0b40fdfd1 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -1,6 +1,129 @@openapi: 3.1.0info: {}paths:+ /bytebase.v1.SQLService/GetQueryHistory:+ post:+ tags:+ - SQLService+ summary: GetQueryHistory+ description: |-+ Deprecated: use QueryHistoryService.GetQueryHistory instead.+ Delegating alias kept for upgrade transition; will be removed in a future release.+ No HTTP binding: the REST route is served by QueryHistoryService.+ Permissions required: None (only returns the caller's own query history)+ operationId: SQLService_GetQueryHistory+ parameters:+ - name: Connect-Protocol-Version+ in: header+ required: true+ schema:+ $ref: '#/components/schemas/connect-protocol-version'+ - name: Connect-Timeout-Ms+ in: header+ schema:+ $ref: '#/components/schemas/connect-timeout-header'+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.GetQueryHistoryRequest'+ required: true+ responses:+ default:+ description: Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/connect.error'+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.QueryHistory'+ deprecated: true+ /bytebase.v1.SQLService/ListQueryHistories:+ post:+ tags:+ - SQLService+ summary: ListQueryHistories+ description: |-+ Deprecated: use QueryHistoryService.ListQueryHistories instead.+ Delegating alias kept for upgrade transition; will be removed in a future release.+ No HTTP binding: the REST route is served by QueryHistoryService.+ Permissions required: bb.queryHistories.list+ operationId: SQLService_ListQueryHistories+ parameters:+ - name: Connect-Protocol-Version+ in: header+ required: true+ schema:+ $ref: '#/components/schemas/connect-protocol-version'+ - name: Connect-Timeout-Ms+ in: header+ schema:+ $ref: '#/components/schemas/connect-timeout-header'+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListQueryHistoriesRequest'+ required: true+ responses:+ default:+ description: Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/connect.error'+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListQueryHistoriesResponse'+ deprecated: true+ /bytebase.v1.SQLService/SearchQueryHistories:+ post:+ tags:+ - SQLService+ summary: SearchQueryHistories+ description: |-+ Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ Delegating alias kept for upgrade transition; will be removed in a future release.+ No HTTP binding: the REST route is served by QueryHistoryService.+ Permissions required: None (only returns caller's own query histories)+ operationId: SQLService_SearchQueryHistories+ parameters:+ - name: Connect-Protocol-Version+ in: header+ required: true+ schema:+ $ref: '#/components/schemas/connect-protocol-version'+ - name: Connect-Timeout-Ms+ in: header+ schema:+ $ref: '#/components/schemas/connect-timeout-header'+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesRequest'+ required: true+ responses:+ default:+ description: Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/connect.error'+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesResponse'+ deprecated: true/v1/actuator/cache:delete:tags:@@ -9940,12 +10063,12 @@ paths:/v1/projects/{project}/queryHistories:get:tags:- - SQLService+ - QueryHistoryServicesummary: ListQueryHistoriesdescription: |-ListQueryHistories lists query histories of all users in a project.Permissions required: bb.queryHistories.list- operationId: SQLService_ListQueryHistories+ operationId: QueryHistoryService_ListQueryHistoriesparameters:- name: projectin: path@@ -9996,12 +10119,12 @@ paths:/v1/projects/{project}/queryHistories/{queryHistory}:get:tags:- - SQLService+ - QueryHistoryServicesummary: GetQueryHistorydescription: |-GetQueryHistory gets a single query history for the caller.Permissions required: None (only returns the caller's own query history)- operationId: SQLService_GetQueryHistory+ operationId: QueryHistoryService_GetQueryHistoryparameters:- name: projectin: path@@ -10025,12 +10148,12 @@ paths:/v1/projects/{project}/queryHistories:search:post:tags:- - SQLService+ - QueryHistoryServicesummary: SearchQueryHistoriesdescription: |-SearchQueryHistories searches query histories for the caller.Permissions required: None (only returns caller's own query histories)- operationId: SQLService_SearchQueryHistories+ operationId: QueryHistoryService_SearchQueryHistoriesparameters:- name: projectin: path@@ -29636,6 +29759,75 @@ components:$ref: '#/components/schemas/google.protobuf.Duration'title: PasswordRestrictionadditionalProperties: false+ connect-protocol-version:+ type: number+ title: Connect-Protocol-Version+ enum:+ - 1+ description: Define the version of the Connect protocol+ const: 1+ connect-timeout-header:+ type: number+ title: Connect-Timeout-Ms+ description: Define the timeout, in ms+ connect.error:+ type: object+ properties:+ code:+ type: string+ examples:+ - not_found+ enum:+ - canceled+ - unknown+ - invalid_argument+ - deadline_exceeded+ - not_found+ - already_exists+ - permission_denied+ - resource_exhausted+ - failed_precondition+ - aborted+ - out_of_range+ - unimplemented+ - internal+ - unavailable+ - data_loss+ - unauthenticated+ description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].+ message:+ type: string+ description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.+ details:+ type: array+ items:+ $ref: '#/components/schemas/connect.error_details.Any'+ description: A list of messages that carry the error details. There is no limit on the number of messages.+ title: Connect Error+ additionalProperties: true+ description: 'Error type returned by Connect: https://connectrpc.com/docs/go/errors/#http-representation'+ connect.error_details.Any:+ type: object+ properties:+ type:+ type: string+ description: 'A URL that acts as a globally unique identifier for the type of the serialized message. For example: `type.googleapis.com/google.rpc.ErrorInfo`. This is used to determine the schema of the data in the `value` field and is the discriminator for the `debug` field.'+ value:+ type: string+ format: binary+ description: The Protobuf message, serialized as bytes and base64-encoded. The specific message type is identified by the `type` field.+ debug:+ oneOf:+ - type: object+ title: Any+ additionalProperties: true+ description: Detailed error information.+ discriminator:+ propertyName: type+ title: Debug+ description: Deserialized error detail payload. The 'type' field indicates the schema. This field is for easier debugging and should not be relied upon for application logic.+ additionalProperties: true+ description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message, with an additional debug field for ConnectRPC error details.google.api.HttpBody:type: objectproperties:@@ -30924,6 +31116,8 @@ tags:description: InstanceService manages database instances and their connections.- name: DatabaseServicedescription: DatabaseService manages databases and their schemas.+ - name: QueryHistoryService+ description: QueryHistoryService manages query history records of SQL Editor queries and exports.- name: SQLServicedescription: SQLService executes SQL queries and manages query operations.- name: PlanServicediff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 6ebfe66a9b..cb55e113ae 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -218,6 +218,18 @@- [DatabaseService](#bytebase-v1-DatabaseService)+- [v1/query_history_service.proto](#v1_query_history_service-proto)+ - [GetQueryHistoryRequest](#bytebase-v1-GetQueryHistoryRequest)+ - [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest)+ - [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse)+ - [QueryHistory](#bytebase-v1-QueryHistory)+ - [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest)+ - [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse)++ - [QueryHistory.Type](#bytebase-v1-QueryHistory-Type)++ - [QueryHistoryService](#bytebase-v1-QueryHistoryService)+- [v1/sql_service.proto](#v1_sql_service-proto)- [AICompletionRequest](#bytebase-v1-AICompletionRequest)- [AICompletionRequest.Message](#bytebase-v1-AICompletionRequest-Message)@@ -232,11 +244,7 @@- [DiffMetadataResponse](#bytebase-v1-DiffMetadataResponse)- [ExportRequest](#bytebase-v1-ExportRequest)- [ExportResponse](#bytebase-v1-ExportResponse)- - [GetQueryHistoryRequest](#bytebase-v1-GetQueryHistoryRequest)- - [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest)- - [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse)- [MaskingReason](#bytebase-v1-MaskingReason)- - [QueryHistory](#bytebase-v1-QueryHistory)- [QueryOption](#bytebase-v1-QueryOption)- [QueryRequest](#bytebase-v1-QueryRequest)- [QueryResponse](#bytebase-v1-QueryResponse)@@ -249,12 +257,9 @@- [RowValue](#bytebase-v1-RowValue)- [RowValue.Timestamp](#bytebase-v1-RowValue-Timestamp)- [RowValue.TimestampTZ](#bytebase-v1-RowValue-TimestampTZ)- - [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest)- - [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse)- [Advice.Level](#bytebase-v1-Advice-Level)- [Advice.RuleType](#bytebase-v1-Advice-RuleType)- - [QueryHistory.Type](#bytebase-v1-QueryHistory-Type)- [QueryOption.MSSQLExplainFormat](#bytebase-v1-QueryOption-MSSQLExplainFormat)- [QueryOption.RedisRunCommandsOn](#bytebase-v1-QueryOption-RedisRunCommandsOn)- [QueryResult.CommandError.Type](#bytebase-v1-QueryResult-CommandError-Type)@@ -4285,6 +4290,160 @@ DatabaseService manages databases and their schemas.+<a name="v1_query_history_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## v1/query_history_service.proto++++<a name="bytebase-v1-GetQueryHistoryRequest"></a>++### GetQueryHistoryRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the query history to retrieve. Format: projects/{project}/queryHistories/{id} |+++++++<a name="bytebase-v1-ListQueryHistoriesRequest"></a>++### ListQueryHistoriesRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent project whose query histories are listed. Format: projects/{project} Use "projects/-" to list query histories across all projects (https://google.aip.dev/159); this requires the bb.queryHistories.list permission on the workspace. |+| page_size | [int32](#int32) | | The maximum number of histories to return. The service may return fewer than this value. If unspecified, at most 10 history entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListQueryHistories` call. Provide this to retrieve the subsequent page. |+| filter | [string](#string) | | Filter is the filter to apply on the list query histories. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Supported filter: - creator: the user full name in "users/{email}" format, support "==" operator.++For example: creator == "users/{email}" |+++++++<a name="bytebase-v1-ListQueryHistoriesResponse"></a>++### ListQueryHistoriesResponse++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| query_histories | [QueryHistory](#bytebase-v1-QueryHistory) | repeated | The list of query histories. |+| next_page_token | [string](#string) | | A token to retrieve next page of history. Pass this value in the page_token field in the subsequent call to `ListQueryHistories` method to retrieve the next page of history. |+++++++<a name="bytebase-v1-QueryHistory"></a>++### QueryHistory++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name for the query history. Format: projects/{project}/queryHistories/{id} |+| database | [string](#string) | | The database name to execute the query. Format: instances/{instance}/databases/{databaseName} |+| creator | [string](#string) | | |+| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| statement | [string](#string) | | |+| error | [string](#string) | optional | |+| duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |+| type | [QueryHistory.Type](#bytebase-v1-QueryHistory-Type) | | |+++++++<a name="bytebase-v1-SearchQueryHistoriesRequest"></a>++### SearchQueryHistoriesRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent project to search query histories in. Format: projects/{project} The AIP-159 wildcard "projects/-" is not supported; use ListQueryHistories for cross-project reads. |+| page_size | [int32](#int32) | | The maximum number of histories to return. The service may return fewer than this value. If unspecified, at most 10 history entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListQueryHistory` call. Provide this to retrieve the subsequent page. |+| filter | [string](#string) | | Filter is the filter to apply on the search query history The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Supported filter: - project: the project full name in "projects/{id}" format, support "==" operator. - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator. - instance: the instance full name in "instances/{id}" format, support "==" operator. - type: the type, should be "QUERY" or "EXPORT", support "==" operator. - statement: the SQL statement, support ".contains()" operator.++For example: project == "projects/{project}" database == "instances/{instance}/databases/{database}" instance == "instances/{instance}" type == "QUERY" type == "EXPORT" statement.contains("select") type == "QUERY" && statement.contains("select") |+++++++<a name="bytebase-v1-SearchQueryHistoriesResponse"></a>++### SearchQueryHistoriesResponse++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| query_histories | [QueryHistory](#bytebase-v1-QueryHistory) | repeated | The list of history. |+| next_page_token | [string](#string) | | A token to retrieve next page of history. Pass this value in the page_token field in the subsequent call to `ListQueryHistory` method to retrieve the next page of history. |+++++++++<a name="bytebase-v1-QueryHistory-Type"></a>++### QueryHistory.Type+++| Name | Number | Description |+| ---- | ------ | ----------- |+| TYPE_UNSPECIFIED | 0 | Unspecified query history type. |+| QUERY | 1 | Query execution for data retrieval. |+| EXPORT | 2 | Data export operation to file. |++++++++<a name="bytebase-v1-QueryHistoryService"></a>++### QueryHistoryService+QueryHistoryService manages query history records of SQL Editor queries and exports.++| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| SearchQueryHistories | [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest) | [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse) | SearchQueryHistories searches query histories for the caller. Permissions required: None (only returns caller's own query histories) |+| ListQueryHistories | [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest) | [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse) | ListQueryHistories lists query histories of all users in a project. Permissions required: bb.queryHistories.list |+| GetQueryHistory | [GetQueryHistoryRequest](#bytebase-v1-GetQueryHistoryRequest) | [QueryHistory](#bytebase-v1-QueryHistory) | GetQueryHistory gets a single query history for the caller. Permissions required: None (only returns the caller's own query history) |+++++<a name="v1_sql_service-proto"></a><p align="right"><a href="#top">Top</a></p>@@ -4508,59 +4667,6 @@ DatabaseService manages databases and their schemas.-<a name="bytebase-v1-GetQueryHistoryRequest"></a>--### GetQueryHistoryRequest----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the query history to retrieve. Format: projects/{project}/queryHistories/{id} |-------<a name="bytebase-v1-ListQueryHistoriesRequest"></a>--### ListQueryHistoriesRequest----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent project whose query histories are listed. Format: projects/{project} Use "projects/-" to list query histories across all projects (https://google.aip.dev/159); this requires the bb.queryHistories.list permission on the workspace. |-| page_size | [int32](#int32) | | The maximum number of histories to return. The service may return fewer than this value. If unspecified, at most 10 history entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListQueryHistories` call. Provide this to retrieve the subsequent page. |-| filter | [string](#string) | | Filter is the filter to apply on the list query histories. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter: - creator: the user full name in "users/{email}" format, support "==" operator.--For example: creator == "users/{email}" |-------<a name="bytebase-v1-ListQueryHistoriesResponse"></a>--### ListQueryHistoriesResponse----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| query_histories | [QueryHistory](#bytebase-v1-QueryHistory) | repeated | The list of query histories. |-| next_page_token | [string](#string) | | A token to retrieve next page of history. Pass this value in the page_token field in the subsequent call to `ListQueryHistories` method to retrieve the next page of history. |------<a name="bytebase-v1-MaskingReason"></a>### MaskingReason@@ -4582,28 +4688,6 @@ For example: creator == "users/{email}" |-<a name="bytebase-v1-QueryHistory"></a>--### QueryHistory----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name for the query history. Format: projects/{project}/queryHistories/{id} |-| database | [string](#string) | | The database name to execute the query. Format: instances/{instance}/databases/{databaseName} |-| creator | [string](#string) | | |-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| statement | [string](#string) | | |-| error | [string](#string) | optional | |-| duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |-| type | [QueryHistory.Type](#bytebase-v1-QueryHistory-Type) | | |------<a name="bytebase-v1-QueryOption"></a>### QueryOption@@ -4839,44 +4923,6 @@ Syntax error with position information for editor highlighting--<a name="bytebase-v1-SearchQueryHistoriesRequest"></a>--### SearchQueryHistoriesRequest----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent project to search query histories in. Format: projects/{project} The AIP-159 wildcard "projects/-" is not supported; use ListQueryHistories for cross-project reads. |-| page_size | [int32](#int32) | | The maximum number of histories to return. The service may return fewer than this value. If unspecified, at most 10 history entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | A page token, received from a previous `ListQueryHistory` call. Provide this to retrieve the subsequent page. |-| filter | [string](#string) | | Filter is the filter to apply on the search query history The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter: - project: the project full name in "projects/{id}" format, support "==" operator. - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator. - instance: the instance full name in "instances/{id}" format, support "==" operator. - type: the type, should be "QUERY" or "EXPORT", support "==" operator. - statement: the SQL statement, support ".contains()" operator.--For example: project == "projects/{project}" database == "instances/{instance}/databases/{database}" instance == "instances/{instance}" type == "QUERY" type == "EXPORT" statement.contains("select") type == "QUERY" && statement.contains("select") |-------<a name="bytebase-v1-SearchQueryHistoriesResponse"></a>--### SearchQueryHistoriesResponse----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| query_histories | [QueryHistory](#bytebase-v1-QueryHistory) | repeated | The list of history. |-| next_page_token | [string](#string) | | A token to retrieve next page of history. Pass this value in the page_token field in the subsequent call to `ListQueryHistory` method to retrieve the next page of history. |-----@@ -4907,19 +4953,6 @@ RuleType indicates the source of the linting rule.-<a name="bytebase-v1-QueryHistory-Type"></a>--### QueryHistory.Type---| Name | Number | Description |-| ---- | ------ | ----------- |-| TYPE_UNSPECIFIED | 0 | Unspecified query history type. |-| QUERY | 1 | Query execution for data retrieval. |-| EXPORT | 2 | Data export operation to file. |---<a name="bytebase-v1-QueryOption-MSSQLExplainFormat"></a>### QueryOption.MSSQLExplainFormat@@ -4990,9 +5023,9 @@ SQLService executes SQL queries and manages query operations.| ----------- | ------------ | ------------- | ------------|| Query | [QueryRequest](#bytebase-v1-QueryRequest) | [QueryResponse](#bytebase-v1-QueryResponse) | Executes a read-only SQL query against a database. Permissions required: bb.databases.get || AdminExecute | [AdminExecuteRequest](#bytebase-v1-AdminExecuteRequest) stream | [AdminExecuteResponse](#bytebase-v1-AdminExecuteResponse) stream | Executes SQL with admin privileges via streaming connection. Permissions required: bb.sql.admin |-| SearchQueryHistories | [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest) | [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse) | SearchQueryHistories searches query histories for the caller. Permissions required: None (only returns caller's own query histories) |-| ListQueryHistories | [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest) | [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse) | ListQueryHistories lists query histories of all users in a project. Permissions required: bb.queryHistories.list |-| GetQueryHistory | [GetQueryHistoryRequest](#bytebase-v1-GetQueryHistoryRequest) | [QueryHistory](#bytebase-v1-QueryHistory) | GetQueryHistory gets a single query history for the caller. Permissions required: None (only returns the caller's own query history) |+| SearchQueryHistories | [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest) | [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse) | Deprecated: use QueryHistoryService.SearchQueryHistories instead. Delegating alias kept for upgrade transition; will be removed in a future release. No HTTP binding: the REST route is served by QueryHistoryService. Permissions required: None (only returns caller's own query histories) |+| ListQueryHistories | [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest) | [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse) | Deprecated: use QueryHistoryService.ListQueryHistories instead. Delegating alias kept for upgrade transition; will be removed in a future release. No HTTP binding: the REST route is served by QueryHistoryService. Permissions required: bb.queryHistories.list |+| GetQueryHistory | [GetQueryHistoryRequest](#bytebase-v1-GetQueryHistoryRequest) | [QueryHistory](#bytebase-v1-QueryHistory) | Deprecated: use QueryHistoryService.GetQueryHistory instead. Delegating alias kept for upgrade transition; will be removed in a future release. No HTTP binding: the REST route is served by QueryHistoryService. Permissions required: None (only returns the caller's own query history) || Export | [ExportRequest](#bytebase-v1-ExportRequest) | [ExportResponse](#bytebase-v1-ExportResponse) | Exports query results to a file format. Permissions required: bb.databases.get || DiffMetadata | [DiffMetadataRequest](#bytebase-v1-DiffMetadataRequest) | [DiffMetadataResponse](#bytebase-v1-DiffMetadataResponse) | Computes schema differences between two database metadata. Permissions required: None || AICompletion | [AICompletionRequest](#bytebase-v1-AICompletionRequest) | [AICompletionResponse](#bytebase-v1-AICompletionResponse) | Provides AI-powered SQL completion and generation. Permissions required: None (authenticated users only, requires AI to be enabled) |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 10fbe9e62e..e2622bd5ed 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -1011,6 +1011,49 @@</li>+ <li>+ <a href="#v1%2fquery_history_service.proto">v1/query_history_service.proto</a>+ <ul>++ <li>+ <a href="#bytebase.v1.GetQueryHistoryRequest"><span class="badge">M</span>GetQueryHistoryRequest</a>+ </li>++ <li>+ <a href="#bytebase.v1.ListQueryHistoriesRequest"><span class="badge">M</span>ListQueryHistoriesRequest</a>+ </li>++ <li>+ <a href="#bytebase.v1.ListQueryHistoriesResponse"><span class="badge">M</span>ListQueryHistoriesResponse</a>+ </li>++ <li>+ <a href="#bytebase.v1.QueryHistory"><span class="badge">M</span>QueryHistory</a>+ </li>++ <li>+ <a href="#bytebase.v1.SearchQueryHistoriesRequest"><span class="badge">M</span>SearchQueryHistoriesRequest</a>+ </li>++ <li>+ <a href="#bytebase.v1.SearchQueryHistoriesResponse"><span class="badge">M</span>SearchQueryHistoriesResponse</a>+ </li>+++ <li>+ <a href="#bytebase.v1.QueryHistory.Type"><span class="badge">E</span>QueryHistory.Type</a>+ </li>++++ <li>+ <a href="#bytebase.v1.QueryHistoryService"><span class="badge">S</span>QueryHistoryService</a>+ </li>++ </ul>+ </li>++<li><a href="#v1%2fsql_service.proto">v1/sql_service.proto</a><ul>@@ -1067,26 +1110,10 @@<a href="#bytebase.v1.ExportResponse"><span class="badge">M</span>ExportResponse</a></li>- <li>- <a href="#bytebase.v1.GetQueryHistoryRequest"><span class="badge">M</span>GetQueryHistoryRequest</a>- </li>-- <li>- <a href="#bytebase.v1.ListQueryHistoriesRequest"><span class="badge">M</span>ListQueryHistoriesRequest</a>- </li>-- <li>- <a href="#bytebase.v1.ListQueryHistoriesResponse"><span class="badge">M</span>ListQueryHistoriesResponse</a>- </li>-<li><a href="#bytebase.v1.MaskingReason"><span class="badge">M</span>MaskingReason</a></li>- <li>- <a href="#bytebase.v1.QueryHistory"><span class="badge">M</span>QueryHistory</a>- </li>-<li><a href="#bytebase.v1.QueryOption"><span class="badge">M</span>QueryOption</a></li>@@ -1135,14 +1162,6 @@<a href="#bytebase.v1.RowValue.TimestampTZ"><span class="badge">M</span>RowValue.TimestampTZ</a></li>- <li>- <a href="#bytebase.v1.SearchQueryHistoriesRequest"><span class="badge">M</span>SearchQueryHistoriesRequest</a>- </li>-- <li>- <a href="#bytebase.v1.SearchQueryHistoriesResponse"><span class="badge">M</span>SearchQueryHistoriesResponse</a>- </li>-<li><a href="#bytebase.v1.Advice.Level"><span class="badge">E</span>Advice.Level</a>@@ -1152,10 +1171,6 @@<a href="#bytebase.v1.Advice.RuleType"><span class="badge">E</span>Advice.RuleType</a></li>- <li>- <a href="#bytebase.v1.QueryHistory.Type"><span class="badge">E</span>QueryHistory.Type</a>- </li>-<li><a href="#bytebase.v1.QueryOption.MSSQLExplainFormat"><span class="badge">E</span>QueryOption.MSSQLExplainFormat</a></li>@@ -13172,12 +13187,12 @@ Permissions required: bb.databases.getSchema</p></td><div class="file-heading">- <h2 id="v1/sql_service.proto">v1/sql_service.proto</h2><a href="#title">Top</a>+ <h2 id="v1/query_history_service.proto">v1/query_history_service.proto</h2><a href="#title">Top</a></div><p></p>- <h3 id="bytebase.v1.AICompletionRequest">AICompletionRequest</h3>+ <h3 id="bytebase.v1.GetQueryHistoryRequest">GetQueryHistoryRequest</h3><p></p>@@ -13188,10 +13203,11 @@ Permissions required: bb.databases.getSchema</p></td><tbody><tr>- <td>messages</td>- <td><a href="#bytebase.v1.AICompletionRequest.Message">AICompletionRequest.Message</a></td>- <td>repeated</td>- <td><p> </p></td>+ <td>name</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The name of the query history to retrieve.+Format: projects/{project}/queryHistories/{id} </p></td></tr></tbody>@@ -13201,7 +13217,7 @@ Permissions required: bb.databases.getSchema</p></td>- <h3 id="bytebase.v1.AICompletionRequest.Message">AICompletionRequest.Message</h3>+ <h3 id="bytebase.v1.ListQueryHistoriesRequest">ListQueryHistoriesRequest</h3><p></p>@@ -13212,66 +13228,46 @@ Permissions required: bb.databases.getSchema</p></td><tbody><tr>- <td>role</td>+ <td>parent</td><td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>The parent project whose query histories are listed.+Format: projects/{project}+Use "projects/-" to list query histories across all projects+(https://google.aip.dev/159); this requires the bb.queryHistories.list+permission on the workspace. </p></td></tr><tr>- <td>content</td>- <td><a href="#string">string</a></td>+ <td>page_size</td>+ <td><a href="#int32">int32</a></td><td></td>- <td><p> </p></td>+ <td><p>The maximum number of histories to return.+The service may return fewer than this value.+If unspecified, at most 10 history entries will be returned.+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.AICompletionResponse">AICompletionResponse</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-<tr>- <td>candidates</td>- <td><a href="#bytebase.v1.AICompletionResponse.Candidate">AICompletionResponse.Candidate</a></td>- <td>repeated</td>- <td><p>candidates is used for results with multiple choices and candidates. Used-for OpenAI and Gemini. </p></td>+ <td>page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>A page token, received from a previous `ListQueryHistories` call.+Provide this to retrieve the subsequent page. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.AICompletionResponse.Candidate">AICompletionResponse.Candidate</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-<tr>- <td>content</td>- <td><a href="#bytebase.v1.AICompletionResponse.Candidate.Content">AICompletionResponse.Candidate.Content</a></td>+ <td>filter</td>+ <td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>Filter is the filter to apply on the list query histories.+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Supported filter:+- creator: the user full name in "users/{email}" format, support "==" operator.++For example:+creator == "users/{email}" </p></td></tr></tbody>@@ -13281,7 +13277,7 @@ for OpenAI and Gemini. </p></td>- <h3 id="bytebase.v1.AICompletionResponse.Candidate.Content">AICompletionResponse.Candidate.Content</h3>+ <h3 id="bytebase.v1.ListQueryHistoriesResponse">ListQueryHistoriesResponse</h3><p></p>@@ -13292,34 +13288,19 @@ for OpenAI and Gemini. </p></td><tbody><tr>- <td>parts</td>- <td><a href="#bytebase.v1.AICompletionResponse.Candidate.Content.Part">AICompletionResponse.Candidate.Content.Part</a></td>+ <td>query_histories</td>+ <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td><td>repeated</td>- <td><p>parts is used for a result content with multiple parts. </p></td>+ <td><p>The list of query histories. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.AICompletionResponse.Candidate.Content.Part">AICompletionResponse.Candidate.Content.Part</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-<tr>- <td>text</td>+ <td>next_page_token</td><td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>A token to retrieve next page of history.+Pass this value in the page_token field in the subsequent call to+`ListQueryHistories` method to retrieve the next page of history. </p></td></tr></tbody>@@ -13329,7 +13310,7 @@ for OpenAI and Gemini. </p></td>- <h3 id="bytebase.v1.AdminExecuteRequest">AdminExecuteRequest</h3>+ <h3 id="bytebase.v1.QueryHistory">QueryHistory</h3><p></p>@@ -13343,62 +13324,58 @@ for OpenAI and Gemini. </p></td><td>name</td><td><a href="#string">string</a></td><td></td>- <td><p>The name is the instance name to execute the query against.+ <td><p>The name for the query history.+Format: projects/{project}/queryHistories/{id} </p></td>+ </tr>++ <tr>+ <td>database</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The database name to execute the query.Format: instances/{instance}/databases/{databaseName} </p></td></tr><tr>- <td>statement</td>+ <td>creator</td><td><a href="#string">string</a></td><td></td>- <td><p>The SQL statement to execute. </p></td>+ <td><p> </p></td></tr><tr>- <td>limit</td>- <td><a href="#int32">int32</a></td>+ <td>create_time</td>+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td><td></td>- <td><p>The maximum number of rows to return. </p></td>+ <td><p> </p></td></tr><tr>- <td>schema</td>+ <td>statement</td><td><a href="#string">string</a></td>- <td>optional</td>- <td><p>The default schema to execute the statement. Equals to the current schema-in Oracle and search path in Postgres. </p></td>+ <td></td>+ <td><p> </p></td></tr><tr>- <td>container</td>+ <td>error</td><td><a href="#string">string</a></td><td>optional</td>- <td><p>Container is the container name to execute the query against, used for-CosmosDB only. </p></td>+ <td><p> </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.AdminExecuteResponse">AdminExecuteResponse</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>+ <tr>+ <td>duration</td>+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>+ <td></td>+ <td><p> </p></td>+ </tr><tr>- <td>results</td>- <td><a href="#bytebase.v1.QueryResult">QueryResult</a></td>- <td>repeated</td>- <td><p>The query results. </p></td>+ <td>type</td>+ <td><a href="#bytebase.v1.QueryHistory.Type">QueryHistory.Type</a></td>+ <td></td>+ <td><p> </p></td></tr></tbody>@@ -13408,7 +13385,7 @@ CosmosDB only. </p></td>- <h3 id="bytebase.v1.Advice">Advice</h3>+ <h3 id="bytebase.v1.SearchQueryHistoriesRequest">SearchQueryHistoriesRequest</h3><p></p>@@ -13419,8 +13396,468 @@ CosmosDB only. </p></td><tbody><tr>- <td>status</td>- <td><a href="#bytebase.v1.Advice.Level">Advice.Level</a></td>+ <td>parent</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The parent project to search query histories in.+Format: projects/{project}+The AIP-159 wildcard "projects/-" is not supported; use+ListQueryHistories for cross-project reads. </p></td>+ </tr>++ <tr>+ <td>page_size</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>The maximum number of histories to return.+The service may return fewer than this value.+If unspecified, at most 10 history entries will be returned.+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>+ </tr>++ <tr>+ <td>page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>A page token, received from a previous `ListQueryHistory` call.+Provide this to retrieve the subsequent page. </p></td>+ </tr>++ <tr>+ <td>filter</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>Filter is the filter to apply on the search query history+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Supported filter:+- project: the project full name in "projects/{id}" format, support "==" operator.+- database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.+- instance: the instance full name in "instances/{id}" format, support "==" operator.+- type: the type, should be "QUERY" or "EXPORT", support "==" operator.+- statement: the SQL statement, support ".contains()" operator.++For example:+project == "projects/{project}"+database == "instances/{instance}/databases/{database}"+instance == "instances/{instance}"+type == "QUERY"+type == "EXPORT"+statement.contains("select")+type == "QUERY" && statement.contains("select") </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.SearchQueryHistoriesResponse">SearchQueryHistoriesResponse</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>query_histories</td>+ <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>+ <td>repeated</td>+ <td><p>The list of history. </p></td>+ </tr>++ <tr>+ <td>next_page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>A token to retrieve next page of history.+Pass this value in the page_token field in the subsequent call to+`ListQueryHistory` method to retrieve the next page of history. </p></td>+ </tr>++ </tbody>+ </table>++++++++ <h3 id="bytebase.v1.QueryHistory.Type">QueryHistory.Type</h3>+ <p></p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>TYPE_UNSPECIFIED</td>+ <td>0</td>+ <td><p>Unspecified query history type.</p></td>+ </tr>++ <tr>+ <td>QUERY</td>+ <td>1</td>+ <td><p>Query execution for data retrieval.</p></td>+ </tr>++ <tr>+ <td>EXPORT</td>+ <td>2</td>+ <td><p>Data export operation to file.</p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.QueryHistoryService">QueryHistoryService</h3>+ <p>QueryHistoryService manages query history records of SQL Editor queries and exports.</p>+ <table class="enum-table">+ <thead>+ <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>SearchQueryHistories</td>+ <td><a href="#bytebase.v1.SearchQueryHistoriesRequest">SearchQueryHistoriesRequest</a></td>+ <td><a href="#bytebase.v1.SearchQueryHistoriesResponse">SearchQueryHistoriesResponse</a></td>+ <td><p>SearchQueryHistories searches query histories for the caller.+Permissions required: None (only returns caller's own query histories)</p></td>+ </tr>++ <tr>+ <td>ListQueryHistories</td>+ <td><a href="#bytebase.v1.ListQueryHistoriesRequest">ListQueryHistoriesRequest</a></td>+ <td><a href="#bytebase.v1.ListQueryHistoriesResponse">ListQueryHistoriesResponse</a></td>+ <td><p>ListQueryHistories lists query histories of all users in a project.+Permissions required: bb.queryHistories.list</p></td>+ </tr>++ <tr>+ <td>GetQueryHistory</td>+ <td><a href="#bytebase.v1.GetQueryHistoryRequest">GetQueryHistoryRequest</a></td>+ <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>+ <td><p>GetQueryHistory gets a single query history for the caller.+Permissions required: None (only returns the caller's own query history)</p></td>+ </tr>++ </tbody>+ </table>+++++ <h4>Methods with HTTP bindings</h4>+ <table>+ <thead>+ <tr>+ <td>Method Name</td>+ <td>Method</td>+ <td>Pattern</td>+ <td>Body</td>+ </tr>+ </thead>+ <tbody>++++ <tr>+ <td>SearchQueryHistories</td>+ <td>POST</td>+ <td>/v1/{parent=projects/*}/queryHistories:search</td>+ <td>*</td>+ </tr>+++++ <tr>+ <td>ListQueryHistories</td>+ <td>GET</td>+ <td>/v1/{parent=projects/*}/queryHistories</td>+ <td></td>+ </tr>+++++ <tr>+ <td>GetQueryHistory</td>+ <td>GET</td>+ <td>/v1/{name=projects/*/queryHistories/*}</td>+ <td></td>+ </tr>+++ </tbody>+ </table>+++++ <div class="file-heading">+ <h2 id="v1/sql_service.proto">v1/sql_service.proto</h2><a href="#title">Top</a>+ </div>+ <p></p>+++ <h3 id="bytebase.v1.AICompletionRequest">AICompletionRequest</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>messages</td>+ <td><a href="#bytebase.v1.AICompletionRequest.Message">AICompletionRequest.Message</a></td>+ <td>repeated</td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AICompletionRequest.Message">AICompletionRequest.Message</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>role</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>content</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AICompletionResponse">AICompletionResponse</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>candidates</td>+ <td><a href="#bytebase.v1.AICompletionResponse.Candidate">AICompletionResponse.Candidate</a></td>+ <td>repeated</td>+ <td><p>candidates is used for results with multiple choices and candidates. Used+for OpenAI and Gemini. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AICompletionResponse.Candidate">AICompletionResponse.Candidate</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>content</td>+ <td><a href="#bytebase.v1.AICompletionResponse.Candidate.Content">AICompletionResponse.Candidate.Content</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AICompletionResponse.Candidate.Content">AICompletionResponse.Candidate.Content</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>parts</td>+ <td><a href="#bytebase.v1.AICompletionResponse.Candidate.Content.Part">AICompletionResponse.Candidate.Content.Part</a></td>+ <td>repeated</td>+ <td><p>parts is used for a result content with multiple parts. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AICompletionResponse.Candidate.Content.Part">AICompletionResponse.Candidate.Content.Part</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>text</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AdminExecuteRequest">AdminExecuteRequest</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>name</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The name is the instance name to execute the query against.+Format: instances/{instance}/databases/{databaseName} </p></td>+ </tr>++ <tr>+ <td>statement</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The SQL statement to execute. </p></td>+ </tr>++ <tr>+ <td>limit</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>The maximum number of rows to return. </p></td>+ </tr>++ <tr>+ <td>schema</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p>The default schema to execute the statement. Equals to the current schema+in Oracle and search path in Postgres. </p></td>+ </tr>++ <tr>+ <td>container</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p>Container is the container name to execute the query against, used for+CosmosDB only. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AdminExecuteResponse">AdminExecuteResponse</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>results</td>+ <td><a href="#bytebase.v1.QueryResult">QueryResult</a></td>+ <td>repeated</td>+ <td><p>The query results. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.Advice">Advice</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>status</td>+ <td><a href="#bytebase.v1.Advice.Level">Advice.Level</a></td><td></td><td><p>The advice level. </p></td></tr>@@ -13620,214 +14057,30 @@ Oracle and search path in Postgres. </p></td>- <h3 id="bytebase.v1.ExportResponse">ExportResponse</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>content</td>- <td><a href="#bytes">bytes</a></td>- <td></td>- <td><p>The export file content. </p></td>- </tr>-- <tr>- <td>applied_access_grant</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The just-in-time access grant applied to this export, if any.-Format: projects/{project}/accessGrants/{accessGrant}.-Empty when the user was authorized through normal ACL rather than a grant. </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.GetQueryHistoryRequest">GetQueryHistoryRequest</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>name</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the query history to retrieve.-Format: projects/{project}/queryHistories/{id} </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.ListQueryHistoriesRequest">ListQueryHistoriesRequest</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>parent</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The parent project whose query histories are listed.-Format: projects/{project}-Use "projects/-" to list query histories across all projects-(https://google.aip.dev/159); this requires the bb.queryHistories.list-permission on the workspace. </p></td>- </tr>-- <tr>- <td>page_size</td>- <td><a href="#int32">int32</a></td>- <td></td>- <td><p>The maximum number of histories to return.-The service may return fewer than this value.-If unspecified, at most 10 history entries will be returned.-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>- </tr>-- <tr>- <td>page_token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>A page token, received from a previous `ListQueryHistories` call.-Provide this to retrieve the subsequent page. </p></td>- </tr>-- <tr>- <td>filter</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Filter is the filter to apply on the list query histories.-The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter:-- creator: the user full name in "users/{email}" format, support "==" operator.--For example:-creator == "users/{email}" </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.ListQueryHistoriesResponse">ListQueryHistoriesResponse</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>query_histories</td>- <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>- <td>repeated</td>- <td><p>The list of query histories. </p></td>- </tr>-- <tr>- <td>next_page_token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>A token to retrieve next page of history.-Pass this value in the page_token field in the subsequent call to-`ListQueryHistories` method to retrieve the next page of history. </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.MaskingReason">MaskingReason</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>semantic_type_id</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The semantic type that triggered masking (e.g., "SSN", "email", "phone"). </p></td>- </tr>-- <tr>- <td>semantic_type_title</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Human-readable semantic type title. </p></td>- </tr>-- <tr>- <td>masking_rule_id</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The masking rule ID that matched (if applicable). </p></td>- </tr>-- <tr>- <td>algorithm</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The masking algorithm used. </p></td>- </tr>-- <tr>- <td>context</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Additional context (e.g., "Matched global rule: PII Protection"). </p></td>- </tr>+ <h3 id="bytebase.v1.ExportResponse">ExportResponse</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody><tr>- <td>classification_level</td>- <td><a href="#int32">int32</a></td>+ <td>content</td>+ <td><a href="#bytes">bytes</a></td><td></td>- <td><p>The classification level that triggered masking. </p></td>+ <td><p>The export file content. </p></td></tr><tr>- <td>semantic_type_icon</td>+ <td>applied_access_grant</td><td><a href="#string">string</a></td><td></td>- <td><p>Icon associated with the semantic type (if any). </p></td>+ <td><p>The just-in-time access grant applied to this export, if any.+Format: projects/{project}/accessGrants/{accessGrant}.+Empty when the user was authorized through normal ACL rather than a grant. </p></td></tr></tbody>@@ -13837,7 +14090,7 @@ Pass this value in the page_token field in the subsequent call to- <h3 id="bytebase.v1.QueryHistory">QueryHistory</h3>+ <h3 id="bytebase.v1.MaskingReason">MaskingReason</h3><p></p>@@ -13848,61 +14101,52 @@ Pass this value in the page_token field in the subsequent call to<tbody><tr>- <td>name</td>+ <td>semantic_type_id</td><td><a href="#string">string</a></td><td></td>- <td><p>The name for the query history.-Format: projects/{project}/queryHistories/{id} </p></td>+ <td><p>The semantic type that triggered masking (e.g., "SSN", "email", "phone"). </p></td></tr><tr>- <td>database</td>+ <td>semantic_type_title</td><td><a href="#string">string</a></td><td></td>- <td><p>The database name to execute the query.-Format: instances/{instance}/databases/{databaseName} </p></td>+ <td><p>Human-readable semantic type title. </p></td></tr><tr>- <td>creator</td>+ <td>masking_rule_id</td><td><a href="#string">string</a></td><td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>create_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>- <td></td>- <td><p> </p></td>+ <td><p>The masking rule ID that matched (if applicable). </p></td></tr><tr>- <td>statement</td>+ <td>algorithm</td><td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>The masking algorithm used. </p></td></tr><tr>- <td>error</td>+ <td>context</td><td><a href="#string">string</a></td>- <td>optional</td>- <td><p> </p></td>+ <td></td>+ <td><p>Additional context (e.g., "Matched global rule: PII Protection"). </p></td></tr><tr>- <td>duration</td>- <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>+ <td>classification_level</td>+ <td><a href="#int32">int32</a></td><td></td>- <td><p> </p></td>+ <td><p>The classification level that triggered masking. </p></td></tr><tr>- <td>type</td>- <td><a href="#bytebase.v1.QueryHistory.Type">QueryHistory.Type</a></td>+ <td>semantic_type_icon</td>+ <td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>Icon associated with the semantic type (if any). </p></td></tr></tbody>@@ -14598,108 +14842,6 @@ time.Time.Zone() </p></td>- <h3 id="bytebase.v1.SearchQueryHistoriesRequest">SearchQueryHistoriesRequest</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>parent</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The parent project to search query histories in.-Format: projects/{project}-The AIP-159 wildcard "projects/-" is not supported; use-ListQueryHistories for cross-project reads. </p></td>- </tr>-- <tr>- <td>page_size</td>- <td><a href="#int32">int32</a></td>- <td></td>- <td><p>The maximum number of histories to return.-The service may return fewer than this value.-If unspecified, at most 10 history entries will be returned.-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>- </tr>-- <tr>- <td>page_token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>A page token, received from a previous `ListQueryHistory` call.-Provide this to retrieve the subsequent page. </p></td>- </tr>-- <tr>- <td>filter</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Filter is the filter to apply on the search query history-The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter:-- project: the project full name in "projects/{id}" format, support "==" operator.-- database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.-- instance: the instance full name in "instances/{id}" format, support "==" operator.-- type: the type, should be "QUERY" or "EXPORT", support "==" operator.-- statement: the SQL statement, support ".contains()" operator.--For example:-project == "projects/{project}"-database == "instances/{instance}/databases/{database}"-instance == "instances/{instance}"-type == "QUERY"-type == "EXPORT"-statement.contains("select")-type == "QUERY" && statement.contains("select") </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.SearchQueryHistoriesResponse">SearchQueryHistoriesResponse</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>query_histories</td>- <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>- <td>repeated</td>- <td><p>The list of history. </p></td>- </tr>-- <tr>- <td>next_page_token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>A token to retrieve next page of history.-Pass this value in the page_token field in the subsequent call to-`ListQueryHistory` method to retrieve the next page of history. </p></td>- </tr>-- </tbody>- </table>-----<h3 id="bytebase.v1.Advice.Level">Advice.Level</h3>@@ -14768,35 +14910,6 @@ These are custom, flexible checks powered by AI models.</p></td></tbody></table>- <h3 id="bytebase.v1.QueryHistory.Type">QueryHistory.Type</h3>- <p></p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>TYPE_UNSPECIFIED</td>- <td>0</td>- <td><p>Unspecified query history type.</p></td>- </tr>-- <tr>- <td>QUERY</td>- <td>1</td>- <td><p>Query execution for data retrieval.</p></td>- </tr>-- <tr>- <td>EXPORT</td>- <td>2</td>- <td><p>Data export operation to file.</p></td>- </tr>-- </tbody>- </table>-<h3 id="bytebase.v1.QueryOption.MSSQLExplainFormat">QueryOption.MSSQLExplainFormat</h3><p></p><table class="enum-table">@@ -14975,7 +15088,9 @@ Permissions required: bb.sql.admin</p></td><td>SearchQueryHistories</td><td><a href="#bytebase.v1.SearchQueryHistoriesRequest">SearchQueryHistoriesRequest</a></td><td><a href="#bytebase.v1.SearchQueryHistoriesResponse">SearchQueryHistoriesResponse</a></td>- <td><p>SearchQueryHistories searches query histories for the caller.+ <td><p>Deprecated: use QueryHistoryService.SearchQueryHistories instead.+Delegating alias kept for upgrade transition; will be removed in a future release.+No HTTP binding: the REST route is served by QueryHistoryService.Permissions required: None (only returns caller's own query histories)</p></td></tr>@@ -14983,7 +15098,9 @@ Permissions required: None (only returns caller's own query histories)</p></<td>ListQueryHistories</td><td><a href="#bytebase.v1.ListQueryHistoriesRequest">ListQueryHistoriesRequest</a></td><td><a href="#bytebase.v1.ListQueryHistoriesResponse">ListQueryHistoriesResponse</a></td>- <td><p>ListQueryHistories lists query histories of all users in a project.+ <td><p>Deprecated: use QueryHistoryService.ListQueryHistories instead.+Delegating alias kept for upgrade transition; will be removed in a future release.+No HTTP binding: the REST route is served by QueryHistoryService.Permissions required: bb.queryHistories.list</p></td></tr>@@ -14991,7 +15108,9 @@ Permissions required: bb.queryHistories.list</p></td><td>GetQueryHistory</td><td><a href="#bytebase.v1.GetQueryHistoryRequest">GetQueryHistoryRequest</a></td><td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>- <td><p>GetQueryHistory gets a single query history for the caller.+ <td><p>Deprecated: use QueryHistoryService.GetQueryHistory instead.+Delegating alias kept for upgrade transition; will be removed in a future release.+No HTTP binding: the REST route is served by QueryHistoryService.Permissions required: None (only returns the caller's own query history)</p></td></tr>@@ -15025,6 +15144,37 @@ Permissions required: None (authenticated users only, requires AI to be enabled)+ <h4>Methods with deprecated option</h4>+ <table>+ <thead>+ <tr>+ <td>Method Name</td>+ <td>Option</td>+ </tr>+ </thead>+ <tbody>++ <tr>+ <td>SearchQueryHistories</td>+ <td><p>true</p></td>+ </tr>++ <tr>+ <td>ListQueryHistories</td>+ <td><p>true</p></td>+ </tr>++ <tr>+ <td>GetQueryHistory</td>+ <td><p>true</p></td>+ </tr>++ </tbody>+ </table>++++<h4>Methods with HTTP bindings</h4><table><thead>@@ -15059,36 +15209,6 @@ Permissions required: None (authenticated users only, requires AI to be enabled)- <tr>- <td>SearchQueryHistories</td>- <td>POST</td>- <td>/v1/{parent=projects/*}/queryHistories:search</td>- <td>*</td>- </tr>----- <tr>- <td>ListQueryHistories</td>- <td>GET</td>- <td>/v1/{parent=projects/*}/queryHistories</td>- <td></td>- </tr>----- <tr>- <td>GetQueryHistory</td>- <td>GET</td>- <td>/v1/{name=projects/*/queryHistories/*}</td>- <td></td>- </tr>----<tr><td>Export</td><td>POST</td>diff --git a/proto/v1/v1/query_history_service.proto b/proto/v1/v1/query_history_service.protonew file mode 100644index 0000000000..3643a73515--- /dev/null+++ b/proto/v1/v1/query_history_service.proto@@ -0,0 +1,170 @@+syntax = "proto3";++package bytebase.v1;++import "google/api/annotations.proto";+import "google/api/client.proto";+import "google/api/field_behavior.proto";+import "google/api/resource.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/timestamp.proto";+import "v1/annotation.proto";++option go_package = "github.com/bytebase/bytebase/backend/generated-go/v1";++// QueryHistoryService manages query history records of SQL Editor queries and exports.+service QueryHistoryService {+ // SearchQueryHistories searches query histories for the caller.+ // Permissions required: None (only returns caller's own query histories)+ rpc SearchQueryHistories(SearchQueryHistoriesRequest) returns (SearchQueryHistoriesResponse) {+ option (google.api.http) = {+ post: "/v1/{parent=projects/*}/queryHistories:search"+ body: "*"+ };+ option (google.api.method_signature) = "parent";+ option (bytebase.v1.auth_method) = CUSTOM;+ }++ // ListQueryHistories lists query histories of all users in a project.+ // Permissions required: bb.queryHistories.list+ rpc ListQueryHistories(ListQueryHistoriesRequest) returns (ListQueryHistoriesResponse) {+ option (google.api.http) = {get: "/v1/{parent=projects/*}/queryHistories"};+ option (google.api.method_signature) = "parent";+ option (bytebase.v1.permission) = "bb.queryHistories.list";+ option (bytebase.v1.auth_method) = IAM;+ }++ // GetQueryHistory gets a single query history for the caller.+ // Permissions required: None (only returns the caller's own query history)+ rpc GetQueryHistory(GetQueryHistoryRequest) returns (QueryHistory) {+ option (google.api.http) = {get: "/v1/{name=projects/*/queryHistories/*}"};+ option (bytebase.v1.auth_method) = CUSTOM;+ }+}++message SearchQueryHistoriesRequest {+ // The parent project to search query histories in.+ // Format: projects/{project}+ // The AIP-159 wildcard "projects/-" is not supported; use+ // ListQueryHistories for cross-project reads.+ string parent = 4 [(google.api.field_behavior) = REQUIRED];++ // The maximum number of histories to return.+ // The service may return fewer than this value.+ // If unspecified, at most 10 history entries will be returned.+ // The maximum value is 1000; values above 1000 will be coerced to 1000.+ int32 page_size = 1;++ // A page token, received from a previous `ListQueryHistory` call.+ // Provide this to retrieve the subsequent page.+ string page_token = 2;++ // Filter is the filter to apply on the search query history+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+ //+ // Supported filter:+ // - project: the project full name in "projects/{id}" format, support "==" operator.+ // - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.+ // - instance: the instance full name in "instances/{id}" format, support "==" operator.+ // - type: the type, should be "QUERY" or "EXPORT", support "==" operator.+ // - statement: the SQL statement, support ".contains()" operator.+ //+ // For example:+ // project == "projects/{project}"+ // database == "instances/{instance}/databases/{database}"+ // instance == "instances/{instance}"+ // type == "QUERY"+ // type == "EXPORT"+ // statement.contains("select")+ // type == "QUERY" && statement.contains("select")+ string filter = 3;+}++message SearchQueryHistoriesResponse {+ // The list of history.+ repeated QueryHistory query_histories = 1 [(google.api.field_behavior) = OUTPUT_ONLY];++ // A token to retrieve next page of history.+ // Pass this value in the page_token field in the subsequent call to+ // `ListQueryHistory` method to retrieve the next page of history.+ string next_page_token = 2;+}++message ListQueryHistoriesRequest {+ // The parent project whose query histories are listed.+ // Format: projects/{project}+ // Use "projects/-" to list query histories across all projects+ // (https://google.aip.dev/159); this requires the bb.queryHistories.list+ // permission on the workspace.+ string parent = 1 [+ (google.api.field_behavior) = REQUIRED,+ (google.api.resource_reference) = {type: "bytebase.com/Project"}+ ];++ // The maximum number of histories to return.+ // The service may return fewer than this value.+ // If unspecified, at most 10 history entries will be returned.+ // The maximum value is 1000; values above 1000 will be coerced to 1000.+ int32 page_size = 2;++ // A page token, received from a previous `ListQueryHistories` call.+ // Provide this to retrieve the subsequent page.+ string page_token = 3;++ // Filter is the filter to apply on the list query histories.+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+ //+ // Supported filter:+ // - creator: the user full name in "users/{email}" format, support "==" operator.+ //+ // For example:+ // creator == "users/{email}"+ string filter = 4;+}++message ListQueryHistoriesResponse {+ // The list of query histories.+ repeated QueryHistory query_histories = 1 [(google.api.field_behavior) = OUTPUT_ONLY];++ // A token to retrieve next page of history.+ // Pass this value in the page_token field in the subsequent call to+ // `ListQueryHistories` method to retrieve the next page of history.+ string next_page_token = 2;+}++message GetQueryHistoryRequest {+ // The name of the query history to retrieve.+ // Format: projects/{project}/queryHistories/{id}+ string name = 1 [(google.api.field_behavior) = REQUIRED];+}++message QueryHistory {+ // The name for the query history.+ // Format: projects/{project}/queryHistories/{id}+ string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];++ // The database name to execute the query.+ // Format: instances/{instance}/databases/{databaseName}+ string database = 2 [(google.api.field_behavior) = OUTPUT_ONLY];++ string creator = 3 [(google.api.field_behavior) = OUTPUT_ONLY];++ google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];++ string statement = 5 [(google.api.field_behavior) = OUTPUT_ONLY];++ optional string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY];++ google.protobuf.Duration duration = 7 [(google.api.field_behavior) = OUTPUT_ONLY];++ enum Type {+ // Unspecified query history type.+ TYPE_UNSPECIFIED = 0;+ // Query execution for data retrieval.+ QUERY = 1;+ // Data export operation to file.+ EXPORT = 2;+ }++ Type type = 8;+}diff --git a/proto/v1/v1/sql_service.proto b/proto/v1/v1/sql_service.protoindex 838400ec10..dd2b5e724b 100644--- a/proto/v1/v1/sql_service.proto+++ b/proto/v1/v1/sql_service.proto@@ -3,7 +3,6 @@ syntax = "proto3";package bytebase.v1;import "google/api/annotations.proto";-import "google/api/client.proto";import "google/api/field_behavior.proto";import "google/api/resource.proto";import "google/protobuf/duration.proto";@@ -12,6 +11,7 @@ import "google/protobuf/timestamp.proto";import "v1/annotation.proto";import "v1/common.proto";import "v1/database_service.proto";+import "v1/query_history_service.proto";option go_package = "github.com/bytebase/bytebase/backend/generated-go/v1";@@ -39,30 +39,31 @@ service SQLService {option (bytebase.v1.audit) = true;}- // SearchQueryHistories searches query histories for the caller.+ // Deprecated: use QueryHistoryService.SearchQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns caller's own query histories)rpc SearchQueryHistories(SearchQueryHistoriesRequest) returns (SearchQueryHistoriesResponse) {- option (google.api.http) = {- post: "/v1/{parent=projects/*}/queryHistories:search"- body: "*"- };- option (google.api.method_signature) = "parent";+ option deprecated = true;option (bytebase.v1.auth_method) = CUSTOM;}- // ListQueryHistories lists query histories of all users in a project.+ // Deprecated: use QueryHistoryService.ListQueryHistories instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: bb.queryHistories.listrpc ListQueryHistories(ListQueryHistoriesRequest) returns (ListQueryHistoriesResponse) {- option (google.api.http) = {get: "/v1/{parent=projects/*}/queryHistories"};- option (google.api.method_signature) = "parent";+ option deprecated = true;option (bytebase.v1.permission) = "bb.queryHistories.list";option (bytebase.v1.auth_method) = IAM;}- // GetQueryHistory gets a single query history for the caller.+ // Deprecated: use QueryHistoryService.GetQueryHistory instead.+ // Delegating alias kept for upgrade transition; will be removed in a future release.+ // No HTTP binding: the REST route is served by QueryHistoryService.// Permissions required: None (only returns the caller's own query history)rpc GetQueryHistory(GetQueryHistoryRequest) returns (QueryHistory) {- option (google.api.http) = {get: "/v1/{name=projects/*/queryHistories/*}"};+ option deprecated = true;option (bytebase.v1.auth_method) = CUSTOM;}@@ -487,133 +488,6 @@ message DiffMetadataResponse {string diff = 1;}-message SearchQueryHistoriesRequest {- // The parent project to search query histories in.- // Format: projects/{project}- // The AIP-159 wildcard "projects/-" is not supported; use- // ListQueryHistories for cross-project reads.- string parent = 4 [(google.api.field_behavior) = REQUIRED];-- // The maximum number of histories to return.- // The service may return fewer than this value.- // If unspecified, at most 10 history entries will be returned.- // The maximum value is 1000; values above 1000 will be coerced to 1000.- int32 page_size = 1;-- // A page token, received from a previous `ListQueryHistory` call.- // Provide this to retrieve the subsequent page.- string page_token = 2;-- // Filter is the filter to apply on the search query history- // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec- //- // Supported filter:- // - project: the project full name in "projects/{id}" format, support "==" operator.- // - database: the database full name in "instances/{id}/databases/{name}" format, support "==" operator.- // - instance: the instance full name in "instances/{id}" format, support "==" operator.- // - type: the type, should be "QUERY" or "EXPORT", support "==" operator.- // - statement: the SQL statement, support ".contains()" operator.- //- // For example:- // project == "projects/{project}"- // database == "instances/{instance}/databases/{database}"- // instance == "instances/{instance}"- // type == "QUERY"- // type == "EXPORT"- // statement.contains("select")- // type == "QUERY" && statement.contains("select")- string filter = 3;-}--message ListQueryHistoriesRequest {- // The parent project whose query histories are listed.- // Format: projects/{project}- // Use "projects/-" to list query histories across all projects- // (https://google.aip.dev/159); this requires the bb.queryHistories.list- // permission on the workspace.- string parent = 1 [- (google.api.field_behavior) = REQUIRED,- (google.api.resource_reference) = {type: "bytebase.com/Project"}- ];-- // The maximum number of histories to return.- // The service may return fewer than this value.- // If unspecified, at most 10 history entries will be returned.- // The maximum value is 1000; values above 1000 will be coerced to 1000.- int32 page_size = 2;-- // A page token, received from a previous `ListQueryHistories` call.- // Provide this to retrieve the subsequent page.- string page_token = 3;-- // Filter is the filter to apply on the list query histories.- // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec- //- // Supported filter:- // - creator: the user full name in "users/{email}" format, support "==" operator.- //- // For example:- // creator == "users/{email}"- string filter = 4;-}--message ListQueryHistoriesResponse {- // The list of query histories.- repeated QueryHistory query_histories = 1 [(google.api.field_behavior) = OUTPUT_ONLY];-- // A token to retrieve next page of history.- // Pass this value in the page_token field in the subsequent call to- // `ListQueryHistories` method to retrieve the next page of history.- string next_page_token = 2;-}--message GetQueryHistoryRequest {- // The name of the query history to retrieve.- // Format: projects/{project}/queryHistories/{id}- string name = 1 [(google.api.field_behavior) = REQUIRED];-}--message SearchQueryHistoriesResponse {- // The list of history.- repeated QueryHistory query_histories = 1 [(google.api.field_behavior) = OUTPUT_ONLY];-- // A token to retrieve next page of history.- // Pass this value in the page_token field in the subsequent call to- // `ListQueryHistory` method to retrieve the next page of history.- string next_page_token = 2;-}--message QueryHistory {- // The name for the query history.- // Format: projects/{project}/queryHistories/{id}- string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];-- // The database name to execute the query.- // Format: instances/{instance}/databases/{databaseName}- string database = 2 [(google.api.field_behavior) = OUTPUT_ONLY];-- string creator = 3 [(google.api.field_behavior) = OUTPUT_ONLY];-- google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];-- string statement = 5 [(google.api.field_behavior) = OUTPUT_ONLY];-- optional string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY];-- google.protobuf.Duration duration = 7 [(google.api.field_behavior) = OUTPUT_ONLY];-- enum Type {- // Unspecified query history type.- TYPE_UNSPECIFIED = 0;- // Query execution for data retrieval.- QUERY = 1;- // Data export operation to file.- EXPORT = 2;- }-- Type type = 8;-}-message AICompletionRequest {message Message {string role = 1;