feat: config model and yaml loader
Add Pydantic config models (SqlServerConfig, AccessConfig, RuntimeConfig, FileMapping, SyncConfig) and a YAML loader (load_config). FileMapping provides source_path() and target_table() helpers; number-typed YAML keys/values (e.g. root: 2026) are coerced to str via coerce_numbers_to_str. Includes config.example.yaml template (config.yaml with real credentials stays gitignored) and pyproject.toml pytest config (pythonpath=src). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
44
config.example.yaml
Normal file
44
config.example.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
sql_server:
|
||||
conn_str: "Driver={ODBC Driver 17 for SQL Server};Server=<SERVER>,1433;Database=<DB>;UID=<USER>;PWD=<PASSWORD>;Encrypt=yes;TrustServerCertificate=yes;"
|
||||
sync_queue_table: "dbo.SyncQueue"
|
||||
|
||||
access:
|
||||
driver: "{Microsoft Access Driver (*.accdb, *.mdb)}"
|
||||
roots:
|
||||
2026: "\\\\<server>\\生产进度表\\<年份>数据"
|
||||
2025: "\\\\<server>\\生产进度表\\<年份>数据"
|
||||
|
||||
runtime:
|
||||
poll_interval_seconds: 10
|
||||
capture_batch_size: 500
|
||||
apply_batch_size: 200
|
||||
max_retries: 5
|
||||
retry_backoff_seconds: 30
|
||||
cleanup_batch_size: 200
|
||||
cleanup_lock_retries: 3
|
||||
|
||||
logging:
|
||||
level: INFO
|
||||
path: "<LOG_PATH>"
|
||||
|
||||
files:
|
||||
- {file: "一车间.accdb", root: 2026, schema: "workshopOne", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog", "一车间每日催货落实记录_停"]}
|
||||
- {file: "二车间.accdb", root: 2026, schema: "workshopTwo", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "三车间.accdb", root: 2026, schema: "workshopThree", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "弯管车间.accdb", root: 2026, schema: "tubeBending", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "氩弧焊.accdb", root: 2026, schema: "TIGWelding", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog", "氩弧焊每日催货落实记录_停"]}
|
||||
- {file: "机加工.accdb", root: 2026, schema: "machining", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "零件库.accdb", root: 2026, schema: "partsWarehouse", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "成品入库.accdb", root: 2026, schema: "productWarehousing", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "检验记录数据库.accdb", root: 2026, schema: "inspectionRecords", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"], include_tables: ["检验合格记录表"]}
|
||||
- {file: "温度计记录.accdb", root: 2026, schema: "thermometerRecord", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "锡焊数据.accdb", root: 2026, schema: "solderingData", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "计划.accdb", root: 2026, schema: "contractPlanning", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog", "每日催货合同号_停", "每日催货缺件落实记录_停"]}
|
||||
- {file: "隔膜数据.accdb", root: 2026, schema: "diaphragmData", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "执行卡下发记录.accdb", root: 2026, schema: "executionCardIssuanceRecord", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- {file: "OEM.accdb", root: 2026, schema: "OEM", year_suffix: "_YEAR2026", exclude_tables: ["TableChangeLog"]}
|
||||
- file: "生产合同数据.accdb"
|
||||
root: 2025
|
||||
schema: "productionContractData"
|
||||
year_suffix: ""
|
||||
exclude_tables: ["TableChangeLog", "dbo_TableChangeLog", "USysApplicationLog", "温度计数据_修复"]
|
||||
Reference in New Issue
Block a user