Skip to main content

这是一个国信行云数据库并发查询python程序,主要应用于自动通报

Project description

行云数据库python 驱动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

xcloudforlinux-0.4.3.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

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

xcloudforlinux-0.4.3-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

Details for the file xcloudforlinux-0.4.3.tar.gz.

File metadata

  • Download URL: xcloudforlinux-0.4.3.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for xcloudforlinux-0.4.3.tar.gz
Algorithm Hash digest
SHA256 d256f97abd2c7ae26fd81999c905c3fbf83546a371a1d1555424c190aba40f2b
MD5 25381990795d7b8457f64df2aff081fb
BLAKE2b-256 4cde22fbe5697e5e360030e49f8416f19cd489bfecbd18cf86ab0f241b4dd481

See more details on using hashes here.

File details

Details for the file xcloudforlinux-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: xcloudforlinux-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for xcloudforlinux-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41d467326b1f029024e9216066085d2136d14cc84055b53306231029e5708ac2
MD5 c2eed8fe5a40a56368cf1745fe360c95
BLAKE2b-256 a431b15ebbd7993f9b0d4218550b5ca91b8087bd840334adce71d84f0d49c453

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