Skip to content

Commit d35c4d6

Browse files
Make connect_descriptor key mandator for configurations.
1 parent 800b063 commit d35c4d6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/oracledb/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def _raise_not_supported(feature: str) -> None:
278278
ERR_PROTOCOL_HANDLER_FAILED = 2056
279279
ERR_PASSWORD_TYPE_HANDLER_FAILED = 2057
280280
ERR_PLAINTEXT_PASSWORD_IN_CONFIG = 2058
281+
ERR_MISSING_CONNECT_DESCRIPTOR = 2059
281282

282283
# error numbers that result in NotSupportedError
283284
ERR_TIME_NOT_SUPPORTED = 3000
@@ -648,6 +649,9 @@ def _raise_not_supported(feature: str) -> None:
648649
'a bind variable replacement value for placeholder ":{name}" was '
649650
"not provided"
650651
),
652+
ERR_MISSING_CONNECT_DESCRIPTOR: (
653+
'"connect_descriptor" key missing from configuration'
654+
),
651655
ERR_MISSING_FILE: "file '{file_name}' is missing or unreadable",
652656
ERR_MISSING_ENDING_DOUBLE_QUOTE: 'missing ending quote (")',
653657
ERR_MISSING_ENDING_SINGLE_QUOTE: "missing ending quote (')",

src/oracledb/impl/base/connect_params.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ cdef class ConnectParamsImpl:
122122
configuration.
123123
"""
124124
connect_string = config.get("connect_descriptor")
125-
if connect_string is not None:
126-
self.parse_connect_string(connect_string)
125+
if connect_string is None:
126+
errors._raise_err(errors.ERR_MISSING_CONNECT_DESCRIPTOR)
127+
self.parse_connect_string(connect_string)
127128
if self.user is None and self._password is None:
128129
user = config.get("user")
129130
password = config.get("password")

0 commit comments

Comments
 (0)