Skip to main content

DuckDB HTTP客户端,提供简单的方式通过HTTP API与DuckDB服务器交互

Project description

DuckDB Server Python Client

这是一个用于与DuckDB HTTP服务器交互的Python客户端库。它提供了一个简单的接口来执行SQL查询并获取结果。

安装

pip install duckdb-server-client

使用示例

from duckdb_server_client import DuckDBClient

# 创建客户端实例
client = DuckDBClient(host="localhost", port=9999, api_key="user:pass")

# 执行查询
result = client.query("SELECT * FROM my_table")

# 检查查询是否成功
if result["success"]:
    print(result["data"])
else:
    print(f"查询失败: {result['error']}")

特性

  • 简单易用的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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duckdb_server_client-0.1.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duckdb_server_client-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file duckdb_server_client-0.1.2.tar.gz.

File metadata

  • Download URL: duckdb_server_client-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for duckdb_server_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1ffbb82a87c4d1173b44619a8fb64aedda85116eef14f5e9d745167422f0511e
MD5 d4d8944bc9ff163d7182f9eca0a17c54
BLAKE2b-256 3dd696cdde41f05d4128d35fdf574bc1bc4e569651a1a399ecc31004c192613c

See more details on using hashes here.

File details

Details for the file duckdb_server_client-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for duckdb_server_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79e839bdea39c620a31769917405e4799100881b0304339bd6d1779b21e3d8fa
MD5 03efc5d1e2c9300b826e59216dfa1f75
BLAKE2b-256 d11987f34a31f47dcfcf017076f10fd06e97d36875c2664ebc97b9c80ca8db71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page