Quickly start with aiophoenixdb
What is aiophoenixdb
This project is based on the Apache Software Foundation open source project Apache-Phoenixdb project to transform the call implementation of the Avatica protocol in the code from the original synchronous mode to asynchronous call.
Getting started
How to install
pip install aiophoenixdb
How to use
Query sample
import aiophoenixdb
import asyncio
PHOENIX_CONFIG = {
'url': 'http://xxxxxxxxxx',
'user': 'xxx',
'password': 'xxx',
'database': 'xxx'
}
async def query_test():
conn = await aiophoenixdb.connect(**PHOENIX_CONFIG)
async with conn:
async with conn.cursor() as ps:
# need await
await ps.execute("SELECT * FROM xxx WHERE id = ?", parameters=("1", ))
res = await ps.fetchone()
print(res)
# Throw the query coroutine into the event loop to run
asyncio.get_event_loop().run_until_complete(query_test())
Query with DictCursor
import aiophoenixdb
import asyncio
from aiophoenixdb.cursors import DictCursor
PHOENIX_CONFIG = {
'url': 'http://xxxxxxxxxx',
'user': 'xxx',
'password': 'xxx',
'database': 'xxx'
}
async def query_test():
conn = await aiophoenixdb.connect(**PHOENIX_CONFIG)
async with conn:
async with conn.cursor(cursor_factory=DictCursor) as ps:
# need await
await ps.execute("SELECT * FROM xxx WHERE id = ?", parameters=("1", ))
res = await ps.fetchone()
print(res)
# Throw the query coroutine into the event loop to run
asyncio.get_event_loop().run_until_complete(query_test())
Release files for aiophoenixdb 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiophoenixdb-0.0.6.tar.gz | 34.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiophoenixdb-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 83.0 kB
Release files / aiophoenixdb-0.0.6.tar.gz
| Download URL | aiophoenixdb-0.0.6.tar.gz |
|---|---|
| Size | 34.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
925ffdc173232dc4e153bfded89de494ca5a915dde46f7c6a5903ca6848e68b9
|
|
BLAKE2b-256 checksum How to use checksums |
d6b399895f7dca70fd5df4c271e8450d8d7484f0e84a58eca68a08e415ae9716
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.18
|
Release files / aiophoenixdb-0.0.6-py3-none-any.whl
| Download URL | aiophoenixdb-0.0.6-py3-none-any.whl |
|---|---|
| Size | 48.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa13297f536dc4b26e4910adb10b30b299d8e574995ec7ddbb701f4d7e6d2c29
|
|
BLAKE2b-256 checksum How to use checksums |
934b9b161f740d244f155658180570b1ba9f03564222e54ea38c7c0e68a07cd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.18
|