DuckDB HTTP客户端,提供简单的方式通过HTTP API与DuckDB服务器交互
Project description
DuckDB Server Python Client
这是一个用于与DuckDB HTTP服务器交互的Python客户端库。它提供了一个简单的接口来执行SQL查询并获取结果。
安装
pip install duckdb-server-py-client
使用示例
from duckdb_client import DuckDBClient
# 创建客户端实例
client = DuckDBClient(host="localhost", port=9999)
# 执行查询
result = client.query("SELECT * FROM my_table")
# 检查查询是否成功
if result["success"]:
print(result["data"])
else:
print(f"查询失败: {result['error']}")
378b8a1092423ff1
特性
- 简单易用的API
- 支持API密钥认证
- 自动处理HTTP请求和响应
- 完善的错误处理
API文档
DuckDBClient
初始化
client = DuckDBClient(host="localhost", port=9999, api_key=None)
参数:
- host: DuckDB服务器主机地址
- port: DuckDB服务器端口
- api_key: API密钥(可选)
方法
execute(query: str)
执行SQL查询并返回结果。
query(sql: str)
execute方法的别名,用于执行SQL查询。
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file duckdb_server_client-0.1.1.tar.gz.
File metadata
- Download URL: duckdb_server_client-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e5092db602de10ccedc5611f4aeb3c14ff8306ca96f3029e5aedac730633c04
|
|
| MD5 |
32e5fc2e96cfa311b49b91ae4445dcc4
|
|
| BLAKE2b-256 |
545f223db5b33973ec0a329892a10110e99676882a15de244503884fc12c9509
|
File details
Details for the file duckdb_server_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: duckdb_server_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea63c7427f2eba06ce5f900e9a0e710746ee45ee6af70521f7459e03fe39bbd5
|
|
| MD5 |
5856df2e5d1e30a34f1cfed53734d46b
|
|
| BLAKE2b-256 |
81fdbf0026c7c3cc2c76c957ca19908691d1a0f79b509ff4f1c69fb3bd0d315f
|