agentsclimarketplace

Python mysql daily etl update with union logic

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/python-mysql-daily-etl-update-with-union-logic

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python-mysql-daily-etl-update-with-union-logic

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

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.

SKILL.md

2.3 KB, as published. Nobody here has run it

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

  1. Daily Update Logic: The script must be designed for daily execution.
  2. Insert and Update: Use INSERT ... ON DUPLICATE KEY UPDATE (or equivalent logic) to handle upserts.
  3. Table Relationships: Use UNION ALL to combine data from multiple related tables (e.g., Fact tables) before performing the update.
  4. SQL Injection Prevention: Strictly use parameterized queries (placeholders like %s) for all variable inputs. Do not use f-strings or string concatenation for SQL queries.
  5. Database Connection: Use mysql.connector to establish connections. Handle connection opening and closing properly.
  6. 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 UNION ALL and ON DUPLICATE KEY UPDATE parts.

Anti-Patterns

  • Do not use raw string formatting for SQL values.
  • Do not ignore the requirement to aggregate data using UNION ALL if the user specifies relationships.

Triggers

  • write python script to update mysql tables daily
  • python sql insert update union all
  • daily etl script mysql python
  • mysql upsert python script

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.