sql 数据库验证
- 作者仓库星标 0
- 作者仓库 skills-registry
SQL Load
Load a flat-file dataset into a SQL database.
When to invoke
- User says "load this into Postgres / MySQL / SQLite", "put this in the database", "upload to my SQL server".
- Dataset is clean and the user wants it queryable via SQL.
Supported backends
- SQLite — file-based, zero config; default for quick local loads.
- PostgreSQL — via
psycopg2orpsycopg[binary]. - MySQL / MariaDB — via
PyMySQLormysql-connector-python. - Microsoft SQL Server — via
pyodbc. - DuckDB — file-based analytics DB; best for Parquet-native workflows.
Procedure
- Determine the connection:
- Existing connection config — check
$CLAUDE_USER_DATA/Claude-Data-Wrangler/config.jsonfor saved database profiles. List them, let the user pick. - New connection — ask the user for: backend, host/port OR file path, database name, username, and how to provide the password (env var name, 1Password reference via
op-vault, or prompt at connection time). Never hard-code passwords in files. Save the non-secret parts of the profile to$CLAUDE_USER_DATA/Claude-Data-Wrangler/config.jsonif the user wants to reuse it.
- Existing connection config — check
- Confirm the target table:
- Table name (default: dataset filename stem, sanitised).
- Schema (for Postgres / MSSQL).
- Action if exists:
fail(default),append,replace,upsert(requires primary key).
- Load the dataset with pandas.
- Map dtypes to SQL types — use the data dictionary if present to pin types; otherwise infer. Default mappings:
int64→BIGINT/INTEGER.float64→DOUBLE PRECISION/REAL.object(string) →TEXT/VARCHAR(n)— size from max length observed, padded.datetime64[ns]→TIMESTAMP.bool→BOOLEAN/BIT. Ask user to confirm for columns where inference is uncertain.
- Create the table via
CREATE TABLE IF NOT EXISTS ...(orCREATE OR REPLACEif requested). Respect primary key / not-null / index requests. - Insert in chunks (default 10k rows) using
to_sql(..., method='multi')or backend-native bulk loaders (COPYfor Postgres,LOAD DATA INFILEfor MySQL) for large files. - Validate — row count
SELECT COUNT(*)matches source; sample a few rows and compare. - Report — table name, row count, load duration, index/PK status.
Connection config format
$CLAUDE_USER_DATA/Claude-Data-Wrangler/config.json:
{
"sql_profiles": {
"local-postgres": {
"backend": "postgresql",
"host": "localhost",
"port": 5432,
"database": "analytics",
"user": "daniel",
"password_ref": {"type": "env", "name": "PGPASSWORD"}
},
"local-sqlite": {
"backend": "sqlite",
"path": "~/Documents/data/warehouse.db"
}
}
}
password_ref options:
{"type": "env", "name": "PGPASSWORD"}— read from env var at connect time.{"type": "op", "reference": "op://Private/postgres/password"}— fetch via 1Password CLI.{"type": "prompt"}— prompt the user each run.
Never write plaintext passwords into this file.
Dependencies
pip install pandas sqlalchemy
# per backend
pip install psycopg[binary] # postgres
pip install pymysql # mysql
pip install pyodbc # mssql
pip install duckdb # duckdb
Edge cases
- Schema drift (file columns != table columns) — report diff; ask user whether to add columns, drop columns, or fail.
- Character encoding — ensure client/server encoding matches dataset encoding; default UTF-8.
- Very large files — use backend-native bulk loaders (
COPY FROM,LOAD DATA) rather thanINSERT. Stream from Parquet directly where possible. - Transactions — wrap the load in a single transaction; if it fails mid-way, the user keeps the prior state.
- PII — if the dataset hasn't been PII-checked (see
pii-flag), warn before loading into a shared database.
<!-- tomevault:4.0:skill_md:2026-05-22 -->Source: danielrosehill/Claude-Data-Wrangler-plugin — distributed by TomeVault.
- 流狐分类
- 写作
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @tomevault-io · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- Python
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 读取环境变量
- 检测到的网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 User says "load this into Postgres / MySQL / SQLite", "put this in the database", "upload to my SQL server". Dataset is clean and the user wants it queryable via SQL.
SQLite — file-based, zero config; default for quick local loads. PostgreSQL — via psycopg2 or psycopg[binary]. MySQL / MariaDB — via PyMySQL or mysql-connector-python.
Determine the connection: Existing connection config — check $CLAUDEUSERDATA/Claude-Data-Wrangler/config.json for saved database profiles. List them, let the user pick. New connection — ask the user for: backend, host/port OR file path, database name,…
$CLAUDEUSERDATA/Claude-Data-Wrangler/config.json: passwordref options: {"type": "env", "name": "PGPASSWORD"} — read from env var at connect time.
Dependencies
Schema drift (file columns != table columns) — report diff; ask user whether to add columns, drop columns, or fail. Character encoding — ensure client/server encoding matches dataset encoding; default UTF-8. Very large files — use backend-native bulk loaders…
# SQL Load
Load a flat-file dataset into a SQL database.
## When to invoke
- User says "load this into Postgres / MySQL / SQLite", "put this in the database", "upload to my SQL server".
- Dataset is clean and the user wants it queryable via SQL.
## Supported backends
- **SQLite** — file-based, zero config; default for quick local loads.
- **PostgreSQL** — via `psycopg2` or `psycopg[binary]`.
- **MySQL** / MariaDB — via `PyMySQL` or `mysql-connector-python`.
- **Microsoft SQL Server** — via `pyodbc`.
- **DuckDB** — file-based analytics DB; best for Parquet-native workflows.
## Procedure
1. **Determine the connection**:
- **Existing connection config** — check `$CLAUDE_USER_DATA/Claude-Data-Wrangler/config.json` for saved database profiles. List them, let the user pick.
- **New connection** — ask the user for: backend, host/port OR file path, database name, username, and how to provide the password (env var name, 1Password reference via `op-vault`, or prompt at connection time). Never hard-code passwords in files. Save the non-secret parts of the profile to `$CLAUDE_USER_DATA/Claude-Data-Wrangler/config.json` if the user wants to reuse it.
2. **Confirm the target table**:
- Table name (default: dataset filename stem, sanitised).
- Schema (for Postgres / MSSQL).
- Action if exists: `fail` (default), `append`, `replace`, `upsert` (requires primary key).
3. **Load the dataset** with pandas.
4. **Map dtypes to SQL types** — use the data dictionary if present to pin types; otherwise infer. Default mappings:
- `int64` → `BIGINT` / `INTEGER`.
- `float64` → `DOUBLE PRECISION` / `REAL`.
- `object` (string) → `TEXT` / `VARCHAR(n)` — size from max length observed, padded.
- `datetime64[ns]` → `TIMESTAMP`.
- `bool` → `BOOLEAN` / `BIT`.
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> When to invoke → Supported backends → Procedure → Connection config format → Dependencies → Edge cases
要点 -> SQLite · PostgreSQL · MySQL · Microsoft SQL Server · DuckDB · Determine the connection · Existing connection config · New connection
文件/命令 -> psycopg2 · psycopg[binary] · PyMySQL · mysql-connector-python · pyodbc · $CLAUDEUSERDATA/Claude-Data-Wrangler/config.json · op-vault · fail
内容 SHA-256 -> 15960f525ef4
原文结构
适用与边界
原文中的明确线索
psycopg2、psycopg[binary]、PyMySQL、mysql-connector-python、pyodbc、$CLAUDEUSERDATA/Claude-Data-Wrangler/config.json、op-vault、fail