Skip to content

Commit 19ef286

Browse files
Merge 443a096 into 4fde7f6
2 parents 4fde7f6 + 443a096 commit 19ef286

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

ydb/core/external_sources/external_data_source.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ struct TExternalDataSource : public IExternalSource {
3636
ythrow TExternalSourceException() << "Only external table supports parameters";
3737
}
3838

39+
bool isRDBMSDataSource(const TProtoStringType& sourceType) const {
40+
if (IsIn({"Greenplum", "PostgreSQL", "MySQL", "MsSQLServer", "Clickhouse"}, sourceType)) {
41+
return true;
42+
}
43+
44+
return false;
45+
}
46+
3947
virtual void ValidateExternalDataSource(const TString& externalDataSourceDescription) const override {
4048
NKikimrSchemeOp::TExternalDataSourceDescription proto;
4149
if (!proto.ParseFromString(externalDataSourceDescription)) {
@@ -49,6 +57,10 @@ struct TExternalDataSource : public IExternalSource {
4957
ythrow TExternalSourceException() << "Unsupported property: " << key;
5058
}
5159

60+
if (isRDBMSDataSource(proto.GetSourceType()) && !proto.GetProperties().GetProperties().contains("database_name")){
61+
ythrow TExternalSourceException() << proto.GetSourceType() << " source must provide database_name";
62+
}
63+
5264
ValidateHostname(HostnamePatterns, proto.GetLocation());
5365
}
5466

ydb/core/fq/libs/control_plane_storage/request_validators.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ void ValidateGenericConnectionSetting(
2020
}
2121

2222
if (!connection.database_id() && !(connection.host() && connection.port())) {
23-
auto msg = TStringBuilder() << "content.setting.clickhouse_cluster.{database_id or host,port} field is not specified";
23+
auto msg = TStringBuilder() << "content.setting." << dataSourceKind << "_cluster.{database_id or host,port} field is not specified";
2424
issues.AddIssue( MakeErrorIssue(TIssuesIds::BAD_REQUEST,msg));
2525
}
2626

27+
if (!connection.database_name() || connection.database_name() == "") {
28+
auto msg = TStringBuilder() << "content.setting." << dataSourceKind << "_cluster.{database_id or host,port} field is not specified";
29+
issues.AddIssue( MakeErrorIssue(TIssuesIds::BAD_REQUEST,msg));
30+
}
31+
2732
if (!connection.login()) {
2833
auto msg = TStringBuilder() << "content.setting." << dataSourceKind << "_cluster.login is not specified";
2934
issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, msg));
@@ -70,16 +75,17 @@ NYql::TIssues ValidateConnectionSetting(
7075
break;
7176
}
7277
case FederatedQuery::ConnectionSetting::kGreenplumCluster: {
73-
const FederatedQuery::GreenplumCluster database = setting.greenplum_cluster();
74-
if (!database.has_auth() || database.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) {
78+
const FederatedQuery::GreenplumCluster& greenplumStorage = setting.greenplum_cluster();
79+
80+
if (!greenplumStorage.has_auth() || greenplumStorage.auth().identity_case() == FederatedQuery::IamAuth::IDENTITY_NOT_SET) {
7581
issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.greenplum_database.auth field is not specified"));
7682
}
7783

78-
if (database.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) {
84+
if (greenplumStorage.auth().identity_case() == FederatedQuery::IamAuth::kCurrentIam && disableCurrentIam) {
7985
issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "current iam authorization is disabled"));
8086
}
8187

82-
if (!database.database_id() && !database.database_name()) {
88+
if (!greenplumStorage.database_id() && !greenplumStorage.database_name()) {
8389
issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "content.setting.greenplum_database.{database_id or database_name} field is not specified"));
8490
}
8591
break;

0 commit comments

Comments
 (0)