You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A very simple asynchronous wrapper that allows you to get access to the Oracle database in asyncio programs.
9
10
@@ -16,15 +17,19 @@ Easy to use , buy may not the best practice for efficiency concern.
16
17
## Install
17
18
18
19
pip install cx_Oracle_async
19
-
20
-
## Usage
20
+
21
+
## Feature
21
22
- Nearly all the same as aiomysql in asynchronous operational approach , with limited cx_Oracle feature support.
22
23
- No automaticly date format transition built-in.
23
-
- AQ feature added , check [docs here](https://github.com/GoodManWEN/cx_Oracle_async/blob/main/docs/temporary_document_of_AQ.md) for further information.
24
+
- AQ feature added , check [docs here](https://cx_oracle_async.readthedocs.io/en/latest/user_guide/advancedfeatures.html#oracle-advanced-queuing-aq) for further information.
24
25
- You can modify some of the connection properties simply like you're using cx_Oracle.
25
26
- You can do basic insert / select / delete etc.
26
27
- If you're connecting to database which is on a different machine from python process , you need to install oracle client module in order to use this library. Check [cx-Oracle's installation guide](https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html) for further information.
query type | asynchronous multithreading | synchronous multithreading | synchronous single thread
30
35
-|-|-|-
@@ -38,7 +43,7 @@ single line insertion | 1341.88 q/s | 1898 q/s | 1685.17 q/s
38
43
*You can find performance test codes [here](https://github.com/GoodManWEN/cx_Oracle_async/blob/main/misc).*
39
44
40
45
## Examples
41
-
Before running examples , make sure you've already installed a [oracle client](https://github.com/GoodManWEN/cx_Oracle_async#usage) on your machine.
46
+
Before running examples , make sure you've already installed a [Oracle Client](https://cx-oracle-async.readthedocs.io/en/latest/user_guide/quickstart.html#install-oracle-client) on your machine.
42
47
```Python
43
48
# basic_usages.py
44
49
import asyncio
@@ -57,42 +62,11 @@ async def main():
57
62
58
63
asyncwith oracle_pool.acquire() as connection:
59
64
asyncwith connection.cursor() as cursor:
60
-
# single fetch
61
-
sql_1 ="SELECT * FROM SCOTT.DEPT WHERE deptno = :a"
62
-
await cursor.execute(sql_1 , (10 , ))
63
-
print(await cursor.fetchone())
64
-
65
-
# multiple inert
66
-
sql_2 ="INSERT INTO SCOTT.DEPT(deptno , dname) VALUES (:a , :b)"
67
-
sql_2_data = [
68
-
[60 , "Hello"],
69
-
[70 , "World"],
70
-
]
71
-
await cursor.executemany(sql_2 , sql_2_data)
72
-
await connection.commit()
73
-
74
-
# multiple fetch
75
-
sql_3 ="SELECT * FROM SCOTT.DEPT WHERE deptno >= :a"
76
-
await cursor.execute(sql_3 , (60 , ))
65
+
await cursor.execute("SELECT * FROM V$SESSION")
77
66
print(await cursor.fetchall())
78
67
79
68
await oracle_pool.close()
80
69
81
70
if__name__=='__main__':
82
71
asyncio.run(main())
83
-
```
84
-
85
-
Or you can connect to database via dsn style:
86
-
```Python
87
-
# makedsn.py
88
-
import asyncio
89
-
import cx_Oracle_async
90
-
91
-
asyncdefmain():
92
-
# same api as cx_Oracle.makedsn with 4 limited parameters(host , port , sid , service_name).
0 commit comments