AI Agent Hub
Back to skills
Python Relational Database Connectivity Tool icon

Python Relational Database Connectivity Tool

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md and install @user_e71390e8/dbskill.

About this skill

Problem

When an AI agent needs to read relational business data, run constrained writes, or inspect table structure, common issues include scattered connection settings, driver differences, SQL injection risk, and uncertain transaction state. database_skill turns these tasks into a clear Python workflow: connect through a consistent entry point, run queries, updates, batch scripts, or schema checks, and roll back when operations fail.

How It Works

The skill targets databases such as MySQL, PostgreSQL, Oracle, and SQL Server, with drivers like pymysql, psycopg2-binary, oracledb, and pymssql. Configuration can come from CLI arguments, a YAML file, or built-in defaults. After a successful connection, it can store the URL, username, and driver type, but it does not store passwords. When neither --url nor --config is provided, the skill lists saved connections for selection. Key operations include --query for parameterized SELECT statements, --update for INSERT/UPDATE/DELETE, --batch for executing SQL files, --tables and --columns for schema inspection, plus --list-connections and --forget for managing saved connections. Internally, ConnectionManager, QueryExecutor, SchemaInspector, and CaseInsensitiveDict handle connection lifecycle, execution, metadata lookup, and case-insensitive column names.

Boundaries

Use it for SQL queries, schema introspection, and transaction control. It is not a fit for pure text or regex analysis, or when Python 3.8+, database reachability, or required dependencies are missing. Values must be passed through ? placeholders, passwords should not be hard-coded, and transaction commit/rollback should be left to the skill's automatic handling.

Use Cases

  • While debugging an orders service, query MySQL rows by date, status, and customer.
  • After inheriting a legacy project, list PostgreSQL tables and inspect columns, indexes, and foreign keys.
  • Before fixing production bad data, update a small set of rows with parameterized SQL and automatic rollback on failure.
  • Run read-only SQL Server queries using saved connections instead of hard-coding passwords in scripts.

Best For

  • Backend engineers maintaining order or user services: query rows by conditions, verify fields, and make small fixes.
  • Data engineers aligning migration or reporting definitions: inspect schemas, indexes, and foreign-key constraints.
  • SREs writing incident diagnostics: run read-only SQL with saved connections and avoid leaking credentials.
  • Application developers integrating multi-database products: handle queries across MySQL, PostgreSQL, Oracle, and SQL Server.