Migrates pressure gauge (PG) and thermometer (TM) data from .xlsm files into SQL Server executionCard schema, one table per year (PG_2022-2026, TM_2022-2026). Supports single/multi-table migration, column remapping, type inference, and dry-run mode via config.yaml. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
109 lines
2.7 KiB
Plaintext
109 lines
2.7 KiB
Plaintext
# Excel to SQL Server Migration Configuration
|
||
|
||
# ================= SQL Server 连接 =================
|
||
sql_server:
|
||
driver: "ODBC Driver 18 for SQL Server"
|
||
server: "192.168.110.114"
|
||
database: "CompanyDB"
|
||
username: "YOUR_USERNAME_HERE"
|
||
password: "YOUR_PASSWORD_HERE"
|
||
TrustServerCertificate: "yes"
|
||
|
||
# ================= 目标 Schema =================
|
||
schema: "executionCard"
|
||
|
||
# ================= 批量插入参数 =================
|
||
batch_size: 500
|
||
|
||
# ================= 主键列名(用于去重) =================
|
||
primary_key: "总排号"
|
||
|
||
# ================= 列名重映射 =================
|
||
# 读取 Excel 时将原始列名替换为目标列名
|
||
column_mapping:
|
||
"ID": "CRM订单明细ID"
|
||
|
||
# ================= 数据类型推断规则 =================
|
||
type_rules:
|
||
datetime:
|
||
- "日期"
|
||
- "Date"
|
||
int:
|
||
- name: "数量"
|
||
exact: true
|
||
decimal:
|
||
- name: "单价"
|
||
exact: true
|
||
long_text:
|
||
- "备注"
|
||
- "技术参数"
|
||
- "说明"
|
||
- "转换数据"
|
||
- "新参数"
|
||
primary_key_type: "NVARCHAR(50) NOT NULL"
|
||
default_type: "NVARCHAR(MAX)"
|
||
|
||
# ================= 数据源映射 =================
|
||
# 每个条目对应一个目标表
|
||
# sources 中的顺序决定去重优先级:后出现的覆盖先出现的(同总排号时)
|
||
tables:
|
||
# ---------- 压力表 (PG) ----------
|
||
- table: "PG_2022"
|
||
sources:
|
||
- file: "PG/生产执行卡2022.xlsm"
|
||
sheet: "Sheet1"
|
||
|
||
- table: "PG_2023"
|
||
sources:
|
||
- file: "PG/生产执行卡2023(1-5月).xlsm"
|
||
sheet: "Sheet1"
|
||
- file: "PG/生产执行卡2023(6月-.xlsm"
|
||
sheet: "Sheet1"
|
||
|
||
- table: "PG_2024"
|
||
sources:
|
||
- file: "PG/生产执行卡2024 6月.xlsm"
|
||
sheet: "重庆数据"
|
||
- file: "PG/生产执行卡2024 6月.xlsm"
|
||
sheet: "北京数据"
|
||
|
||
- table: "PG_2025"
|
||
sources:
|
||
- file: "PG/生产执行卡2025年.xlsm"
|
||
sheet: "重庆数据"
|
||
- file: "PG/生产执行卡2025年.xlsm"
|
||
sheet: "北京数据"
|
||
|
||
- table: "PG_2026"
|
||
sources:
|
||
- file: "PG/生产执行卡2026年.xlsm"
|
||
sheet: "重庆数据"
|
||
- file: "PG/生产执行卡2026年.xlsm"
|
||
sheet: "北京数据"
|
||
|
||
# ---------- 温度计 (TM) ----------
|
||
- table: "TM_2022"
|
||
sources:
|
||
- file: "TM/生产执行卡(2022合同数据).xlsm"
|
||
sheet: "数据"
|
||
|
||
- table: "TM_2023"
|
||
sources:
|
||
- file: "TM/生产执行卡(2023合同数据).xlsm"
|
||
sheet: "数据"
|
||
|
||
- table: "TM_2024"
|
||
sources:
|
||
- file: "TM/生产执行卡(新版1).xlsm"
|
||
sheet: "数据"
|
||
|
||
- table: "TM_2025"
|
||
sources:
|
||
- file: "TM/生产执行卡2025.xlsm"
|
||
sheet: "数据"
|
||
|
||
- table: "TM_2026"
|
||
sources:
|
||
- file: "TM/生产执行卡2026.xlsm"
|
||
sheet: "数据"
|