Skip to content

Commit

Permalink
Merge 332ab68 into e888137
Browse files Browse the repository at this point in the history
  • Loading branch information
mkls6 authored May 29, 2024
2 parents e888137 + 332ab68 commit bebf704
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ydb/core/external_sources/external_source_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ IExternalSourceFactory::TPtr CreateExternalSourceFactory(const std::vector<TStri
ToString(NYql::EDatabaseType::PostgreSQL),
CreateExternalDataSource(TString{NYql::GenericProviderName}, {"MDB_BASIC", "BASIC"}, {"database_name", "protocol", "mdb_cluster_id", "use_tls", "schema"}, hostnamePatternsRegEx)
},
{
ToString(NYql::EDatabaseType::MySQL),
CreateExternalDataSource(TString{NYql::GenericProviderName}, {"MDB_BASIC", "BASIC"}, {"database_name", "mdb_cluster_id", "use_tls"}, hostnamePatternsRegEx)
},
{
ToString(NYql::EDatabaseType::Ydb),
CreateExternalDataSource(TString{NYql::GenericProviderName}, {"BASIC", "SERVICE_ACCOUNT"}, {"database_name", "use_tls", "database_id"}, hostnamePatternsRegEx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ enum class EDatabaseType {
DataStreams,
ObjectStorage,
PostgreSQL,
YT
YT,
MySQL
};

inline EDatabaseType DatabaseTypeFromDataSourceKind(NConnector::NApi::EDataSourceKind dataSourceKind) {
Expand All @@ -25,6 +26,8 @@ inline EDatabaseType DatabaseTypeFromDataSourceKind(NConnector::NApi::EDataSourc
return EDatabaseType::ClickHouse;
case NConnector::NApi::EDataSourceKind::YDB:
return EDatabaseType::Ydb;
case NConnector::NApi::EDataSourceKind::MYSQL:
return EDatabaseType::MySQL;
default:
ythrow yexception() << "Unknown data source kind: " << NConnector::NApi::EDataSourceKind_Name(dataSourceKind);
}
Expand All @@ -38,6 +41,8 @@ inline NConnector::NApi::EDataSourceKind DatabaseTypeToDataSourceKind(EDatabaseT
return NConnector::NApi::EDataSourceKind::CLICKHOUSE;
case EDatabaseType::Ydb:
return NConnector::NApi::EDataSourceKind::YDB;
case EDatabaseType::MySQL:
return NConnector::NApi::EDataSourceKind::MYSQL;
default:
ythrow yexception() << "Unknown database type: " << ToString(databaseType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace NYql::NDq {
args.MaxKeysInRequest);
};

for (auto& name : {"ClickHouseGeneric", "PostgreSqlGeneric", "YdbGeneric"}) {
for (auto& name : {"ClickHouseGeneric", "PostgreSqlGeneric", "YdbGeneric", "MySqlGeneric"}) {
factory.RegisterSource<Generic::TSource>(name, readActorFactory);
factory.RegisterLookupSource<Generic::TLookupSource>(name, lookupActorFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ namespace NYql {
return;
}

if (clusterConfig.GetKind() == EDataSourceKind::MYSQL) {
clusterConfig.SetProtocol(EProtocol::NATIVE);
return;
}

auto it = properties.find("protocol");
if (it == properties.cend()) {
ythrow yexception() << "missing 'PROTOCOL' value";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ namespace NYql {
case NYql::NConnector::NApi::POSTGRESQL:
sourceType = "PostgreSqlGeneric";
break;
case NYql::NConnector::NApi::MYSQL:
sourceType = "MySqlGeneric";
break;
case NYql::NConnector::NApi::YDB:
sourceType = "YdbGeneric";
break;
Expand Down Expand Up @@ -204,6 +207,9 @@ namespace NYql {
case NConnector::NApi::POSTGRESQL:
properties["SourceType"] = "PostgreSql";
break;
case NConnector::NApi::MYSQL:
properties["SourceType"] = "MySql";
break;
case NConnector::NApi::YDB:
properties["SourceType"] = "Ydb";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ namespace NYql {
break;
case NYql::NConnector::NApi::YDB:
break;
case NYql::NConnector::NApi::MYSQL:
break;
case NYql::NConnector::NApi::POSTGRESQL: {
// for backward compability set schema "public" by default
// TODO: simplify during https://st.yandex-team.ru/YQ-2494
Expand Down

0 comments on commit bebf704

Please sign in to comment.