반응형

오라클 비동기 지원, asynchronous wrapper, cx_Oracle_async  

cx-oracle-async-readthedocs-io-en-latest.pdf
0.17MB

https://pythonrepo.com/repo/GoodManWEN-cx_Oracle_async

 

 

A very simple asynchronous wrapper that allows you to get access to the Oracle database in asyncio programs. | PythonRepo

GoodManWEN/cx_Oracle_async, cx_Oracle_async A very simple asynchronous wrapper that allows you to get access to the Oracle database in asyncio programs. Easy to use , buy may not

pythonrepo.com

 

-----------------------------------------------------
cx_Oracle_async
-----------------------------------------------------

 

요구사항
cx_Oracle >= 8.1.0 

ThreadPoolExecutorPlus >= 0.2.0

설치
pip install cx_Oracle_async

설명 
Nearly all the same as aiomysql in asynchronous operational approach, with limited cx_Oracle feature support.
*** No automaticly date format transition built-in. ***
AQ feature added , check docs here for further information.
You can modify some of the connection properties simply like you're using cx_Oracle.
You can do basic insert / select / delete etc.

참조 문서
https://cx_oracle_async.readthedocs.io

성능 테스트 
-------------------------------------------------------------------------------------------------
query type      asynchronous multithreading   synchronous multithreading   synchronous single thread
-------------------------------------------------------------------------------------------------
fast single line query         6259.80 q/s                  28906.93 q/s                   14805.61 q/s

single line insertion           1341.88 q/s                       1898 q/s                    1685.17 q/s

 

/* 테스트 장비 */
AMD Ryzen 3700x
Windows 10 LTSC
Oracle 19c

성능 테스트 코드
https://github.com/GoodManWEN/cx_Oracle_async/tree/main/misc

예제
# basic_usages.py
import asyncio
import cx_Oracle_async

async def main():
    oracle_pool = await cx_Oracle_async.create_pool(
        host='localhost', 
        port='1521',
        user='user', 
        password='password',
        service_name='orcl', 
        min = 2,
        max = 4,
    )

    async with oracle_pool.acquire() as connection:
        async with connection.cursor() as cursor:
            await cursor.execute("SELECT * FROM V$SESSION")
            print(await cursor.fetchall())

    await oracle_pool.close()

if __name__ == '__main__':
    asyncio.run(main())

 

 

반응형

+ Recent posts