Skip to content

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

chore(sql-editor): add execute api definition (#11550)

boojacka2e082167f9e
diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.proto
index 95d9c5c643..beb8f8ca1a 100644
--- a/proto/v1/sql_service.proto
+++ b/proto/v1/sql_service.proto
@@ -21,6 +21,18 @@ service SQLService {
};
}
+ rpc Execute(ExecuteRequest) returns (ExecuteResponse) {
+ option (google.api.http) = {
+ post: "/v1/{name=instances/*/databases/*}:execute"
+ additional_bindings {post: "/v1/{name=instances/*}:execute"}
+ body: "*"
+ };
+ }
+
+ rpc AdminExecute(stream AdminExecuteRequest) returns (stream AdminExecuteResponse) {
+ option (google.api.http) = {get: "/v1:adminExecute"};
+ }
+
rpc SearchQueryHistories(SearchQueryHistoriesRequest) returns (SearchQueryHistoriesResponse) {
option (google.api.http) = {get: "/v1/queryHistories:search"};
}
@@ -34,10 +46,6 @@ service SQLService {
};
}
- rpc AdminExecute(stream AdminExecuteRequest) returns (stream AdminExecuteResponse) {
- option (google.api.http) = {get: "/v1:adminExecute"};
- }
-
rpc DifferPreview(DifferPreviewRequest) returns (DifferPreviewResponse) {
option (google.api.http) = {
post: "/v1/sql/differPreview"
@@ -74,44 +82,33 @@ service SQLService {
}
}
-message DifferPreviewRequest {
- Engine engine = 1;
-
- string old_schema = 2;
-
- DatabaseMetadata new_metadata = 3;
-}
-
-message DifferPreviewResponse {
- string schema = 1;
-}
-
-message AdminExecuteRequest {
+message ExecuteRequest {
// The name is the instance name to execute the query against.
// Format: instances/{instance}/databases/{databaseName}
string name = 1;
- string connection_database = 2 [deprecated = true];
-
// The SQL statement to execute.
- string statement = 3;
+ string statement = 2;
// The maximum number of rows to return.
- int32 limit = 4;
+ int32 limit = 3;
// The timeout for the request.
- google.protobuf.Duration timeout = 5;
+ google.protobuf.Duration timeout = 4;
}
-message AdminExecuteResponse {
- // The query results.
+message ExecuteResponse {
+ // The execute results.
repeated QueryResult results = 1;
+
+ // The execute advices.
+ repeated Advice advices = 2;
}
-message ExportRequest {
+message AdminExecuteRequest {
// The name is the instance name to execute the query against.
// Format: instances/{instance}/databases/{databaseName}
- string name = 1 [(google.api.field_behavior) = REQUIRED];
+ string name = 1;
string connection_database = 2 [deprecated = true];
@@ -121,20 +118,13 @@ message ExportRequest {
// The maximum number of rows to return.
int32 limit = 4;
- // The export format.
- ExportFormat format = 5;
-
- // The admin is used for workspace owner and DBA for exporting data from SQL Editor Admin mode.
- // The exported data is not masked.
- bool admin = 6;
-
- // The zip password provide by users.
- string password = 7;
+ // The timeout for the request.
+ google.protobuf.Duration timeout = 5;
}
-message ExportResponse {
- // The export file content.
- bytes content = 1;
+message AdminExecuteResponse {
+ // The query results.
+ repeated QueryResult results = 1;
}
message QueryRequest {
@@ -249,6 +239,47 @@ message Advice {
string detail = 7;
}
+message ExportRequest {
+ // The name is the instance name to execute the query against.
+ // Format: instances/{instance}/databases/{databaseName}
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
+
+ string connection_database = 2 [deprecated = true];
+
+ // The SQL statement to execute.
+ string statement = 3;
+
+ // The maximum number of rows to return.
+ int32 limit = 4;
+
+ // The export format.
+ ExportFormat format = 5;
+
+ // The admin is used for workspace owner and DBA for exporting data from SQL Editor Admin mode.
+ // The exported data is not masked.
+ bool admin = 6;
+
+ // The zip password provide by users.
+ string password = 7;
+}
+
+message ExportResponse {
+ // The export file content.
+ bytes content = 1;
+}
+
+message DifferPreviewRequest {
+ Engine engine = 1;
+
+ string old_schema = 2;
+
+ DatabaseMetadata new_metadata = 3;
+}
+
+message DifferPreviewResponse {
+ string schema = 1;
+}
+
message PrettyRequest {
Engine engine = 1;