@@ -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
@@ -333,9 +329,21 @@ namespace NYql {
333
329
}
334
330
335
331
static const TSet<NConnector::NApi::EDataSourceKind> managedDatabaseKinds{
332
+ NConnector::NApi::EDataSourceKind::CLICKHOUSE,
333
+ NConnector::NApi::EDataSourceKind::GREENPLUM,
334
+ NConnector::NApi::EDataSourceKind::MYSQL,
336
335
NConnector::NApi::EDataSourceKind::POSTGRESQL,
336
+ NConnector::NApi::EDataSourceKind::YDB,
337
+ };
338
+
339
+ static const TSet<NConnector::NApi::EDataSourceKind> traditionalRelationalDatabaseKinds{
337
340
NConnector::NApi::EDataSourceKind::CLICKHOUSE,
338
- NConnector::NApi::EDataSourceKind::YDB};
341
+ NConnector::NApi::EDataSourceKind::GREENPLUM,
342
+ NConnector::NApi::EDataSourceKind::MS_SQL_SERVER,
343
+ NConnector::NApi::EDataSourceKind::MYSQL,
344
+ NConnector::NApi::EDataSourceKind::ORACLE,
345
+ NConnector::NApi::EDataSourceKind::POSTGRESQL,
346
+ };
339
347
340
348
void ValidateGenericClusterConfig (
341
349
const NYql::TGenericClusterConfig& clusterConfig,
@@ -422,6 +430,17 @@ namespace NYql {
422
430
}
423
431
}
424
432
433
+ // All the databases with exception to managed YDB:
434
+ // * DATABASE_NAME is mandatory field
435
+ if (traditionalRelationalDatabaseKinds.contains (clusterConfig.GetKind ())) {
436
+ if (!clusterConfig.GetDatabaseName ()) {
437
+ return ValidationError (
438
+ clusterConfig,
439
+ context,
440
+ " You must provide database name explicitly" );
441
+ }
442
+ }
443
+
425
444
// check required fields
426
445
if (!clusterConfig.GetName ()) {
427
446
return ValidationError (clusterConfig, context, " empty field 'Name'" );
0 commit comments