最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Call oracledb Connection.gettype from SQLAlchemy.AssyncSession - Stack Overflow

programmeradmin2浏览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)


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)


Share Improve this question edited 8 hours ago Kamo Petrosyan asked yesterday Kamo PetrosyanKamo Petrosyan 2441 silver badge10 bronze badges 2
  • Since you tagged this with python-oracledb, hopefully the reference to the obsolete cx_Oracle driver in the question was a typo. – Christopher Jones Commented 17 hours ago
  • 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). – Kamo Petrosyan Commented 8 hours ago
Add a comment  | 

1 Answer 1

Reset to default 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()
发布评论

评论列表(0)

  1. 暂无评论