ConnectionPool ignores connectiontype parameter with externalauth=False
- What versions are you using?
2.4.1
Give your database version. 19.11.0.0.0
Also run Python and show the output of:
import sys
import platform
print("platform.platform:", platform.platform())
print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
print("platform.python_version:", platform.python_version())
platform.platform: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.28 sys.maxsize > 2**32: True platform.python_version: 3.9.5
And:
import oracledb
print("oracledb.__version__:", oracledb.__version__)
oracledb.version: 2.4.1
-
Is it an error or a hang or a crash? error
-
What error(s) or behavior you are seeing? Creating custom Connection class is not used by connectionpool when specifying externalauth=False Tried also creating custom ConnectionPool and passing in connectiontype still not using custom Connection class.
-
Does your application call init_oracle_client()?
yes
This tells us whether you are using the python-oracledb Thin or Thick mode.
thick
- Include a runnable Python script that shows the problem.
import oracledb
oracledb.init_oracle_client()
class Connection(oracledb.Connection):
def myfunc(self):
print('myfunc')
# trying also with custom ConnectionPool
class ConnectionPool(oracledb.ConnectionPool):
def __init__(self, *args, **kwargs):
kw = kwargs.copy()
kw['connectiontype'] = Connection
super().__init__(*args, **kw)
pool = oracledb.create_pool(dsn='test', homogeneous=False, externalauth=False, connectiontype=Connection, pool_class=ConnectionPool)
con = pool.acquire(user='dev', password='dev')
con.myfunc()
output
Traceback (most recent call last):
File "/tmp/pool-test.py", line 18, in <module>
con.myfunc()
AttributeError: 'Connection' object has no attribute 'myfunc'
When setting externalauth=True then con.myfunc() works.
Same thing using cx_Oracle works.
Thanks for reporting the issue. I was able to replicate and correct it. I have initated a build from which you can download pre-built wheels once it completes. You can also build from source if you prefer.
Note the wheels are from the in-flight development code line - they haven't been through a full regression cycle.
Tested, works!
This was included in python-oracledb 2.5.0 which was just released.