This skill provides a workflow for importing CSV and SQL dump files into MySQL, MariaDB, and SQLite databases with intelligent column mapping.
Use analyze_schema.py to extract schema information from your source (CSV/SQL dump) and destination database.
Examples:
bash
# Analyze CSV file
python scripts/analyze_schema.py csv /path/to/data.csv
# Analyze SQL dump file
python scripts/analyze_schema.py sql /path/to/dump.sql
# Analyze SQLite database
python scripts/analyze_schema.py sqlite /path/to/database.db
# Analyze MySQL/MariaDB database (requires mysql-connector-python)
python scripts/analyze_schema.py mysql localhost --user root --password secret --database mydb
Once you have analyzed both source and destination, use map_columns.py to get mapping suggestions:
powershell
python scripts/map_columns.py '["account name", "email address"]' '["client", "email"]'
After confirming mappings, use execute_import.py:
CSV Import to SQLite:
bash
python scripts/execute_import.py csv /path/to/data.csv --db-type sqlite --db-path /path/db.db --table clients --mapping '{"email": "email", "name": "client"}'
CSV Import to MySQL/MariaDB:
bash
python scripts/execute_import.py csv /path/to/data.csv --db-type mysql --host localhost --user root --password secret --database mydb --table clients --mapping '{"email": "email", "name": "client"}'
Execute SQL Dump:
bash
# To SQLite
python scripts/execute_import.py sql /path/to/dump.sql --db-type sqlite --db-path /path/db.db
# To MySQL/MariaDB
python scripts/execute_import.py sql /path/to/dump.sql --db-type mysql --host localhost --user root --password secret --database mydb
ScriptPurposeanalyze_schema.pyExtract schema from MySQL/MariaDB/SQLite, parse SQL dumps, or sample CSV datamap_columns.pySuggest column mappings using fuzzy pattern matchingexecute_import.pyImport CSV into databases or execute SQL dump files