Skip to main content

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)

# 将查询的协程丢到事件循环中运行
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)

# 将查询的携程丢到事件循环中运行
asyncio.get_event_loop().run_until_complete(query_test())

Metadata

Release files for aiophoenixdb 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiophoenixdb 0.0.5
File Size Uploaded
aiophoenixdb-0.0.5.tar.gz 34.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiophoenixdb 0.0.5
File Interpreter ABI Platform
aiophoenixdb-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 83.1 kB

Release files / aiophoenixdb-0.0.5.tar.gz

Download URL aiophoenixdb-0.0.5.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1a8d77bc4a74b88662fa61db1cea4b2ef442c9b20c0fd0ab9b27f2d3f1866675
BLAKE2b-256 checksum
How to use checksums
a13eb6bf725cdfdf365460b69ec86e9a85ac228633f87d46b8d5b864c21160a6
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.5-py3-none-any.whl

Download URL aiophoenixdb-0.0.5-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4d6c41902fee73c3a05dac669854277bb36a7e3e1f63a52a1b65264a80db5fe
BLAKE2b-256 checksum
How to use checksums
740b733f36e428cb11a04c31e743419c5f7384e0d4842741e434b61c2a732bbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release history Release notifications | RSS feed

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page