오라클 비동기 지원, asynchronous wrapper, cx_Oracle_async
https://pythonrepo.com/repo/GoodManWEN-cx_Oracle_async
-----------------------------------------------------
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())
'DBMS, 데이터베이스' 카테고리의 다른 글
파이썬, cx_Oracle, ORA-12514 : TNS:listener does not currently know of service requested in connect descriptor 오류 (0) | 2022.01.12 |
---|---|
Python cx_Oracle.connect() 예제 (0) | 2022.01.12 |
오라클 DATE 날짜 타입 형식 (0) | 2021.12.29 |
오라클 테이블 생성 예제 (0) | 2021.12.28 |
오라클 기본 데이터 타입 (0) | 2021.12.28 |