python-oracledb is the Python module for Oracle Database · oracle/python-oracledb · Discussion #2 (original) (raw)

Also it seems that custom types are no longer supported. With

create or replace type varchars as table of varchar2(4000);

I get:

Python 3.10.4 (main, Apr 26 2022, 19:42:59) [Clang 13.1.6 (clang-1316.0.21.2)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.3.0 -- An enhanced Interactive Python. Type '?' for help.
🐍 — 1 — 18:20:16.308616 ❯ import oracledb, cx_Oracle
🐍 — 2 — 18:20:21.518450 ❯ odb = oracledb.connect("user/pwd@db")
🐍 — 3 — 18:20:26.352752 ❯ cdb = cx_Oracle.connect("user/pwd@db")
🐍 — 4 — 18:20:30.198178 ❯ oc = odb.cursor()
🐍 — 5 — 18:20:33.284193 ❯ cc = cdb.cursor()
🐍 — 8 — 18:20:52.522373 ❯ cc.execute("select varchars('foo', 'bar') from dual").fetchone()
🐍 — 8 — 18:34:14.630333 ❮ (<cx_Oracle.Object LL.VARCHARS at 0x10fadc370>,)
🐍 — 9 — 18:34:14.636108 ❯ oc.execute("select varchars('foo', 'bar') from dual").fetchone()
---------------------------------------------------------------------------
NotSupportedError                         Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 oc.execute("select varchars('foo', 'bar') from dual").fetchone()

File ~/pyvenvs/default/lib/python3.10/site-packages/oracledb/cursor.py:378, in Cursor.execute(self, statement, parameters, **keyword_parameters)
    376 if parameters is not None:
    377     impl.bind_one(self, parameters)
--> 378 impl.execute(self)
    379 if impl.fetch_vars is not None:
    380     return self

File src/oracledb/impl/thin/cursor.pyx:122, in oracledb.thin_impl.ThinCursorImpl.execute()

File src/oracledb/impl/thin/protocol.pyx:294, in oracledb.thin_impl.Protocol._process_single_message()

File src/oracledb/impl/thin/protocol.pyx:295, in oracledb.thin_impl.Protocol._process_single_message()

File src/oracledb/impl/thin/protocol.pyx:255, in oracledb.thin_impl.Protocol._process_message()

File src/oracledb/impl/thin/protocol.pyx:234, in oracledb.thin_impl.Protocol._process_message()

File src/oracledb/impl/thin/messages.pyx:279, in oracledb.thin_impl.Message.process()

File src/oracledb/impl/thin/messages.pyx:785, in oracledb.thin_impl.MessageWithData._process_message()

File src/oracledb/impl/thin/messages.pyx:865, in oracledb.thin_impl.MessageWithData._process_row_data()

File src/oracledb/impl/thin/messages.pyx:591, in oracledb.thin_impl.MessageWithData._process_column_data()

File ~/pyvenvs/default/lib/python3.10/site-packages/oracledb/errors.py:103, in _raise_err(error_num, context_error_message, cause, **args)
    101     message = f"{message}\n{context_error_message}"
    102 exc_type = ERR_EXCEPTION_TYPES[error_num // 1000]
--> 103 raise exc_type(_Error(message)) from cause

NotSupportedError: DPY-3007: database type "DB_TYPE_OBJECT" is not supported