dsn.py small fix to support NNE
This is a couple of changes to fix DSN creation issue I have right now. In general, full support of tsnames.ora parameters in spec will be preferable, but currently I don't have resources to do it.
BR, Evgeniy
index eb4935d..198668d 100644
--- a/src/oracledb/dsn.py
+++ b/src/oracledb/dsn.py
@@ -47,8 +47,6 @@ def makedsn(
port: int,
sid: str = None,
service_name: str = None,
- dedicated: bool = False,
- ssl: bool = False,
region: str = None,
sharding_key: str = None,
super_sharding_key: str = None,
@@ -58,13 +56,8 @@ def makedsn(
string is identical to the strings that are defined in the tnsnames.ora
file.
"""
- proto = 'TCP'
connect_data_parts = []
_check_arg("host", host)
- if ssl:
- proto = 'TCPS'
- if dedicated:
- connect_data_parts.append('(SERVER=DEDICATED)')
if sid is not None:
_check_arg("sid", sid)
connect_data_parts.append(f"(SID={sid})")
@@ -82,6 +75,6 @@ def makedsn(
connect_data_parts.append(f"(SUPER_SHARDING_KEY={super_sharding_key})")
connect_data = "".join(connect_data_parts)
return (
- f"(DESCRIPTION=(ADDRESS=(PROTOCOL={proto})(HOST={host})"
+ f"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={host})"
f"(PORT={port}))(CONNECT_DATA={connect_data}))"
)
The makedsn() method was added to python-oracledb solely for backwards compatibility with cx_Oracle. python-oracledb already has a much more capable method in the ConnectParams class. That covers all of the ones you are asking for and a lot more besides! These include server_type and protocol. Note that you can also pass all of these directly to the connect, connect_async, create_pool and create_pool_async methods. The ConnectParams class is for cases where you want to pass the parameters to multiple connections or you want to control things a bit more closely.
I am assuming that the answer I gave in March covers the enhancement request and will close this.