database_skill
Python-based database connectivity skill supporting MySQL, PostgreSQL, Oracle, SQL Server, and SQLite. Provides connection management, parameterized query ex... Skill: database_skill Owner: jami-lin Summary: Python-based database connectivity skill supporting MySQL, PostgreSQL, Oracle, SQL Server, and SQLite. Provides connection management, parameterized query ex... Tags: latest:1.0.0 Version history: v1.0.0 | 2026-05-01T16:19:11.957Z | user Initial release of database-skill — a Python-based database connectivity tool. - Supports MySQL, PostgreSQL, Oracle, SQL Server, and SQ
Rank
62
Safety
84
Downloads
1.2k
Updated
Oct 11, 2026
Version
1.0.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.2K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.0.0release · observed May 1, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s179a0cbz8d1bjgrnrqga46wyx85xd9y:dbskill- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-jami-lin-dbskill/snapshot"
Documentation
CLAWHUB
16,291 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: database-skill
version: 1.0.0
type: skill
description: "Python-based database connectivity skill supporting MySQL, PostgreSQL, Oracle, SQL Server, and SQLite. Provides connection management, parameterized query execution, schema introspection, and transaction management. Requires Python 3.8+."
---
# database-skill — Python Database Connectivity Skill
English | [中文](#database-skill-中文文档)
This skill guides an AI Agent to connect to relational databases, execute queries,
manage transactions, and introspect schema using Python.
---
<a id="database-skill-中文文档"></a>
# database-skill — Python 数据库连接技能
本技能指导 AI Agent 使用 Python 连接关系型数据库、执行 SQL 查询、管理事务以及探查 Schema 元数据。
---
## When to call / When not to call · 何时调用
| Scenario | Call |
|---|---|
| User needs to run SQL queries | Yes |
| User needs schema introspection (tables, columns, indexes, FK) | Yes |
| User needs transaction control (commit / rollback) | Yes |
| Python 3.8+ not available or drivers not installed | No |
| User only needs text/regex analysis | No |
| 场景 | 调用 |
|---|---|
| 用户需要执行 SQL 查询 | 是 |
| 用户需要 Schema 探查(表、列、索引、外键) | 是 |
| 用户需要事务控制(提交/回滚) | 是 |
| 无 Python 3.8+ 或驱动未安装 | 否 |
| 用户仅需文本/正则分析 | 否 |
---
## Prerequisites · 前提条件
| Requirement | Check |
|---|---|
| Python 3.8+ | `python --version` |
| Target database reachable | `telnet <host> <port>` |
| Dependencies | `pip install pymysql psycopg2-binary oracledb pymssql pyyaml` |
---
## Quick start · 快速开始
```bash
# List all tables
python scripts/main.py \
--url "jdbc:mysql://localhost:3306/mydb" \
--user "root" \
--password "${DB_PASS}" \
--tables
# Parameterized query
python scripts/main.py \
--url "jdbc:mysql://localhost:3306/mydb" \
--user "root" \
--password "${DB_PASS}" \
--query "SELECT * FROM user WHERE name = ?" "zhangsan"
```
---
## Configuration (3 options) · 配置方式(三种)
### A — CLI arguments (recommended) · 命令行参数(推荐)
```bash
python scripts/main.py \
--url "jdbc:mysql://host:3306/db" \
--user "admin" \
--password "${DB_PASS}" \
--query "SELECT 1"
```
### B — YAML config file · 配置文件
```yaml
# datasource.yml
datasource:
url: "jdbc:mysql://localhost:3306/mydb"
username: "${DB_USER}"
password: "${DB_PASS}"
```
```bash
python scripts/main.py --config datasource.yml --tables
```
### C — Built-in defaults · 内置默认
```bash
python scripts/main.py --tables
```
---
## Operations · 操作说明
| Flag | Description | 说明 |
|---|---|---|
| `--query <sql> [params...]` | SELECT with `?` placeholders | SELECT 查询,支持参数化 |
| `--update <sql> [params...]` | UPDATE/INSERT/DELETE | 更新/插入/删除 |
| `--batch <file>` | Execute SQL file | 批量执行文件中的 SQL |
| `--tables` | List all tables | 列出所有表 |
| `--columns <table>` | Show column metadata | 查看表结构 |
| `--list-connections` | Show saved connections | 查看已保存的连接 |
| `--forget <url>` | Remove a saved connection | 删除已保存的连接 |
Examples · 示例:
```bash
python scripts/main.py --url "jdbc:mysql://host:3306/db" --user root --password x --tables
python scripts/main.py --ur_meta.json
{
"ownerId": "kn74re96vj4w3vcynfh0sw8hv585wtb6",
"slug": "dbskill",
"version": "1.0.0",
"publishedAt": 1777652351957
}references/connection-pooling.md
# Connection management · 连接管理
English | [中文](#连接管理)
The connector uses **direct driver connections** (no connection pool).
`ConnectionManager` handles connect / disconnect lifecycle.
<a id="连接管理"></a>
连接器使用**直连模式**(无连接池),由 `ConnectionManager` 统一管理连接生命周期。
---
## Driver mapping · 驱动映射
| Database | Python driver | Install |
|---|---|---|
| MySQL | `pymysql` | `pip install pymysql` |
| PostgreSQL | `psycopg2` | `pip install psycopg2-binary` |
| Oracle | `oracledb` | `pip install oracledb` |
| SQL Server | `pymssql` | `pip install pymssql` |
| SQLite / H2 | `sqlite3` | Built-in |
## Connection modes · 连接模式
| Scenario | Method | autocommit |
|---|---|---|
| Normal queries | `get_connection()` | `True` |
| Transactions | `get_connection_for_transaction()` | `False` |
## Transaction isolation · 事务隔离
`execute_transaction` uses `_TxConnectionManager` to route all connections
to the same underlying connection:
```python
class _TxConnectionManager(ConnectionManager):
def get_connection(self): return tx_conn
def get_connection_for_transaction(self): return tx_conn
def close_connection(self, conn): pass
```
## Safe close · 安全关闭
```python
@staticmethod
def close_connection(conn):
if conn is None:
return
try:
conn.close()
except Exception:
logger.debug("Ignored error while closing connection", exc_info=True)
```references/query-execution.md
# Query execution · 查询执行
English | [中文](#查询执行)
`QueryExecutor` provides four execution modes, all supporting **parameterized
bindings** to prevent SQL injection.
<a id="查询执行"></a>
`QueryExecutor` 提供四种执行模式,全部支持**参数化绑定**以防止 SQL 注入。
---
## Placeholder conversion · 占位符转换
Accepts JDBC-style `?` placeholders, auto-converted to Python `%s`:
支持 JDBC 风格的 `?` 占位符,自动转为 Python 的 `%s`:
```python
_PLACEHOLDER_RE = re.compile(r"(?<!\?)\?(?!\?)")
def convert_placeholders(sql: str) -> str:
return _PLACEHOLDER_RE.sub("%s", sql)
```
## Result wrapping · 结果包装
All query results are wrapped in `CaseInsensitiveDict`:
```python
d = CaseInsensitiveDict({"Name": "Alice"})
d["name"] # "Alice"
d["NAME"] # "Alice"
d["Name"] # "Alice"
```
## Four execution modes · 四种执行模式
```python
# SELECT
results = executor.execute_query("SELECT * FROM users WHERE status = ?", "ACTIVE")
# UPDATE / INSERT / DELETE
affected = executor.execute_update("UPDATE users SET status = ? WHERE id = ?", "INACTIVE", 1)
# Batch · 批量
results = executor.execute_batch(["INSERT INTO log VALUES (1)", "INSERT INTO log VALUES (2)"])
# Transaction · 事务
executor.execute_transaction(lambda tx: (
tx.execute_update("UPDATE accounts SET balance = balance - 100 WHERE id = ?", 1),
tx.execute_update("UPDATE accounts SET balance = balance + 100 WHERE id = ?", 2),
))
```references/supported-databases.md
# Supported databases · 支持的数据库 English | [中文](#支持的数据库) <a id="支持的数据库"></a> --- ## MySQL 8+ | Property | Value | |---|---| | Driver | `pymysql` | | JDBC URL | `jdbc:mysql://<host>:3306/<db>?useSSL=false&charset=utf8mb4` | | Placeholder | `?` (auto-converted to `%s`) | | Python lib | `pymysql>=1.1.0` | | Schema | `SHOW FULL TABLES`, `SHOW FULL COLUMNS`, `SHOW INDEX` | ## PostgreSQL | Property | Value | |---|---| | Driver | `psycopg2` | | JDBC URL | `jdbc:postgresql://<host>:5432/<db>` | | Placeholder | `?` (auto-converted to `%s`) | | Python lib | `psycopg2-binary>=2.9.9` | | Schema | `information_schema.tables`, `pg_class` | ## Oracle | Property | Value | |---|---| | Driver | `oracledb` | | JDBC URL | `jdbc:oracle:thin:@<host>:1521/<service>` | | Placeholder | `?` (auto-converted to `%s`) | | Python lib | `oracledb>=2.0.0` | | Schema | `user_tables`, `user_tab_columns` | ## SQL Server | Property | Value | |---|---| | Driver | `pymssql` | | JDBC URL | `jdbc:sqlserver://<host>:1433;databaseName=<db>` | | Placeholder | `?` (auto-converted to `%s`) | | Python lib | `pymssql>=2.2.0` | | Schema | `information_schema.tables`, `sys.indexes` | ## SQLite | Property | Value | |---|---| | Driver | `sqlite3` (built-in) | | JDBC URL | `jdbc:sqlite:<path>/file.db` or `jdbc:h2:mem:test` | | Placeholder | `?` (auto-converted to `%s`) | | Python lib | None (stdlib) | | Schema | `sqlite_master`, `PRAGMA table_info` | ## Column name case sensitivity · 列名大小写 | Driver | Native casing | Wrapper | |---|---|---| | pymysql | lowercase | CaseInsensitiveDict | | psycopg2 | lowercase | CaseInsensitiveDict | | oracledb | uppercase | CaseInsensitiveDict | | pymssql | lowercase | CaseInsensitiveDict | | sqlite3 | as-defined | CaseInsensitiveDict | ## Adding a new database · 扩展新数据库 1. Add JDBC URL prefix to `_DRIVER_REGISTRY` in `connection_manager.py`. 2. Add lazy import function. 3. Add `_connect()` branch in `ConnectionManager`. 4. Add schema queries in `SchemaInspector`. 5. Add dependency to `pyproject.toml`. 1. 在 `connection_manager.py` 的 `_DRIVER_REGISTRY` 中注册 URL 前缀。 2. 添加惰性导入函数。 3. 在 `ConnectionManager._connect()` 中添加分支。 4. 在 `SchemaInspector` 中适配 Schema 查询。 5. 在 `pyproject.toml` 中添加依赖。
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/jami-lin/skills/dbskill",
"sourceUrl": "https://clawhub.ai/jami-lin/skills/dbskill",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T01:04:05.405Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-jami-lin-dbskill/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-jami-lin-dbskill/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T01:04:05.405Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.2K downloads",
"href": "https://clawhub.ai/jami-lin/dbskill",
"sourceUrl": "https://clawhub.ai/jami-lin/dbskill",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T01:04:05.405Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.0.0",
"href": "https://clawhub.ai/jami-lin/dbskill",
"sourceUrl": "https://clawhub.ai/jami-lin/dbskill",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-01T16:19:11.957Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-jami-lin-dbskill/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-jami-lin-dbskill/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.0.0",
"description": "Initial release of database-skill — a Python-based database connectivity tool. - Supports MySQL, PostgreSQL, Oracle, SQL Server, and SQLite via Python 3.8+ - Provides connection management, parameterized query execution, schema introspection, and transaction management - Offers CLI, YAML config, and built-in default configuration options - Features secure handling: no password persistence, recommends environment variables, supports saved connections - Includes comprehensive API with `ConnectionManager`, `QueryExecutor`, `SchemaInspector`, and case-insensitive results - Documentation available in English and 中文 for easy adoption",
"href": "https://clawhub.ai/jami-lin/dbskill",
"sourceUrl": "https://clawhub.ai/jami-lin/dbskill",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-01T16:19:11.957Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
