这是一个国信行云数据库并发查询python程序,主要应用于自动通报
Project description
行云数据库JDBC包。主要供中国电信、中国移动等通信公司或国家电网等使用国信行云数据库公司使用.
xcloudClients
概述
xcloudClients 是一个设计用于通过 JPype 使用 JDBC 在 XCloud 系统上进行数据库操作的 Python 包。它可以高效地管理数据库连接,并利用预配置的客户端实例池来进行并发数据库访问,从而实现 SQL 查询的线程安全执行。
特性
- 线程安全的数据库连接:在多线程中安全管理并发数据库操作。
- 连接池管理:限制同时打开的数据库游标数量,防止系统过载。
- 异步查询执行:利用 Python 的
concurrent.futures异步执行查询。 - 资源管理:自动管理 JDBC 资源并确保正确关闭 JVM 和数据库连接。
- 错误处理:强大的错误处理能力,能够处理数据库连接问题和 SQL 执行错误。
安装
要安装 xcloudClients,需要 Python 3.6 或更高版本。您可以直接通过 pip 从 PyPI 安装:
pip install xcloudClients
先决条件
在安装包之前,请确保已经安装并正确配置了 JPype,因为它是 JDBC 连接所必需的。如果还未安装,可以使用 pip 安装 JPype:
```bash
pip install JPype1
## 先决条件
## 在安装包之前,请确保已经安装并正确配置了 JPype,因为它是 JDBC 连接所必需的。如果还未安装,可以使用 pip 安装 JPype:
```bash
pip install JPype1
## 使用方法
## 这里是一个简单的示例,演示如何使用 xcloudClients 来管理数据库连接和执行查询:
## 设置数据库客户端
## 首先,配置数据库客户端设置:
```python
from xcloudClients import ClientManager
# 定义客户端配置
client_configs = [
{'ip': '192.168.1.100', 'username': 'admin', 'password': 'secret'}
]
# 使用配置初始化 ClientManager
manager = ClientManager(client_configs=client_configs, max_cursors=10)
执行查询
您可以通过从 SQL 文件读取查询,并使用 ClientManager 来执行它们:
```python
# SQL文件的路径
sql_file_path = 'path/to/your/queries.sql'
# 从文件读取 SQL 查询
queries = manager.read_multi_sql_file(sql_file_path)
# 执行查询并检索结果
results = manager.execute_queries(queries, if_header_included=True)
for result in results:
print(result)
贡献
欢迎对 xcloudClients 做出贡献!请随意 fork 仓库,进行您的更改,并提交 pull 请求。
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
xcloudClients-0.4.0.tar.gz
(2.4 MB
view details)
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 xcloudClients-0.4.0.tar.gz.
File metadata
- Download URL: xcloudClients-0.4.0.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e87e49d60a6a03b92b3a057279d6180f296d5165bc9513b25cd6d30d9c931e2d
|
|
| MD5 |
9490df417d321cb52b0cc5c5bd7dd552
|
|
| BLAKE2b-256 |
f836e535b30bba26731290de62fb65f016972c6891034221b60d7ce36894793d
|
File details
Details for the file xcloudClients-0.4.0-py3-none-any.whl.
File metadata
- Download URL: xcloudClients-0.4.0-py3-none-any.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c680c6193300cb543413c2dee0dcf9564785e9f82cf9569188043af18a7eee70
|
|
| MD5 |
f3867405792b05bea3cf5b6591cf0fca
|
|
| BLAKE2b-256 |
ab9a53bba736fc3413931ca500a76c81bced59be7e2a4f6ac8e7752eee5e4715
|