aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgalaxycrab <UgnineSirdis@ydb.tech>2023-05-11 10:02:58 +0300
committergalaxycrab <UgnineSirdis@ydb.tech>2023-05-11 10:02:58 +0300
commit297b23b904ab51363574b3402e5f831c8305ef7c (patch)
treeeca9d22c954c19e6e68833726ca85f1f829ed8f4
parent9001a9c48b9e1cd594739fc3522ff6b8664e5441 (diff)
downloadydb-297b23b904ab51363574b3402e5f831c8305ef7c.tar.gz
Improve API near saved script
-rw-r--r--ydb/public/api/protos/draft/ydb_query.proto31
1 files changed, 18 insertions, 13 deletions
diff --git a/ydb/public/api/protos/draft/ydb_query.proto b/ydb/public/api/protos/draft/ydb_query.proto
index 0682a6119ad..b61e4228dd7 100644
--- a/ydb/public/api/protos/draft/ydb_query.proto
+++ b/ydb/public/api/protos/draft/ydb_query.proto
@@ -200,8 +200,14 @@ message ExecuteQueryResponsePart {
Ydb.TableStats.QueryStats exec_stats = 7;
}
-message SavedScriptId {
+message VersionedScriptId {
+ // Script id
string id = 1 [(Ydb.length).le = 1024];
+
+ // Script revision.
+ // If specified in method parameters, the real script revision
+ // before modification will be compared with this revision
+ // and request will be cancelled if they don't match.
int64 revision = 2 [(Ydb.value) = ">= 0"];
}
@@ -215,7 +221,7 @@ message ExecuteScriptRequest {
oneof script {
QueryContent script_content = 5;
- SavedScriptId script_id = 6;
+ VersionedScriptId script_id = 6;
}
map<string, TypedValue> parameters = 7;
@@ -241,10 +247,8 @@ message ExecuteScriptMetadata {
string execution_id = 1 [(Ydb.length).le = 1024];
ExecStatus exec_status = 2;
- oneof script {
- QueryContent script_content = 3;
- SavedScriptId script_id = 4;
- }
+ QueryContent script_content = 3;
+ VersionedScriptId script_id = 4;
map<string, string> attributes = 5 [(map_key).length.range = {min: 1, max: 100}, (length).range = {min: 1, max: 4096}];
repeated ResultSetMeta result_set_meta = 6;
@@ -275,20 +279,21 @@ message FetchScriptResultsResponse {
string next_fetch_token = 5 [(Ydb.length).le = 1024];
}
-message SavedScript {
- SavedScriptId id = 1;
- QueryContent content = 2;
+message Script {
+ VersionedScriptId script_id = 1;
+ QueryContent script_content = 2;
}
message SaveScriptRequest {
- QueryContent content = 1;
+ VersionedScriptId script_id = 1; // If specified, set new content to existing script
+ QueryContent script_content = 2;
}
message SaveScriptResponse {
StatusIds.StatusCode status = 1;
repeated Ydb.Issue.IssueMessage issues = 2;
- SavedScriptId script_id = 3;
+ VersionedScriptId script_id = 3;
}
message ListScriptsRequest {
@@ -300,12 +305,12 @@ message ListScriptsResponse {
StatusIds.StatusCode status = 1;
repeated Ydb.Issue.IssueMessage issues = 2;
- repeated SavedScript scripts = 3;
+ repeated Script scripts = 3;
string next_page_token = 4 [(Ydb.length).le = 1024];
}
message DeleteScriptRequest {
- SavedScriptId script_id = 1;
+ VersionedScriptId script_id = 1;
}
message DeleteScriptResponse {