0

Have an async connection pool in FastApi application. Using python-oracledb async connection pool (thin mode).

Trying to call Connection.gettype(name)

(await (await session.connection()).get_raw_connection()).cursor() have no attribute connection

await session.connection() and await (await session.connection()).get_raw_connection() have no attribute gettype

So how can I get user defined DbObjectType

In cx_Oracle connection's cursor I call this

    # cursor: Connection cursor
    # data: list):
    my_type = cursor.get_connection().gettype('MY_SCHEMA.MY_TYPE_ARRAY').newobject()
    my_type.extend(data)


2
  • Since you tagged this with python-oracledb, hopefully the reference to the obsolete cx_Oracle driver in the question was a typo. Commented Apr 3 at 21:15
  • before i used cx_Oracle and in question is example from old code with cx_Oracle. Question is for asynchronous oracledb driver (thin mode connection). Commented Apr 4 at 5:27

1 Answer 1

0

DBAPICursor has (protected) _connection attrubute

cursor = (await (await session.connection()).get_raw_connection()).cursor()
obj_type = (
    await (
        await session.cursor()
    )._connection.gettype("MY_SCHEMA.MY_TYPE_ARRAY")
).newobject()

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.