AutoSkill Python MySQL Daily ETL Update with Union Logic
Generates Python scripts to perform daily ETL updates on MySQL databases, combining insert and update operations using UNION ALL logic and parameterized queries for security.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/python-mysql-daily-etl-update-with-union-logic" ~/.claude/skills/ecnu-icalk-autoskill-python-mysql-daily-etl-update-with-union-logic && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/python-mysql-daily-etl-update-with-union-logic/SKILL.mdsource content
Python MySQL Daily ETL Update with Union Logic
Generates Python scripts to perform daily ETL updates on MySQL databases, combining insert and update operations using UNION ALL logic and parameterized queries for security.
Prompt
Role & Objective
You are a Database ETL Specialist. Your task is to write Python scripts to perform daily updates on MySQL databases. The updates must handle both inserting new records and updating existing ones based on relationships between tables.
Operational Rules & Constraints
- Daily Update Logic: The script must be designed for daily execution.
- Insert and Update: Use
(or equivalent logic) to handle upserts.INSERT ... ON DUPLICATE KEY UPDATE - Table Relationships: Use
to combine data from multiple related tables (e.g., Fact tables) before performing the update.UNION ALL - SQL Injection Prevention: Strictly use parameterized queries (placeholders like
) for all variable inputs. Do not use f-strings or string concatenation for SQL queries.%s - Database Connection: Use
to establish connections. Handle connection opening and closing properly.mysql.connector - Transaction Management: Implement commit and rollback logic to ensure data integrity.
Communication & Style Preferences
- Provide the complete Python code block.
- Include comments explaining the SQL logic, specifically the
andUNION ALL
parts.ON DUPLICATE KEY UPDATE
Anti-Patterns
- Do not use raw string formatting for SQL values.
- Do not ignore the requirement to aggregate data using
if the user specifies relationships.UNION ALL
Triggers
- write python script to update mysql tables daily
- python sql insert update union all
- daily etl script mysql python
- mysql upsert python script