@@ -107,14 +107,12 @@ namespace NYql {
107
107
NYql::TGenericClusterConfig& clusterConfig) {
108
108
auto it = properties.find (" database_name" );
109
109
if (it == properties.cend ()) {
110
- // TODO: make this property required during https://st.yandex-team.ru/YQ-2494
111
- // ythrow yexception() << "missing 'DATABASE_NAME' value";
110
+ // DATABASE_NAME is a mandatory field for the most of databases,
111
+ // however, managed YDB does not require it, so we have to accept empty values here.
112
112
return ;
113
113
}
114
114
115
115
if (!it->second ) {
116
- // TODO: make this property required during https://st.yandex-team.ru/YQ-2494
117
- // ythrow yexception() << "invalid 'DATABASE_NAME' value: '" << it->second << "'";
118
116
return ;
119
117
}
120
118
@@ -125,14 +123,12 @@ namespace NYql {
125
123
NYql::TGenericClusterConfig& clusterConfig) {
126
124
auto it = properties.find (" schema" );
127
125
if (it == properties.cend ()) {
128
- // TODO: make this property required during https://st.yandex-team.ru/YQ-2494
129
- // ythrow yexception() << "missing 'SCHEMA' value";
126
+ // SCHEMA is optional field
130
127
return ;
131
128
}
132
129
133
130
if (!it->second ) {
134
- // TODO: make this property required during https://st.yandex-team.ru/YQ-2494
135
- // ythrow yexception() << "invalid 'SCHEMA' value: '" << it->second << "'";
131
+ // SCHEMA is optional field
136
132
return ;
137
133
}
138
134
@@ -318,9 +314,20 @@ namespace NYql {
318
314
}
319
315
320
316
static const TSet<NConnector::NApi::EDataSourceKind> managedDatabaseKinds{
317
+ NConnector::NApi::EDataSourceKind::CLICKHOUSE,
318
+ NConnector::NApi::EDataSourceKind::GREENPLUM,
319
+ NConnector::NApi::EDataSourceKind::MYSQL,
321
320
NConnector::NApi::EDataSourceKind::POSTGRESQL,
321
+ NConnector::NApi::EDataSourceKind::YDB,
322
+ };
323
+
324
+ static const TSet<NConnector::NApi::EDataSourceKind> traditionalRelationalDatabaseKinds{
322
325
NConnector::NApi::EDataSourceKind::CLICKHOUSE,
323
- NConnector::NApi::EDataSourceKind::YDB};
326
+ NConnector::NApi::EDataSourceKind::GREENPLUM,
327
+ NConnector::NApi::EDataSourceKind::MS_SQL_SERVER,
328
+ NConnector::NApi::EDataSourceKind::MYSQL,
329
+ NConnector::NApi::EDataSourceKind::POSTGRESQL,
330
+ };
324
331
325
332
void ValidateGenericClusterConfig (
326
333
const NYql::TGenericClusterConfig& clusterConfig,
@@ -396,6 +403,17 @@ namespace NYql {
396
403
}
397
404
}
398
405
406
+ // All the databases with exception to managed YDB:
407
+ // * DATABASE_NAME is mandatory field
408
+ if (traditionalRelationalDatabaseKinds.contains (clusterConfig.GetKind ())) {
409
+ if (!clusterConfig.GetDatabaseName ()) {
410
+ return ValidationError (
411
+ clusterConfig,
412
+ context,
413
+ " You must provide database name explicitly" );
414
+ }
415
+ }
416
+
399
417
// check required fields
400
418
if (!clusterConfig.GetName ()) {
401
419
return ValidationError (clusterConfig, context, " empty field 'Name'" );
0 commit comments