From 72fcd1c264fb53933bfcfe1043491a9f12e05abd Mon Sep 17 00:00:00 2001 From: Daniil Demin Date: Tue, 11 Feb 2025 12:33:44 +0000 Subject: [PATCH 1/2] add external data source public API for description --- ydb/public/api/grpc/ydb_table_v1.proto | 8 ++- ydb/public/api/protos/ydb_table.proto | 89 ++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/ydb/public/api/grpc/ydb_table_v1.proto b/ydb/public/api/grpc/ydb_table_v1.proto index 2c2053404c7e..9591942f5095 100644 --- a/ydb/public/api/grpc/ydb_table_v1.proto +++ b/ydb/public/api/grpc/ydb_table_v1.proto @@ -10,7 +10,7 @@ service TableService { // Create new session. Implicit session creation is forbidden, // so user must create new session before execute any query, // otherwise BAD_SESSION status will be returned. - // Simultaneous execution of requests are forbiden. + // Simultaneous execution of requests are forbidden. // Sessions are volatile, can be invalidated by server, for example in case // of fatal errors. All requests with this session will fail with BAD_SESSION status. // So, client must be able to handle BAD_SESSION status. @@ -85,4 +85,10 @@ service TableService { // Executes scan query with streaming result. rpc StreamExecuteScanQuery(Table.ExecuteScanQueryRequest) returns (stream Table.ExecuteScanQueryPartialResponse); + + // Returns information about a given external data source. + rpc DescribeExternalDataSource(Table.DescribeExternalDataSourceRequest) returns (Table.DescribeExternalDataSourceResponse); + + // Returns information about a given external table. + rpc DescribeExternalTable(Table.DescribeExternalTableRequest) returns (Table.DescribeExternalTableResponse); } diff --git a/ydb/public/api/protos/ydb_table.proto b/ydb/public/api/protos/ydb_table.proto index f21a3b2749d0..2a70148ffbe9 100644 --- a/ydb/public/api/protos/ydb_table.proto +++ b/ydb/public/api/protos/ydb_table.proto @@ -1294,3 +1294,92 @@ message ExecuteScanQueryPartialResult { // collects additional diagnostics about query compilation, including query plan and scheme string query_full_diagnostics = 7; } + +// Returns information about an external data source with a given path. +message DescribeExternalDataSourceRequest { + Ydb.Operations.OperationParams operation_params = 1; + string path = 2; +} + +message DescribeExternalDataSourceResponse { + // Holds DescribeExternalDataSourceResult in case of a successful call. + Ydb.Operations.Operation operation = 1; +} + +message ExternalAuthorization { + + // Access without authorization. + message None { + } + + message Basic { + optional string login = 1; + optional string password_secret_name = 2; + } + + message Token { + optional string token_secret_name = 1; + } + + message Aws { + optional string access_key_secret_name = 1; + optional string secret_key_secret_name = 2; + optional string aws_region = 3; + } + + message ServiceAccount { + optional string id = 1; + optional string secret_name = 2; + } + + message MdbBasic { + optional string service_account_id = 1; + optional string service_account_secret_name = 2; + optional string login = 3; + optional string password_secret_name = 4; + } + + oneof identity { + None none = 1; + Basic basic = 2; + Token token = 3; + Aws aws = 4; + ServiceAccount service_account = 5; + MdbBasic mdb_basic = 6; + } +} + +message ExternalDataSourceProperties { + map properties = 1; +} + +message DescribeExternalDataSourceResult { + // Description of a generic scheme object. + Ydb.Scheme.Entry self = 1; + optional string source_type = 2; + optional string location = 3; + optional string installation = 4; + optional ExternalAuthorization authorization = 5; + optional ExternalDataSourceProperties properties = 6; +} + +// Returns information about an external table with a given path. +message DescribeExternalTableRequest { + Ydb.Operations.OperationParams operation_params = 1; + string path = 2; +} + +message DescribeExternalTableResponse { + // Holds DescribeExternalTableResult in case of a successful call. + Ydb.Operations.Operation operation = 1; +} + +message DescribeExternalTableResult { + // Description of a generic scheme object. + Ydb.Scheme.Entry self = 1; + optional string source_type = 2; + optional string data_source_path = 3; + optional string location = 4; + repeated ColumnMeta columns = 5; + optional bytes content = 6; +} From 810de8ba1453ca271dbb4f90183d1a523beb1faf Mon Sep 17 00:00:00 2001 From: Daniil Demin Date: Wed, 12 Feb 2025 07:37:05 +0000 Subject: [PATCH 2/2] make properties a map + make content a map too --- ydb/public/api/protos/ydb_table.proto | 53 +-------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/ydb/public/api/protos/ydb_table.proto b/ydb/public/api/protos/ydb_table.proto index 2a70148ffbe9..a101f3a08493 100644 --- a/ydb/public/api/protos/ydb_table.proto +++ b/ydb/public/api/protos/ydb_table.proto @@ -1306,61 +1306,12 @@ message DescribeExternalDataSourceResponse { Ydb.Operations.Operation operation = 1; } -message ExternalAuthorization { - - // Access without authorization. - message None { - } - - message Basic { - optional string login = 1; - optional string password_secret_name = 2; - } - - message Token { - optional string token_secret_name = 1; - } - - message Aws { - optional string access_key_secret_name = 1; - optional string secret_key_secret_name = 2; - optional string aws_region = 3; - } - - message ServiceAccount { - optional string id = 1; - optional string secret_name = 2; - } - - message MdbBasic { - optional string service_account_id = 1; - optional string service_account_secret_name = 2; - optional string login = 3; - optional string password_secret_name = 4; - } - - oneof identity { - None none = 1; - Basic basic = 2; - Token token = 3; - Aws aws = 4; - ServiceAccount service_account = 5; - MdbBasic mdb_basic = 6; - } -} - -message ExternalDataSourceProperties { - map properties = 1; -} - message DescribeExternalDataSourceResult { // Description of a generic scheme object. Ydb.Scheme.Entry self = 1; optional string source_type = 2; optional string location = 3; - optional string installation = 4; - optional ExternalAuthorization authorization = 5; - optional ExternalDataSourceProperties properties = 6; + map properties = 4; } // Returns information about an external table with a given path. @@ -1381,5 +1332,5 @@ message DescribeExternalTableResult { optional string data_source_path = 3; optional string location = 4; repeated ColumnMeta columns = 5; - optional bytes content = 6; + map content = 6; }