- Consolidated database, file source, and field mapping configurations into dedicated modules under the `config` directory. - Removed hardcoded database connection details from `migration.py` and replaced them with imports from the new configuration structure. - Updated `ntfy_utils.py` and `run_incremental_sync.py` to utilize the new configuration imports for cleaner code and better maintainability. - Deleted `update_config.py` as its contents have been integrated into the new configuration files. - Added a new `settings.local.json` for managing permissions related to script execution. - Enhanced the structure of the migration tasks and Excel configurations for better organization and clarity.
31 lines
986 B
Python
31 lines
986 B
Python
# config/database.py
|
|
# 统一的数据库配置
|
|
|
|
# ================= SQL Server 配置 =================
|
|
SQL_SERVER_CONFIG = {
|
|
'driver': 'ODBC Driver 18 for SQL Server',
|
|
'server': '192.168.110.114',
|
|
'database': 'CompanyDB',
|
|
'username': 'peng',
|
|
'password': 'Cqbld123456.',
|
|
'trust_server_certificate': 'yes'
|
|
}
|
|
|
|
# ================= Access 驱动配置 =================
|
|
ACCESS_DRIVER = "{Microsoft Access Driver (*.mdb, *.accdb)}"
|
|
|
|
# ================= 兼容性别名 =================
|
|
# 为了兼容旧代码,提供不同命名风格的别名
|
|
|
|
# SQL_SERVER_CONN - 兼容 db_utils.py (使用 uid/pwd)
|
|
SQL_SERVER_CONN = {
|
|
'driver': f"{{{SQL_SERVER_CONFIG['driver']}}}",
|
|
'server': SQL_SERVER_CONFIG['server'],
|
|
'database': SQL_SERVER_CONFIG['database'],
|
|
'uid': SQL_SERVER_CONFIG['username'],
|
|
'pwd': SQL_SERVER_CONFIG['password']
|
|
}
|
|
|
|
# DB_CONFIG - 兼容 etl_manager.py, migration.py (使用 username/password)
|
|
DB_CONFIG = SQL_SERVER_CONFIG.copy()
|