Skip to content

Commit 1fdcf70

Browse files
authored
YDB FQ: Exclude DATABASE_NAME from mandatory for oracle (#7593)
1 parent 8290a51 commit 1fdcf70

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

ydb/core/external_sources/external_data_source.cpp

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

39-
bool IsRDBMSDataSource(const TProtoStringType& sourceType) const {
40-
return IsIn({"Greenplum", "PostgreSQL", "MySQL", "MsSQLServer", "ClickHouse", "Oracle"}, sourceType);
39+
bool DataSourceMustHaveDataBaseName(const TProtoStringType& sourceType) const {
40+
return IsIn({"Greenplum", "PostgreSQL", "MySQL", "MsSQLServer", "ClickHouse"}, sourceType);
4141
}
4242

4343
virtual void ValidateExternalDataSource(const TString& externalDataSourceDescription) const override {
@@ -53,7 +53,7 @@ struct TExternalDataSource : public IExternalSource {
5353
ythrow TExternalSourceException() << "Unsupported property: " << key;
5454
}
5555

56-
if (IsRDBMSDataSource(proto.GetSourceType()) && !proto.GetProperties().GetProperties().contains("database_name")) {
56+
if (DataSourceMustHaveDataBaseName(proto.GetSourceType()) && !proto.GetProperties().GetProperties().contains("database_name")) {
5757
ythrow TExternalSourceException() << proto.GetSourceType() << " source must provide database_name";
5858
}
5959

ydb/library/yql/providers/generic/connector/tests/utils/run/kqprun.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class SchemeRenderer:
2929
CREATE EXTERNAL DATA SOURCE {{data_source}} WITH (
3030
SOURCE_TYPE="{{kind}}",
3131
LOCATION="{{host}}:{{port}}",
32+
{% if database %}
3233
DATABASE_NAME="{{database}}",
34+
{% endif %}
3335
AUTH_METHOD="BASIC",
3436
LOGIN="{{login}}",
3537
PASSWORD_SECRET_NAME="{{data_source}}_local_password",
@@ -121,7 +123,7 @@ class SchemeRenderer:
121123
settings.oracle.username,
122124
settings.oracle.password,
123125
NONE,
124-
cluster.database,
126+
NONE,
125127
NONE,
126128
cluster.service_name)
127129
}}

ydb/library/yql/providers/generic/provider/yql_generic_cluster_config.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ namespace NYql {
345345
NConnector::NApi::EDataSourceKind::POSTGRESQL,
346346
};
347347

348+
bool DataSourceMustHaveDataBaseName(const NConnector::NApi::EDataSourceKind& sourceKind) {
349+
return traditionalRelationalDatabaseKinds.contains(sourceKind) && sourceKind != NConnector::NApi::ORACLE;
350+
}
351+
348352
void ValidateGenericClusterConfig(
349353
const NYql::TGenericClusterConfig& clusterConfig,
350354
const TString& context) {
@@ -430,9 +434,9 @@ namespace NYql {
430434
}
431435
}
432436

433-
// All the databases with exception to managed YDB:
437+
// All the databases with exception to managed YDB and Oracle:
434438
// * DATABASE_NAME is mandatory field
435-
if (traditionalRelationalDatabaseKinds.contains(clusterConfig.GetKind())) {
439+
if (DataSourceMustHaveDataBaseName(clusterConfig.GetKind())) {
436440
if (!clusterConfig.GetDatabaseName()) {
437441
return ValidationError(
438442
clusterConfig,

0 commit comments

Comments
 (0)