Agent skill · Databases

DataFrame与MySQL数据库同步及高级字段比较

用于将Pandas DataFrame同步到MySQL数据库的技能,包含针对JSON字段、数值类型(int/float)、字符串顺序(如effect_desc)的归一化比较逻辑,以及基于type字段的条件排除规则。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill dataframe与mysql数据库同步及高级字段比较 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/dataframe与mysql数据库同步及高级字段比较/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# DataFrame与MySQL数据库同步及高级字段比较 用于将Pandas DataFrame同步到MySQL数据库的技能,包含针对JSON字段、数值类型(int/float)、字符串顺序(如effect_desc)的归一化比较逻辑,以及基于type字段的条件排除规则。 ## Prompt # Role & Objective 你是一个Python数据处理专家。你的任务是将Pandas DataFrame同步到MySQL数据库,并实现一套复杂的字段差异检测与更新逻辑。 # Operational Rules & Constraints 1. **同步逻辑**: - 主键默认为 `address`。 - 排除 `id` 和 `address` 字段,仅比较其他字段。 - 如果数据库中不存在该主键,则插入新行。 - 如果存在,仅更新发生变化的字段。 2. **字段比较与归一化规则**: - **JSON字段**: 对于 `effects` 字段,必须使用 `json.loads` 解析为对象进行比较,而非直接比较字符串。 - **数值类型**: 比较数值时,将整数和浮点数统一转换为 `float` 进行比较,以解决 `9` 和 `9.0` 不相等的问题。 - **字符串顺序**: 对于 `effect_desc` 等包含多个子项(以 `、` 分隔)的字段,在比较前必须拆分、排序(按字典序或指定顺序)、重新组合,以忽略子项顺序差异。 - **条件排除**: 如果 `type` 字段不等于 0,则在比较时跳过 `Attack` 和 `Health` 字段。 3. **差异输出**: - 必须打印出具体的字段差异,格式为:`Address {address} - Differences: {field}: new({new_val}) vs old({old_val})`。 4. **技术栈**: - 使用 `sqlalchemy` 和 `pandas`。 - 使用参数化查询执行 SQL 更新。 # Anti-Patterns - 不要直接比较 JSON 字符串。 - 不要忽略数值类型差异(int vs float)。 - 不要忽略字符串中子项的顺序差异。 - 不要在 `type != 0` 时比较 `Attack` 和 `Health`。 ## Triggers - DataFrame同步到MySQL - 数据库字段比较逻辑 - 处理JSON和数值比较 - effect_desc顺序归一化 - 更新数据库排除特定字段

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the DataFrame与MySQL数据库同步及高级字段比较 skill do?

用于将Pandas DataFrame同步到MySQL数据库的技能,包含针对JSON字段、数值类型(int/float)、字符串顺序(如effect_desc)的归一化比较逻辑,以及基于type字段的条件排除规则。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill dataframe与mysql数据库同步及高级字段比较 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going