from pathlib import Path p=Path('/root/.openclaw/workspace/sqlserver/company_db_tool.py') text=p.read_text(encoding='utf-8') old='''BUSINESS_TABLES = [ "jst_goods_profit_kpi_items_afs", "jst_sku", "fys_shopInfo", "jst_order_express_details", "fys_SkuDataLibrary_SpuConfig", "op_operManage", "op_TargetManagement", "fys_Ticketing_install", "fys_Ticketing_install_item", "fys_jstFreightCost", "fys_jstFreightCostDetail", "pc_kfChatLog", ] ''' new='''BUSINESS_TABLES = [ "jst_goods_profit_kpi_items_afs", "jst_sku", "fys_shopInfo", "jst_order_express_details", "fys_SkuDataLibrary_SpuConfig", "op_operManage", "op_TargetManagement", "fys_Ticketing_install", "fys_Ticketing_install_item", "fys_jstFreightCost", "fys_jstFreightCostDetail", "pc_kfChatLog", "jst_inventoryInfo", "pm_InventoryMonitor", "pm_stockMonitor", "wp_stock", "erp_wms_stockbiz", ] ''' if old not in text: raise SystemExit('target block not found') text=text.replace(old,new,1) # also update dimension row if exists needle=''' ("时间维度", "创建时间、支付时间、发货时间、签收时间、订单完成时间", "全表通用时间字段(createdAt/createTime/pay_time/send_time 等)"), ("客服问题维度", "聊天主次原因、问题内容、订单关联", "pc_kfChatLog"), ''' insert=''' ("时间维度", "创建时间、支付时间、发货时间、签收时间、订单完成时间", "全表通用时间字段(createdAt/createTime/pay_time/send_time 等)"), ("库存维度", "可用库存、锁定库存、在途库存、近7/30天发货均值、缺货预警", "jst_inventoryInfo, pm_InventoryMonitor, pm_stockMonitor, wp_stock, erp_wms_stockbiz"), ("客服问题维度", "聊天主次原因、问题内容、订单关联", "pc_kfChatLog"), ''' if needle in text: text=text.replace(needle,insert,1) p.write_text(text,encoding='utf-8') print('updated',p)