Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add ListQueryHistories API for listing a project's query histories across users (#20932)
Danny Xubb44f0d98496
diff --git a/.sonarcloud.properties b/.sonarcloud.propertiesindex 88e5908421..64df05bb50 100644--- a/.sonarcloud.properties+++ b/.sonarcloud.properties@@ -6,6 +6,8 @@ sonar.exclusions=\backend/generated-go/**,\backend/migrator/migration/**,\backend/api/mcp/gen/**,\+ frontend/src/types/proto-es/**,\+ frontend/src/types/iam/permission-generated.ts,\proto/gen/**,\bytebase-build/**,\frontend/node_modules/**,\diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 7db533a6ee..7f3ed9a65c 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -5603,6 +5603,44 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.QueryHistory'+ /bytebase.v1.SQLService/ListQueryHistories:+ post:+ tags:+ - bytebase.v1.SQLService+ summary: ListQueryHistories+ description: |-+ ListQueryHistories lists query histories of all users in a project.+ Permissions required: bb.queryHistories.list+ operationId: bytebase.v1.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'/bytebase.v1.SQLService/Query:post:tags:@@ -13929,6 +13967,62 @@ components:title: planstitle: ListPurchasePlansResponseadditionalProperties: false+ bytebase.v1.ListQueryHistoriesRequest:+ type: object+ properties:+ parent:+ type: string+ title: parent+ description: |-+ The parent project whose query histories are listed.+ Format: projects/{project}+ pageSize:+ type: integer+ title: page_size+ format: int32+ description: |-+ 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.+ pageToken:+ type: string+ title: page_token+ description: |-+ A page token, received from a previous `ListQueryHistories` call.+ Provide this to retrieve the subsequent page.+ filter:+ type: string+ title: filter+ description: |-+ 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}"+ title: ListQueryHistoriesRequest+ additionalProperties: false+ bytebase.v1.ListQueryHistoriesResponse:+ type: object+ properties:+ queryHistories:+ type: array+ items:+ $ref: '#/components/schemas/bytebase.v1.QueryHistory'+ title: query_histories+ description: The list of query histories.+ nextPageToken:+ type: string+ title: next_page_token+ description: |-+ 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.+ title: ListQueryHistoriesResponse+ additionalProperties: falsebytebase.v1.ListReleaseCategoriesRequest:type: objectproperties:diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex d91d479132..5ed616f86b 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -1408,60 +1408,106 @@ func (s *SQLService) createQueryHistory(database *store.DatabaseMessage, queryTy// SearchQueryHistories lists query histories.func (s *SQLService) SearchQueryHistories(ctx context.Context, req *connect.Request[v1pb.SearchQueryHistoriesRequest]) (*connect.Response[v1pb.SearchQueryHistoriesResponse], error) {request := req.Msg- offset, err := parseLimitAndOffset(&pageSize{- token: request.PageToken,- limit: int(request.PageSize),- maximum: 1000,- })- if err != nil {- return nil, err- }- limitPlusOne := offset.limit + 1-user, ok := GetUserFromContext(ctx)if !ok {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))}- find := &store.FindQueryHistoryMessage{- Creator: &user.Email,- Limit: &limitPlusOne,- Offset: &offset.offset,- }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, &store.FindQueryHistoryMessage{+ Creator: &user.Email,+ FilterQ: filterQ,+ }, request.PageToken, request.PageSize)+ if err != nil {+ return nil, err+ }+ return connect.NewResponse(&v1pb.SearchQueryHistoriesResponse{+ QueryHistories: histories,+ NextPageToken: nextPageToken,+ }), 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 *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.offsethistoryList, err := s.store.ListQueryHistories(ctx, find)if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to list history: %v", err.Error()))+ 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"))+ return nil, "", connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to marshal next page token"))}}- resp := &v1pb.SearchQueryHistoriesResponse{- NextPageToken: nextPageToken,- }+ var histories []*v1pb.QueryHistoryfor _, 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"))+ return nil, "", connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert log entity"))}if queryHistory == nil {continue}- resp.QueryHistories = append(resp.QueryHistories, queryHistory)+ histories = append(histories, queryHistory)}+ return histories, nextPageToken, nil+}- return connect.NewResponse(resp), nil+// ListQueryHistories lists query histories of all users in a project. The IAM+// interceptor checks bb.queryHistories.list on the parent project.+func (s *SQLService) ListQueryHistories(ctx context.Context, req *connect.Request[v1pb.ListQueryHistoriesRequest]) (*connect.Response[v1pb.ListQueryHistoriesResponse], error) {+ request := req.Msg+ projectID, err := common.GetProjectID(request.Parent)+ if err != nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }+ project, err := s.store.GetProject(ctx, &store.FindProjectMessage{+ Workspace: common.GetWorkspaceIDFromContext(ctx),+ ResourceID: &projectID,+ })+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get project"))+ }+ if project == nil {+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("project %q not found", request.Parent))+ }++ creator, err := store.GetListQueryHistoriesCreatorFilter(request.Filter)+ if err != nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }++ histories, nextPageToken, err := s.paginatedQueryHistories(ctx, &store.FindQueryHistoryMessage{+ Project: &projectID,+ Creator: creator,+ }, 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 todiff --git a/backend/common/permission/permission.go b/backend/common/permission/permission.goindex a13db8e71b..4a252c64dd 100644--- a/backend/common/permission/permission.go+++ b/backend/common/permission/permission.go@@ -81,6 +81,7 @@ const (ProjectsSetIAMPolicy Permission = "bb.projects.setIamPolicy"ProjectsUndelete Permission = "bb.projects.undelete"ProjectsUpdate Permission = "bb.projects.update"+ QueryHistoriesList Permission = "bb.queryHistories.list"ReleasesCheck Permission = "bb.releases.check"ReleasesCreate Permission = "bb.releases.create"ReleasesDelete Permission = "bb.releases.delete"diff --git a/backend/common/permission/permission.yaml b/backend/common/permission/permission.yamlindex e4b9670977..9e373eef01 100644--- a/backend/common/permission/permission.yaml+++ b/backend/common/permission/permission.yaml@@ -73,6 +73,7 @@ permissions:- bb.projects.setIamPolicy- bb.projects.undelete- bb.projects.update+ - bb.queryHistories.list- bb.releases.check- bb.releases.create- bb.releases.deletediff --git a/backend/generated-go/v1/sql_service.pb.go b/backend/generated-go/v1/sql_service.pb.goindex 4547dc9587..a748b03466 100644--- a/backend/generated-go/v1/sql_service.pb.go+++ b/backend/generated-go/v1/sql_service.pb.go@@ -410,7 +410,7 @@ func (x QueryHistory_Type) Number() protoreflect.EnumNumber {// Deprecated: Use QueryHistory_Type.Descriptor instead.func (QueryHistory_Type) EnumDescriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{17, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{19, 0}}type AdminExecuteRequest struct {@@ -1834,6 +1834,146 @@ func (x *SearchQueryHistoriesRequest) GetFilter() string {return ""}+type ListQueryHistoriesRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The parent project whose query histories are listed.+ // Format: projects/{project}+ 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.@@ -1845,7 +1985,7 @@ type GetQueryHistoryRequest struct {func (x *GetQueryHistoryRequest) Reset() {*x = GetQueryHistoryRequest{}- mi := &file_v1_sql_service_proto_msgTypes[15]+ mi := &file_v1_sql_service_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1857,7 +1997,7 @@ func (x *GetQueryHistoryRequest) String() string {func (*GetQueryHistoryRequest) ProtoMessage() {}func (x *GetQueryHistoryRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[15]+ mi := &file_v1_sql_service_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1870,7 +2010,7 @@ func (x *GetQueryHistoryRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetQueryHistoryRequest.ProtoReflect.Descriptor instead.func (*GetQueryHistoryRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{15}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{17}}func (x *GetQueryHistoryRequest) GetName() string {@@ -1894,7 +2034,7 @@ type SearchQueryHistoriesResponse struct {func (x *SearchQueryHistoriesResponse) Reset() {*x = SearchQueryHistoriesResponse{}- mi := &file_v1_sql_service_proto_msgTypes[16]+ mi := &file_v1_sql_service_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1906,7 +2046,7 @@ func (x *SearchQueryHistoriesResponse) String() string {func (*SearchQueryHistoriesResponse) ProtoMessage() {}func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[16]+ mi := &file_v1_sql_service_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1919,7 +2059,7 @@ func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use SearchQueryHistoriesResponse.ProtoReflect.Descriptor instead.func (*SearchQueryHistoriesResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{16}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{18}}func (x *SearchQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {@@ -1956,7 +2096,7 @@ type QueryHistory struct {func (x *QueryHistory) Reset() {*x = QueryHistory{}- mi := &file_v1_sql_service_proto_msgTypes[17]+ mi := &file_v1_sql_service_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1968,7 +2108,7 @@ func (x *QueryHistory) String() string {func (*QueryHistory) ProtoMessage() {}func (x *QueryHistory) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[17]+ mi := &file_v1_sql_service_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1981,7 +2121,7 @@ func (x *QueryHistory) ProtoReflect() protoreflect.Message {// Deprecated: Use QueryHistory.ProtoReflect.Descriptor instead.func (*QueryHistory) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{17}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{19}}func (x *QueryHistory) GetName() string {@@ -2049,7 +2189,7 @@ type AICompletionRequest struct {func (x *AICompletionRequest) Reset() {*x = AICompletionRequest{}- mi := &file_v1_sql_service_proto_msgTypes[18]+ mi := &file_v1_sql_service_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2061,7 +2201,7 @@ func (x *AICompletionRequest) String() string {func (*AICompletionRequest) ProtoMessage() {}func (x *AICompletionRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[18]+ mi := &file_v1_sql_service_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2074,7 +2214,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{18}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{20}}func (x *AICompletionRequest) GetMessages() []*AICompletionRequest_Message {@@ -2095,7 +2235,7 @@ type AICompletionResponse struct {func (x *AICompletionResponse) Reset() {*x = AICompletionResponse{}- mi := &file_v1_sql_service_proto_msgTypes[19]+ mi := &file_v1_sql_service_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2107,7 +2247,7 @@ func (x *AICompletionResponse) String() string {func (*AICompletionResponse) ProtoMessage() {}func (x *AICompletionResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[19]+ mi := &file_v1_sql_service_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2120,7 +2260,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{19}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{21}}func (x *AICompletionResponse) GetCandidates() []*AICompletionResponse_Candidate {@@ -2157,7 +2297,7 @@ type QueryResult_PostgresError struct {func (x *QueryResult_PostgresError) Reset() {*x = QueryResult_PostgresError{}- mi := &file_v1_sql_service_proto_msgTypes[20]+ mi := &file_v1_sql_service_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2169,7 +2309,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[20]+ mi := &file_v1_sql_service_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2315,7 +2455,7 @@ type QueryResult_SyntaxError struct {func (x *QueryResult_SyntaxError) Reset() {*x = QueryResult_SyntaxError{}- mi := &file_v1_sql_service_proto_msgTypes[21]+ mi := &file_v1_sql_service_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2327,7 +2467,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[21]+ mi := &file_v1_sql_service_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2362,7 +2502,7 @@ type QueryResult_CommandError struct {func (x *QueryResult_CommandError) Reset() {*x = QueryResult_CommandError{}- mi := &file_v1_sql_service_proto_msgTypes[22]+ mi := &file_v1_sql_service_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2374,7 +2514,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[22]+ mi := &file_v1_sql_service_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2407,7 +2547,7 @@ type QueryResult_Message struct {func (x *QueryResult_Message) Reset() {*x = QueryResult_Message{}- mi := &file_v1_sql_service_proto_msgTypes[23]+ mi := &file_v1_sql_service_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2419,7 +2559,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[23]+ mi := &file_v1_sql_service_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2460,7 +2600,7 @@ type RowValue_Timestamp struct {func (x *RowValue_Timestamp) Reset() {*x = RowValue_Timestamp{}- mi := &file_v1_sql_service_proto_msgTypes[24]+ mi := &file_v1_sql_service_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2472,7 +2612,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[24]+ mi := &file_v1_sql_service_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2521,7 +2661,7 @@ type RowValue_TimestampTZ struct {func (x *RowValue_TimestampTZ) Reset() {*x = RowValue_TimestampTZ{}- mi := &file_v1_sql_service_proto_msgTypes[25]+ mi := &file_v1_sql_service_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2533,7 +2673,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[25]+ mi := &file_v1_sql_service_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2587,7 +2727,7 @@ type AICompletionRequest_Message struct {func (x *AICompletionRequest_Message) Reset() {*x = AICompletionRequest_Message{}- mi := &file_v1_sql_service_proto_msgTypes[26]+ mi := &file_v1_sql_service_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2599,7 +2739,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[26]+ mi := &file_v1_sql_service_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2612,7 +2752,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{18, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{20, 0}}func (x *AICompletionRequest_Message) GetRole() string {@@ -2638,7 +2778,7 @@ type AICompletionResponse_Candidate struct {func (x *AICompletionResponse_Candidate) Reset() {*x = AICompletionResponse_Candidate{}- mi := &file_v1_sql_service_proto_msgTypes[27]+ mi := &file_v1_sql_service_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2650,7 +2790,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[27]+ mi := &file_v1_sql_service_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2663,7 +2803,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{19, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0}}func (x *AICompletionResponse_Candidate) GetContent() *AICompletionResponse_Candidate_Content {@@ -2683,7 +2823,7 @@ type AICompletionResponse_Candidate_Content struct {func (x *AICompletionResponse_Candidate_Content) Reset() {*x = AICompletionResponse_Candidate_Content{}- mi := &file_v1_sql_service_proto_msgTypes[28]+ mi := &file_v1_sql_service_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2695,7 +2835,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[28]+ mi := &file_v1_sql_service_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2708,7 +2848,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{19, 0, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0, 0}}func (x *AICompletionResponse_Candidate_Content) GetParts() []*AICompletionResponse_Candidate_Content_Part {@@ -2727,7 +2867,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[29]+ mi := &file_v1_sql_service_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2739,7 +2879,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[29]+ mi := &file_v1_sql_service_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2752,7 +2892,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{19, 0, 0, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0, 0, 0}}func (x *AICompletionResponse_Candidate_Content_Part) GetText() string {@@ -2766,7 +2906,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\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\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" +"\x13AdminExecuteRequest\x121\n" +"\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" +"\x15bytebase.com/DatabaseR\x04name\x12\x1c\n" +@@ -2949,7 +3089,17 @@ const file_v1_sql_service_proto_rawDesc = "" +"\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\"1\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" +@@ -2985,12 +3135,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\xcf\b\n" ++ "\x04text\x18\x01 \x01(\tR\x04text2\x8e\n" ++ "\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\x95\x01\n" +- "\x14SearchQueryHistories\x12(.bytebase.v1.SearchQueryHistoriesRequest\x1a).bytebase.v1.SearchQueryHistoriesResponse\"(\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/v1/queryHistories:search\x12\x85\x01\n" ++ "\x14SearchQueryHistories\x12(.bytebase.v1.SearchQueryHistoriesRequest\x1a).bytebase.v1.SearchQueryHistoriesResponse\"(\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/v1/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" +"\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" +@@ -3010,7 +3162,7 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {}var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 7)-var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 30)+var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 32)var file_v1_sql_service_proto_goTypes = []any{(QueryOption_RedisRunCommandsOn)(0), // 0: bytebase.v1.QueryOption.RedisRunCommandsOn(QueryOption_MSSQLExplainFormat)(0), // 1: bytebase.v1.QueryOption.MSSQLExplainFormat@@ -3034,30 +3186,32 @@ var file_v1_sql_service_proto_goTypes = []any{(*DiffMetadataRequest)(nil), // 19: bytebase.v1.DiffMetadataRequest(*DiffMetadataResponse)(nil), // 20: bytebase.v1.DiffMetadataResponse(*SearchQueryHistoriesRequest)(nil), // 21: bytebase.v1.SearchQueryHistoriesRequest- (*GetQueryHistoryRequest)(nil), // 22: bytebase.v1.GetQueryHistoryRequest- (*SearchQueryHistoriesResponse)(nil), // 23: bytebase.v1.SearchQueryHistoriesResponse- (*QueryHistory)(nil), // 24: bytebase.v1.QueryHistory- (*AICompletionRequest)(nil), // 25: bytebase.v1.AICompletionRequest- (*AICompletionResponse)(nil), // 26: bytebase.v1.AICompletionResponse- (*QueryResult_PostgresError)(nil), // 27: bytebase.v1.QueryResult.PostgresError- (*QueryResult_SyntaxError)(nil), // 28: bytebase.v1.QueryResult.SyntaxError- (*QueryResult_CommandError)(nil), // 29: bytebase.v1.QueryResult.CommandError- (*QueryResult_Message)(nil), // 30: bytebase.v1.QueryResult.Message- (*RowValue_Timestamp)(nil), // 31: bytebase.v1.RowValue.Timestamp- (*RowValue_TimestampTZ)(nil), // 32: bytebase.v1.RowValue.TimestampTZ- (*AICompletionRequest_Message)(nil), // 33: bytebase.v1.AICompletionRequest.Message- (*AICompletionResponse_Candidate)(nil), // 34: bytebase.v1.AICompletionResponse.Candidate- (*AICompletionResponse_Candidate_Content)(nil), // 35: bytebase.v1.AICompletionResponse.Candidate.Content- (*AICompletionResponse_Candidate_Content_Part)(nil), // 36: bytebase.v1.AICompletionResponse.Candidate.Content.Part- (*durationpb.Duration)(nil), // 37: google.protobuf.Duration- (*PermissionDeniedDetail)(nil), // 38: bytebase.v1.PermissionDeniedDetail- (structpb.NullValue)(0), // 39: google.protobuf.NullValue- (*structpb.Value)(nil), // 40: google.protobuf.Value- (*Position)(nil), // 41: bytebase.v1.Position- (ExportFormat)(0), // 42: bytebase.v1.ExportFormat- (*DatabaseMetadata)(nil), // 43: bytebase.v1.DatabaseMetadata- (Engine)(0), // 44: bytebase.v1.Engine- (*timestamppb.Timestamp)(nil), // 45: google.protobuf.Timestamp+ (*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}var file_v1_sql_service_proto_depIdxs = []int32{12, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult@@ -3066,58 +3220,61 @@ var file_v1_sql_service_proto_depIdxs = []int32{0, // 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.MSSQLExplainFormat14, // 5: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow- 37, // 6: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration- 27, // 7: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError- 28, // 8: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError- 38, // 9: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.PermissionDeniedDetail- 29, // 10: bytebase.v1.QueryResult.command_error:type_name -> bytebase.v1.QueryResult.CommandError- 30, // 11: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message+ 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.Message13, // 12: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason15, // 13: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue- 39, // 14: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue- 40, // 15: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value- 31, // 16: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp- 32, // 17: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ+ 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.TimestampTZ4, // 18: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Level- 41, // 19: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position- 41, // 20: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position+ 43, // 19: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position+ 43, // 20: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position5, // 21: bytebase.v1.Advice.rule_type:type_name -> bytebase.v1.Advice.RuleType- 42, // 22: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat- 43, // 23: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata- 43, // 24: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata- 44, // 25: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine- 24, // 26: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory- 45, // 27: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp- 37, // 28: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration- 6, // 29: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type- 33, // 30: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message- 34, // 31: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate- 41, // 32: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position- 2, // 33: bytebase.v1.QueryResult.CommandError.command_type:type_name -> bytebase.v1.QueryResult.CommandError.Type- 3, // 34: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level- 45, // 35: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp- 45, // 36: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp- 35, // 37: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content- 36, // 38: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part- 9, // 39: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest- 7, // 40: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest- 21, // 41: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest- 22, // 42: bytebase.v1.SQLService.GetQueryHistory:input_type -> bytebase.v1.GetQueryHistoryRequest- 17, // 43: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest- 19, // 44: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest- 25, // 45: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest- 10, // 46: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse- 8, // 47: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse- 23, // 48: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse- 24, // 49: bytebase.v1.SQLService.GetQueryHistory:output_type -> bytebase.v1.QueryHistory- 18, // 50: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse- 20, // 51: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse- 26, // 52: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse- 46, // [46:53] is the sub-list for method output_type- 39, // [39:46] is the sub-list for method input_type- 39, // [39:39] is the sub-list for extension type_name- 39, // [39:39] is the sub-list for extension extendee- 0, // [0:39] is the sub-list for field type_name+ 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}func init() { file_v1_sql_service_proto_init() }@@ -3152,14 +3309,14 @@ 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[17].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: 30,+ NumMessages: 32,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 e49918efd2..69698e616d 100644--- a/backend/generated-go/v1/sql_service.pb.gw.go+++ b/backend/generated-go/v1/sql_service.pb.gw.go@@ -150,6 +150,59 @@ func local_request_SQLService_SearchQueryHistories_0(ctx context.Context, marshareturn 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@@ -431,6 +484,26 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,}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()@@ -642,6 +715,23 @@ func RegisterSQLServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,}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()@@ -751,6 +841,7 @@ 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}, []string{"v1", "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"))@@ -763,6 +854,7 @@ var (forward_SQLService_Query_0 = runtime.ForwardResponseMessageforward_SQLService_AdminExecute_0 = runtime.ForwardResponseStreamforward_SQLService_SearchQueryHistories_0 = runtime.ForwardResponseMessage+ forward_SQLService_ListQueryHistories_0 = runtime.ForwardResponseMessageforward_SQLService_GetQueryHistory_0 = runtime.ForwardResponseMessageforward_SQLService_Export_0 = runtime.ForwardResponseMessageforward_SQLService_Export_1 = runtime.ForwardResponseMessagediff --git a/backend/generated-go/v1/sql_service_equal.pb.go b/backend/generated-go/v1/sql_service_equal.pb.goindex 4a53755700..2d4f2a061b 100644--- a/backend/generated-go/v1/sql_service_equal.pb.go+++ b/backend/generated-go/v1/sql_service_equal.pb.go@@ -570,6 +570,49 @@ func (x *SearchQueryHistoriesRequest) Equal(y *SearchQueryHistoriesRequest) boolreturn 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 truediff --git a/backend/generated-go/v1/sql_service_grpc.pb.go b/backend/generated-go/v1/sql_service_grpc.pb.goindex d738628b62..3a7e4ad755 100644--- a/backend/generated-go/v1/sql_service_grpc.pb.go+++ b/backend/generated-go/v1/sql_service_grpc.pb.go@@ -22,6 +22,7 @@ const (SQLService_Query_FullMethodName = "/bytebase.v1.SQLService/Query"SQLService_AdminExecute_FullMethodName = "/bytebase.v1.SQLService/AdminExecute"SQLService_SearchQueryHistories_FullMethodName = "/bytebase.v1.SQLService/SearchQueryHistories"+ SQLService_ListQueryHistories_FullMethodName = "/bytebase.v1.SQLService/ListQueryHistories"SQLService_GetQueryHistory_FullMethodName = "/bytebase.v1.SQLService/GetQueryHistory"SQLService_Export_FullMethodName = "/bytebase.v1.SQLService/Export"SQLService_DiffMetadata_FullMethodName = "/bytebase.v1.SQLService/DiffMetadata"@@ -43,6 +44,9 @@ type SQLServiceClient 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)@@ -98,6 +102,16 @@ func (c *sQLServiceClient) SearchQueryHistories(ctx context.Context, in *SearchQreturn out, nil}+func (c *sQLServiceClient) 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, SQLService_ListQueryHistories_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+func (c *sQLServiceClient) GetQueryHistory(ctx context.Context, in *GetQueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistory, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(QueryHistory)@@ -153,6 +167,9 @@ type SQLServiceServer 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)@@ -184,6 +201,9 @@ func (UnimplementedSQLServiceServer) AdminExecute(grpc.BidiStreamingServer[Adminfunc (UnimplementedSQLServiceServer) SearchQueryHistories(context.Context, *SearchQueryHistoriesRequest) (*SearchQueryHistoriesResponse, error) {return nil, status.Error(codes.Unimplemented, "method SearchQueryHistories not implemented")}+func (UnimplementedSQLServiceServer) ListQueryHistories(context.Context, *ListQueryHistoriesRequest) (*ListQueryHistoriesResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method ListQueryHistories not implemented")+}func (UnimplementedSQLServiceServer) GetQueryHistory(context.Context, *GetQueryHistoryRequest) (*QueryHistory, error) {return nil, status.Error(codes.Unimplemented, "method GetQueryHistory not implemented")}@@ -260,6 +280,24 @@ func _SQLService_SearchQueryHistories_Handler(srv interface{}, ctx context.Contereturn interceptor(ctx, in, info, handler)}+func _SQLService_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.(SQLServiceServer).ListQueryHistories(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: SQLService_ListQueryHistories_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(SQLServiceServer).ListQueryHistories(ctx, req.(*ListQueryHistoriesRequest))+ }+ return interceptor(ctx, in, info, handler)+}+func _SQLService_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 {@@ -347,6 +385,10 @@ var SQLService_ServiceDesc = grpc.ServiceDesc{MethodName: "SearchQueryHistories",Handler: _SQLService_SearchQueryHistories_Handler,},+ {+ MethodName: "ListQueryHistories",+ Handler: _SQLService_ListQueryHistories_Handler,+ },{MethodName: "GetQueryHistory",Handler: _SQLService_GetQueryHistory_Handler,diff --git a/backend/generated-go/v1/v1connect/sql_service.connect.go b/backend/generated-go/v1/v1connect/sql_service.connect.goindex 505ef6cddf..fc8bfd1e57 100644--- a/backend/generated-go/v1/v1connect/sql_service.connect.go+++ b/backend/generated-go/v1/v1connect/sql_service.connect.go@@ -40,6 +40,9 @@ const (// SQLServiceSearchQueryHistoriesProcedure is the fully-qualified name of the SQLService's// SearchQueryHistories RPC.SQLServiceSearchQueryHistoriesProcedure = "/bytebase.v1.SQLService/SearchQueryHistories"+ // SQLServiceListQueryHistoriesProcedure is the fully-qualified name of the SQLService's+ // ListQueryHistories RPC.+ SQLServiceListQueryHistoriesProcedure = "/bytebase.v1.SQLService/ListQueryHistories"// SQLServiceGetQueryHistoryProcedure is the fully-qualified name of the SQLService's// GetQueryHistory RPC.SQLServiceGetQueryHistoryProcedure = "/bytebase.v1.SQLService/GetQueryHistory"@@ -62,6 +65,9 @@ type SQLServiceClient 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)@@ -105,6 +111,12 @@ func NewSQLServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.WithSchema(sQLServiceMethods.ByName("SearchQueryHistories")),connect.WithClientOptions(opts...),),+ listQueryHistories: connect.NewClient[v1.ListQueryHistoriesRequest, v1.ListQueryHistoriesResponse](+ httpClient,+ baseURL+SQLServiceListQueryHistoriesProcedure,+ connect.WithSchema(sQLServiceMethods.ByName("ListQueryHistories")),+ connect.WithClientOptions(opts...),+ ),getQueryHistory: connect.NewClient[v1.GetQueryHistoryRequest, v1.QueryHistory](httpClient,baseURL+SQLServiceGetQueryHistoryProcedure,@@ -137,6 +149,7 @@ type sQLServiceClient struct {query *connect.Client[v1.QueryRequest, v1.QueryResponse]adminExecute *connect.Client[v1.AdminExecuteRequest, v1.AdminExecuteResponse]searchQueryHistories *connect.Client[v1.SearchQueryHistoriesRequest, v1.SearchQueryHistoriesResponse]+ listQueryHistories *connect.Client[v1.ListQueryHistoriesRequest, v1.ListQueryHistoriesResponse]getQueryHistory *connect.Client[v1.GetQueryHistoryRequest, v1.QueryHistory]export *connect.Client[v1.ExportRequest, v1.ExportResponse]diffMetadata *connect.Client[v1.DiffMetadataRequest, v1.DiffMetadataResponse]@@ -158,6 +171,11 @@ func (c *sQLServiceClient) SearchQueryHistories(ctx context.Context, req *connecreturn c.searchQueryHistories.CallUnary(ctx, req)}+// ListQueryHistories calls bytebase.v1.SQLService.ListQueryHistories.+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.func (c *sQLServiceClient) GetQueryHistory(ctx context.Context, req *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error) {return c.getQueryHistory.CallUnary(ctx, req)@@ -189,6 +207,9 @@ type SQLServiceHandler 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)@@ -228,6 +249,12 @@ func NewSQLServiceHandler(svc SQLServiceHandler, opts ...connect.HandlerOption)connect.WithSchema(sQLServiceMethods.ByName("SearchQueryHistories")),connect.WithHandlerOptions(opts...),)+ sQLServiceListQueryHistoriesHandler := connect.NewUnaryHandler(+ SQLServiceListQueryHistoriesProcedure,+ svc.ListQueryHistories,+ connect.WithSchema(sQLServiceMethods.ByName("ListQueryHistories")),+ connect.WithHandlerOptions(opts...),+ )sQLServiceGetQueryHistoryHandler := connect.NewUnaryHandler(SQLServiceGetQueryHistoryProcedure,svc.GetQueryHistory,@@ -260,6 +287,8 @@ func NewSQLServiceHandler(svc SQLServiceHandler, opts ...connect.HandlerOption)sQLServiceAdminExecuteHandler.ServeHTTP(w, r)case SQLServiceSearchQueryHistoriesProcedure:sQLServiceSearchQueryHistoriesHandler.ServeHTTP(w, r)+ case SQLServiceListQueryHistoriesProcedure:+ sQLServiceListQueryHistoriesHandler.ServeHTTP(w, r)case SQLServiceGetQueryHistoryProcedure:sQLServiceGetQueryHistoryHandler.ServeHTTP(w, r)case SQLServiceExportProcedure:@@ -289,6 +318,10 @@ func (UnimplementedSQLServiceHandler) SearchQueryHistories(context.Context, *conreturn nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SQLService.SearchQueryHistories is not implemented"))}+func (UnimplementedSQLServiceHandler) ListQueryHistories(context.Context, *connect.Request[v1.ListQueryHistoriesRequest]) (*connect.Response[v1.ListQueryHistoriesResponse], error) {+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SQLService.ListQueryHistories is not implemented"))+}+func (UnimplementedSQLServiceHandler) GetQueryHistory(context.Context, *connect.Request[v1.GetQueryHistoryRequest]) (*connect.Response[v1.QueryHistory], error) {return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SQLService.GetQueryHistory is not implemented"))}diff --git a/backend/migrator/migration/3.21/0000##add_query_history_project_created_at_index.sql b/backend/migrator/migration/3.21/0000##add_query_history_project_created_at_index.sqlnew file mode 100644index 0000000000..910c157c1f--- /dev/null+++ b/backend/migrator/migration/3.21/0000##add_query_history_project_created_at_index.sql@@ -0,0 +1 @@+CREATE INDEX idx_query_history_project_created_at ON query_history(project, created_at DESC);diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex 316a82bb69..71c44e2fd2 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -438,6 +438,8 @@ CREATE TABLE query_history (CREATE INDEX idx_query_history_creator_created_at_project ON query_history(creator, created_at, project DESC);+CREATE INDEX idx_query_history_project_created_at ON query_history(project, created_at DESC);+------------------------- Instance and instance-scoped tables-----------------------diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex befa362f5e..2affbac84c 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -15,8 +15,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.20.4"), *files[len(files)-1].version)- require.Equal(t, "migration/3.20/0004##restore_maximum_role_expiration.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.21.0"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.21/0000##add_query_history_project_created_at_index.sql", files[len(files)-1].path)}func TestVersionUnique(t *testing.T) {diff --git a/backend/store/predefined_roles.go b/backend/store/predefined_roles.goindex 18859f5b70..c97d7ecfb3 100644--- a/backend/store/predefined_roles.go+++ b/backend/store/predefined_roles.go@@ -100,6 +100,7 @@ var PredefinedRoles = []*RoleMessage{permission.ProjectsSetIAMPolicy,permission.ProjectsUndelete,permission.ProjectsUpdate,+ permission.QueryHistoriesList,permission.ReleasesCheck,permission.ReleasesCreate,permission.ReleasesDelete,@@ -384,6 +385,7 @@ var PredefinedRoles = []*RoleMessage{permission.ProjectsGetIAMPolicy,permission.ProjectsSetIAMPolicy,permission.ProjectsUpdate,+ permission.QueryHistoriesList,permission.ReleasesCheck,permission.ReleasesCreate,permission.ReleasesDelete,diff --git a/backend/store/query_history.go b/backend/store/query_history.goindex f9c940eb09..612cc495a7 100644--- a/backend/store/query_history.go+++ b/backend/store/query_history.go@@ -310,3 +310,39 @@ func GetListQueryHistoryFilter(filter string) (*qb.Query, error) {}return qb.Q().Space("(?)", q), nil}++// GetListQueryHistoriesCreatorFilter parses the ListQueryHistories filter,+// which supports only `creator == "users/{email}"`, and returns the creator+// email. Returns nil when the filter is empty.+func GetListQueryHistoriesCreatorFilter(filter string) (*string, error) {+ if filter == "" {+ return nil, nil+ }++ e, err := cel.NewEnv()+ if err != nil {+ return nil, errors.Errorf("failed to create cel env")+ }+ ast, iss := e.Parse(filter)+ if iss != nil {+ return nil, errors.Errorf("failed to parse filter %v, error: %v", filter, iss.String())+ }++ expr := ast.NativeRep().Expr()+ if expr.Kind() != celast.CallKind || expr.AsCall().FunctionName() != celoperators.Equals {+ return nil, errors.Errorf(`only 'creator == "users/{email}"' filter is supported`)+ }+ variable, value := getVariableAndValueFromExpr(expr)+ if variable != "creator" {+ return nil, errors.Errorf(`unsupport variable %q, only "creator" is supported`, variable)+ }+ strValue, ok := value.(string)+ if !ok {+ return nil, errors.Errorf("expect string, got %T, hint: filter literals should be string", value)+ }+ email, err := common.GetUserEmail(strValue)+ if err != nil {+ return nil, errors.Errorf("invalid creator filter %q, expect users/{email}", strValue)+ }+ return &email, nil+}diff --git a/backend/store/query_history_filter_test.go b/backend/store/query_history_filter_test.goindex a82c016026..c64bb310fe 100644--- a/backend/store/query_history_filter_test.go+++ b/backend/store/query_history_filter_test.go@@ -307,3 +307,75 @@ func TestGetListQueryHistoryFilter_CompareWithOriginal(t *testing.T) {})}}++func TestGetListQueryHistoriesCreatorFilter(t *testing.T) {+ tests := []struct {+ name string+ filter string+ wantCreator *string+ errContains string+ }{+ {+ name: "empty filter",+ filter: "",+ wantCreator: nil,+ },+ {+ name: "creator filter",+ filter: `creator == "users/[email protected]"`,+ wantCreator: stringPtr("[email protected]"),+ },+ {+ name: "unsupported variable",+ filter: `project == "projects/test-project"`,+ errContains: `only "creator" is supported`,+ },+ {+ name: "unsupported logical operator",+ filter: `creator == "users/[email protected]" && creator == "users/[email protected]"`,+ errContains: "filter is supported",+ },+ {+ name: "unsupported contains operator",+ filter: `creator.contains("alice")`,+ errContains: "filter is supported",+ },+ {+ name: "invalid creator format",+ filter: `creator == "[email protected]"`,+ errContains: "expect users/{email}",+ },+ {+ name: "non-string literal",+ filter: `creator == 123`,+ errContains: "expect string",+ },+ {+ name: "invalid CEL",+ filter: `creator ==`,+ errContains: "failed to parse filter",+ },+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ creator, err := GetListQueryHistoriesCreatorFilter(tt.filter)+ if tt.errContains != "" {+ require.Error(t, err)+ require.Contains(t, err.Error(), tt.errContains)+ return+ }+ require.NoError(t, err)+ if tt.wantCreator == nil {+ require.Nil(t, creator)+ return+ }+ require.NotNil(t, creator)+ require.Equal(t, *tt.wantCreator, *creator)+ })+ }+}++func stringPtr(s string) *string {+ return &s+}diff --git a/backend/tests/query_history_test.go b/backend/tests/query_history_test.gonew file mode 100644index 0000000000..e949343193--- /dev/null+++ b/backend/tests/query_history_test.go@@ -0,0 +1,190 @@+package tests++import (+ "context"+ "fmt"+ "testing"++ "connectrpc.com/connect"+ "github.com/stretchr/testify/require"++ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"+)++// 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.+func TestListQueryHistories(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ ctx := context.Background()+ ctl := &controller{}+ ctx, err := ctl.StartServerWithExternalPg(ctx)+ a.NoError(err)+ defer ctl.Close(ctx)++ ownerToken := ctl.authInterceptor.token+ const ownerEmail = "[email protected]"++ pgContainer, err := getPgContainer(ctx)+ defer func() {+ pgContainer.Close(ctx)+ }()+ a.NoError(err)++ // 1. Create a Postgres instance + database as the owner.+ instanceResp, err := ctl.instanceServiceClient.CreateInstance(ctx, connect.NewRequest(&v1pb.CreateInstanceRequest{+ InstanceId: generateRandomString("instance"),+ Instance: &v1pb.Instance{+ Title: "pgInstance",+ Engine: v1pb.Engine_POSTGRES,+ Environment: new("environments/prod"),+ Activation: true,+ DataSources: []*v1pb.DataSource{{Type: v1pb.DataSourceType_ADMIN, Host: pgContainer.host, Port: pgContainer.port, Username: "postgres", Password: "root-password", Id: "admin"}},+ },+ }))+ a.NoError(err)+ instance := instanceResp.Msg++ const databaseName = "history_db"+ err = ctl.createDatabase(ctx, ctl.project, instance, nil, databaseName, "postgres")+ a.NoError(err)++ databaseResp, err := ctl.databaseServiceClient.GetDatabase(ctx, connect.NewRequest(&v1pb.GetDatabaseRequest{+ Name: fmt.Sprintf("%s/databases/%s", instance.Name, databaseName),+ }))+ a.NoError(err)+ database := databaseResp.Msg++ // 2. Run queries as the owner to generate query histories.+ for _, statement := range []string{"SELECT 1;", "SELECT 2;"} {+ queryResp, err := ctl.sqlServiceClient.Query(ctx, connect.NewRequest(&v1pb.QueryRequest{+ Name: database.Name,+ Statement: statement,+ Limit: 10,+ }))+ a.NoError(err)+ a.Len(queryResp.Msg.Results, 1)+ }++ // Grab one history name for the GetQueryHistory checks below.+ searchResp, err := ctl.sqlServiceClient.SearchQueryHistories(ctx, connect.NewRequest(&v1pb.SearchQueryHistoriesRequest{+ Filter: fmt.Sprintf("project == %q", ctl.project.Name),+ }))+ a.NoError(err)+ a.GreaterOrEqual(len(searchResp.Msg.QueryHistories), 2)+ historyName := searchResp.Msg.QueryHistories[0].Name++ // 3. Create an auditor user with no project role yet.+ auditorEmail := fmt.Sprintf("auditor-%[email protected]", generateRandomString("u"))+ auditorPassword := "1024bytebase"+ auditorUser, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{+ User: &v1pb.User{+ Email: auditorEmail,+ Password: auditorPassword,+ Title: "Auditor User",+ },+ }))+ a.NoError(err)+ _, err = ctl.addMemberToWorkspaceIAM(ctx, auditorUser.Msg.Workspace, fmt.Sprintf("user:%s", auditorEmail), "roles/workspaceMember")+ a.NoError(err)++ loginResp, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{+ Email: auditorEmail,+ Password: auditorPassword,+ }))+ a.NoError(err)+ auditorToken := loginResp.Msg.Token++ // 4. Without bb.queryHistories.list: List is denied, Get hides existence.+ ctl.authInterceptor.token = auditorToken++ _, err = ctl.sqlServiceClient.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{+ Name: historyName,+ }))+ a.Error(err)+ a.Equal(connect.CodeNotFound, connect.CodeOf(err))++ // 5. Grant a custom role carrying only bb.queryHistories.list on the project.+ ctl.authInterceptor.token = ownerToken+ _, err = ctl.roleServiceClient.CreateRole(ctx, connect.NewRequest(&v1pb.CreateRoleRequest{+ Role: &v1pb.Role{+ Title: "query-history-auditor",+ Permissions: []string{"bb.queryHistories.list"},+ },+ RoleId: "query-history-auditor",+ }))+ a.NoError(err)++ policyResp, err := ctl.projectServiceClient.GetIamPolicy(ctx, connect.NewRequest(&v1pb.GetIamPolicyRequest{+ Resource: ctl.project.Name,+ }))+ a.NoError(err)+ policy := policyResp.Msg+ policy.Bindings = append(policy.Bindings, &v1pb.Binding{+ Role: "roles/query-history-auditor",+ Members: []string{fmt.Sprintf("user:%s", auditorEmail)},+ })+ _, err = ctl.projectServiceClient.SetIamPolicy(ctx, connect.NewRequest(&v1pb.SetIamPolicyRequest{+ Resource: ctl.project.Name,+ Policy: policy,+ }))+ a.NoError(err)++ // 6. With the grant: the auditor lists other users' histories.+ ctl.authInterceptor.token = auditorToken++ listResp, err := ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ Parent: ctl.project.Name,+ }))+ a.NoError(err)+ a.GreaterOrEqual(len(listResp.Msg.QueryHistories), 2)+ for _, history := range listResp.Msg.QueryHistories {+ a.Equal(fmt.Sprintf("users/%s", ownerEmail), history.Creator)+ }++ // Creator filter pins to the given user.+ listResp, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ Parent: ctl.project.Name,+ Filter: fmt.Sprintf("creator == \"users/%s\"", ownerEmail),+ }))+ a.NoError(err)+ 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{+ Parent: ctl.project.Name,+ Filter: fmt.Sprintf("creator == \"users/%s\"", auditorEmail),+ }))+ a.NoError(err)+ a.Empty(listResp.Msg.QueryHistories)++ // Only the creator filter is supported.+ _, err = ctl.sqlServiceClient.ListQueryHistories(ctx, connect.NewRequest(&v1pb.ListQueryHistoriesRequest{+ Parent: ctl.project.Name,+ Filter: `type == "QUERY"`,+ }))+ a.Error(err)+ a.Equal(connect.CodeInvalidArgument, connect.CodeOf(err))++ // 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{+ 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{}))+ a.NoError(err)+ a.Empty(searchResp.Msg.QueryHistories)++ ctl.authInterceptor.token = ownerToken+}diff --git a/frontend/src/types/iam/permission-generated.ts b/frontend/src/types/iam/permission-generated.tsindex 3d867ff15e..330732c639 100644--- a/frontend/src/types/iam/permission-generated.ts+++ b/frontend/src/types/iam/permission-generated.ts@@ -76,6 +76,7 @@ export type Permission =| "bb.projects.setIamPolicy"| "bb.projects.undelete"| "bb.projects.update"+ | "bb.queryHistories.list"| "bb.releases.check"| "bb.releases.create"| "bb.releases.delete"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 e125d5bf38..52a2f3d408 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@@ -1201,6 +1201,84 @@ export declare type SearchQueryHistoriesRequest = Message<"bytebase.v1.SearchQue*/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}+ *+ * @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*/@@ -1480,6 +1558,17 @@ export declare const SQLService: GenService<{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.SQLService.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)diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.js b/frontend/src/types/proto-es/v1/sql_service_pb.jsindex 28e5ef8547..13691b2964 100644--- a/frontend/src/types/proto-es/v1/sql_service_pb.js+++ b/frontend/src/types/proto-es/v1/sql_service_pb.js@@ -4,6 +4,7 @@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";@@ -15,7 +16,7 @@ import { file_v1_database_service } from "./database_service_pb";* Describes the file v1/sql_service.proto.*/export const file_v1_sql_service = /*@__PURE__*/- fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiqgEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAIgASgJEg0KBWxpbWl0GAMgASgFEhMKBnNjaGVtYRgEIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgFIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lciJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQi/AEKDFF1ZXJ5UmVxdWVzdBIrCgRuYW1lGAEgASgJQ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bnMvKi9yb2xsb3V0L3N0YWdlcy8qfTpleHBvcnQiKS92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKn06ZXhwb3J0EoEBCgxEaWZmTWV0YWRhdGESIC5ieXRlYmFzZS52MS5EaWZmTWV0YWRhdGFSZXF1ZXN0GiEuYnl0ZWJhc2UudjEuRGlmZk1ldGFkYXRhUmVzcG9uc2UiLIDqMAGC0+STAiI6ASoiHS92MS9zY2hlbWFEZXNpZ246ZGlmZk1ldGFkYXRhEngKDEFJQ29tcGxldGlvbhIgLmJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlcXVlc3QaIS5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXNwb25zZSIjkOowAoLT5JMCGToBKiIUL3YxL3NxbC9haUNvbXBsZXRpb25CpQEKD2NvbS5ieXRlYmFzZS52MUIPU3FsU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [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]);+ fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiqgEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAIgASgJEg0KBWxpbWl0GAMgASgFEhMKBnNjaGVtYRgEIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgFIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lciJBChRBZ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mJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlc3BvbnNlIiOQ6jACgtPkkwIZOgEqIhQvdjEvc3FsL2FpQ29tcGxldGlvbkKlAQoPY29tLmJ5dGViYXNlLnYxQg9TcWxTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [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]);/*** Describes the message bytebase.v1.AdminExecuteRequest.@@ -240,32 +241,46 @@ export const DiffMetadataResponseSchema = /*@__PURE__*/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, 15);+ 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, 16);+ 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, 17);+ messageDesc(file_v1_sql_service, 19);/*** Describes the enum bytebase.v1.QueryHistory.Type.*/export const QueryHistory_TypeSchema = /*@__PURE__*/- enumDesc(file_v1_sql_service, 17, 0);+ enumDesc(file_v1_sql_service, 19, 0);/*** @generated from enum bytebase.v1.QueryHistory.Type@@ -278,42 +293,42 @@ export const QueryHistory_Type = /*@__PURE__*/* Use `create(AICompletionRequestSchema)` to create a new message.*/export const AICompletionRequestSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 18);+ messageDesc(file_v1_sql_service, 20);/*** 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, 18, 0);+ messageDesc(file_v1_sql_service, 20, 0);/*** Describes the message bytebase.v1.AICompletionResponse.* Use `create(AICompletionResponseSchema)` to create a new message.*/export const AICompletionResponseSchema = /*@__PURE__*/- messageDesc(file_v1_sql_service, 19);+ messageDesc(file_v1_sql_service, 21);/*** 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, 19, 0);+ messageDesc(file_v1_sql_service, 21, 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, 19, 0, 0);+ messageDesc(file_v1_sql_service, 21, 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, 19, 0, 0, 0);+ messageDesc(file_v1_sql_service, 21, 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 cbec23bc9c..a43aa9337c 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -9937,6 +9937,62 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.Policy'+ /v1/projects/{project}/queryHistories:+ get:+ tags:+ - SQLService+ summary: ListQueryHistories+ description: |-+ ListQueryHistories lists query histories of all users in a project.+ Permissions required: bb.queryHistories.list+ operationId: SQLService_ListQueryHistories+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ - name: pageSize+ in: query+ description: |-+ 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.+ schema:+ type: integer+ title: page_size+ format: int32+ - name: pageToken+ in: query+ description: |-+ A page token, received from a previous `ListQueryHistories` call.+ Provide this to retrieve the subsequent page.+ schema:+ type: string+ title: page_token+ - name: filter+ in: query+ description: |-+ 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}"+ schema:+ type: string+ title: filter+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListQueryHistoriesResponse'/v1/projects/{project}/queryHistories/{queryHistory}:get:tags:@@ -22111,6 +22167,65 @@ components:title: planstitle: ListPurchasePlansResponseadditionalProperties: false+ bytebase.v1.ListQueryHistoriesRequest:+ type: object+ properties:+ parent:+ type: string+ title: parent+ description: |-+ The parent project whose query histories are listed.+ Format: projects/{project}+ pageSize:+ type: integer+ title: page_size+ format: int32+ description: |-+ 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.+ pageToken:+ type: string+ title: page_token+ description: |-+ A page token, received from a previous `ListQueryHistories` call.+ Provide this to retrieve the subsequent page.+ filter:+ type: string+ title: filter+ description: |-+ 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}"+ title: ListQueryHistoriesRequest+ required:+ - parent+ additionalProperties: false+ bytebase.v1.ListQueryHistoriesResponse:+ type: object+ properties:+ queryHistories:+ type: array+ items:+ $ref: '#/components/schemas/bytebase.v1.QueryHistory'+ title: query_histories+ description: The list of query histories.+ readOnly: true+ nextPageToken:+ type: string+ title: next_page_token+ description: |-+ 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.+ title: ListQueryHistoriesResponse+ additionalProperties: falsebytebase.v1.ListReleaseCategoriesRequest:type: objectproperties:diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 6dd1436e7b..0802e01f42 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -237,6 +237,8 @@- [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)@@ -4587,6 +4589,44 @@ DatabaseService manages databases and their schemas.+<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} |+| 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@@ -5016,6 +5056,7 @@ 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) || 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 |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 6b25c2ed9b..4bcfd9025f 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -1087,6 +1087,14 @@<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>@@ -13869,6 +13877,96 @@ Format: projects/{project}/queryHistories/{id} </p></td>+ <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} </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>@@ -15067,6 +15165,14 @@ Permissions required: bb.sql.admin</p></td>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>@@ -15149,6 +15255,16 @@ Permissions required: None (authenticated users only, requires AI to be enabled)+ <tr>+ <td>ListQueryHistories</td>+ <td>GET</td>+ <td>/v1/{parent=projects/*}/queryHistories</td>+ <td></td>+ </tr>++++<tr><td>GetQueryHistory</td><td>GET</td>diff --git a/proto/v1/v1/sql_service.proto b/proto/v1/v1/sql_service.protoindex 2a416dc7cd..f404808d9e 100644--- a/proto/v1/v1/sql_service.proto+++ b/proto/v1/v1/sql_service.proto@@ -3,6 +3,7 @@ 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";@@ -48,6 +49,15 @@ service SQLService {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) {@@ -508,6 +518,45 @@ message SearchQueryHistoriesRequest {string filter = 3;}+message ListQueryHistoriesRequest {+ // The parent project whose query histories are listed.+ // Format: projects/{project}+ 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}