Skip to content

Commit

Permalink
YDB FQ: turning gateways_config.proto into a file without external de…
Browse files Browse the repository at this point in the history
…pendencies

commit_hash:17a83b78602c819f7b52d21a634e59615fcf2076
  • Loading branch information
vitalyisaev2 committed Dec 12, 2024
1 parent 480e488 commit 64781aa
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 11 deletions.
129 changes: 119 additions & 10 deletions yql/essentials/providers/common/proto/gateways_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package NYql;
option java_package = "ru.yandex.yql.proto";

import "yql/essentials/protos/clickhouse.proto";
import "ydb/library/yql/providers/generic/connector/api/common/data_source.proto";
import "ydb/library/yql/providers/generic/connector/api/common/endpoint.proto";


/////////////////////////////// common ///////////////////////////////
Expand Down Expand Up @@ -552,29 +550,140 @@ message TDbToolConfig {

/////////// Generic gateway for the external data sources ////////////

// TGenericEndpoint represents the network address of a generic data source instance
message TGenericEndpoint {
optional string host = 1;
optional uint32 port = 2;
}


// TGenericCredentials represents various ways of user authentication in the data source instance
message TGenericCredentials {
message TBasic {
optional string username = 1;
optional string password = 2;
}

message TToken {
optional string type = 1;
optional string value = 2;
}

oneof payload {
TBasic basic = 1;
TToken token = 2;
}
}

// EGenericDataSourceKind enumerates the external data sources
// supported by the federated query system
enum EGenericDataSourceKind {
DATA_SOURCE_KIND_UNSPECIFIED = 0;
CLICKHOUSE = 1;
POSTGRESQL = 2;
S3 = 3;
YDB = 4;
MYSQL = 5;
MS_SQL_SERVER = 6;
GREENPLUM = 7;
ORACLE = 8;
LOGGING = 9;
}

// EGenericProtocol generalizes various kinds of network protocols supported by different databases.
enum EGenericProtocol {
PROTOCOL_UNSPECIFIED = 0;
NATIVE = 1; // CLICKHOUSE, POSTGRESQL
HTTP = 2; // CLICKHOUSE, S3
}

// TPostgreSQLDataSourceOptions represents settings specific to PostgreSQL
message TPostgreSQLDataSourceOptions {
// PostgreSQL schema
optional string schema = 1;
}

// TClickhouseDataSourceOptions represents settings specific to Clickhouse
message TClickhouseDataSourceOptions {
}

// TS3DataSourceOptions represents settings specific to S3 (Simple Storage Service)
message TS3DataSourceOptions {
// the region where data is stored
optional string region = 1;
// the bucket the object belongs to
optional string bucket = 2;
}

// TGreenplumDataSourceOptions represents settings specific to Greenplum
message TGreenplumDataSourceOptions {
// Greenplum schema
optional string schema = 1;
}

// TOracleDataSourceOptions represents settings specific to Oracle
message TOracleDataSourceOptions {
// Oracle service_name - alias to SID of oracle INSTANCE, or SID, or PDB.
// More about connection options in Oracle docs:
// https://docs.oracle.com/en/database/other-databases/essbase/21/essoa/connection-string-formats.html
optional string service_name = 1;
}

// TLoggingDataSourceOptions represents settings specific to Logging
message TLoggingDataSourceOptions {
optional string folder_id = 1;
}

// TGenericDataSourceInstance helps to identify the instance of a data source to redirect request to.
message TGenericDataSourceInstance {
// Data source kind
optional EGenericDataSourceKind kind = 1;
// Network address
optional TGenericEndpoint endpoint = 2;
// Database name
optional string database = 3;
// Credentials to access database
optional TGenericCredentials credentials = 4;
// If true, Connector server will use secure connections to access remote data sources.
// Certificates will be obtained from the standard system paths.
optional bool use_tls = 5;
// Allows to specify network protocol that should be used between
// during the connection between Connector and the remote data source
optional EGenericProtocol protocol = 6;
// Options specific to various data sources
oneof options {
TPostgreSQLDataSourceOptions pg_options = 7;
TClickhouseDataSourceOptions ch_options = 8;
TS3DataSourceOptions s3_options = 9;
TGreenplumDataSourceOptions gp_options = 10;
TOracleDataSourceOptions oracle_options = 11;
TLoggingDataSourceOptions logging_options = 12;
}
}

message TGenericClusterConfig {
// Cluster name
optional string Name = 1;

// Data source kind
optional NYql.NConnector.NApi.EDataSourceKind Kind = 8;
optional EGenericDataSourceKind Kind = 8;

// Location represents the network address of a data source instance we want to connect
oneof Location {
// Endpoint must be used for on-premise deployments.
NYql.NConnector.NApi.TEndpoint Endpoint = 9;
TGenericEndpoint Endpoint = 9;
// DatabaseId must be used when the data source is deployed in cloud.
// Data source FQDN and port will be resolved by MDB service.
string DatabaseId = 4;
}

// Credentials used to access data source instance
optional NYql.NConnector.NApi.TCredentials Credentials = 10;
optional TGenericCredentials Credentials = 10;

// Credentials used to access managed databases APIs.
// When working with external data source instances deployed in clouds,
// one should either set (ServiceAccountId, ServiceAccountIdSignature) pair
// that will be resolved into IAM Token via Token Accessor,
// one should either set (ServiceAccountId, ServiceAccountIdSignature) pair
// that will be resolved into IAM Token via Token Accessor,
// or provide IAM Token directly.
optional string ServiceAccountId = 6;
optional string ServiceAccountIdSignature = 7;
Expand All @@ -588,7 +697,7 @@ message TGenericClusterConfig {
optional string DatabaseName = 13;

// Transport protocol used to establish a network connection with database
optional NYql.NConnector.NApi.EProtocol Protocol = 14;
optional EGenericProtocol Protocol = 14;

// Data source options specific to various data sources
map<string, string> DataSourceOptions = 15;
Expand All @@ -601,7 +710,7 @@ message TGenericConnectorConfig {
// 1. Set address statically via `Endpoint.Host` and `Endpoint.Port`;
// 2. Ask YDB to set `Endpoint.Port` to the value of expression `./ydbd --ic-port + OffsetFromIcPort`,
// while Connector's hostname will still be taken from `Endpoint.Host` (with 'localhost' as a default value).
optional NYql.NConnector.NApi.TEndpoint Endpoint = 3;
optional TGenericEndpoint Endpoint = 3;
optional uint32 OffsetFromIcPort = 6;

// If true, Connector GRPC Client will use TLS encryption.
Expand Down Expand Up @@ -638,7 +747,7 @@ message TGenericGatewayConfig {

message TDbResolverConfig {
// Ydb / Yds MVP endpoint.
// Expected format:
// Expected format:
// [http|https]://host:port/ydbc/cloud-prod/
optional string YdbMvpEndpoint = 2;
}
Expand Down
1 change: 0 additions & 1 deletion yql/essentials/providers/common/proto/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SRCS(

PEERDIR(
yql/essentials/protos
ydb/library/yql/providers/generic/connector/api/common
)

IF (NOT PY_PROTOS_FOR)
Expand Down

0 comments on commit 64781aa

Please sign in to comment.