Skip to content

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

chore: export only return the last result (#11149)

p0ny94c4e52b0eda
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index a60d6bf65f..ee02bcf463 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -434,8 +434,9 @@ func (s *SQLService) doExport(ctx context.Context, request *v1pb.ExportRequest,
if err != nil {
return nil, durationNs, err
}
- if len(result) != 1 {
- return nil, durationNs, errors.Errorf("expecting 1 result, but got %d", len(result))
+ // only return the last result
+ if len(result) > 1 {
+ result = result[len(result)-1:]
}
var content []byte
diff --git a/backend/api/v1/sql_service_v2.go b/backend/api/v1/sql_service_v2.go
index e9239f0715..1fa6b91848 100644
--- a/backend/api/v1/sql_service_v2.go
+++ b/backend/api/v1/sql_service_v2.go
@@ -285,8 +285,9 @@ func (s *SQLService) doExportV2(ctx context.Context, request *v1pb.ExportRequest
if err != nil {
return nil, durationNs, err
}
- if len(result) != 1 {
- return nil, durationNs, errors.Errorf("expecting 1 result, but got %d", len(result))
+ // only return the last result
+ if len(result) > 1 {
+ result = result[len(result)-1:]
}
if s.licenseService.IsFeatureEnabledForInstance(api.FeatureSensitiveData, instance) == nil {