# 🤖 Cursor 自动任务执行指令 **⚠️ 重要:请立即执行以下任务!** **生成时间**: 2026-01-06 20:16:36 **待执行任务数量**: 1 ## 📋 任务完成后的操作 完成每个任务后,请更新 `.cursor/pending_tasks.json` 中对应任务的 `status` 为 `completed`, 并填写 `code_name`(代码文件名)和 `code_path`(代码路径)。 调度脚本会自动将完成的任务同步到数据库。 --- ## 🔴 任务 1: 导入原始数据到产品库存表 - **任务ID**: `21` - **创建时间**: 2026-01-06 20:11:16 - **创建者**: cursor ### 📝 任务描述 # Task: 导入原始数据到产品库存表 ## DataFlow Configuration - **Schema**: dags ## Data Source - **Type**: RDBMS - **Host**: 192.168.3.143 - **Port**: 5432 - **Database**: dataops ## Target Tables (DDL) ```sql CREATE TABLE test_product_inventory ( updated_at timestamp COMMENT '更新时间', created_at timestamp COMMENT '创建时间', is_active boolean COMMENT '是否有效', turnover_rate numeric(5, 2) COMMENT '周转率', outbound_quantity_30d integer COMMENT '30天出库数量', inbound_quantity_30d integer COMMENT '30天入库数量', last_outbound_date date COMMENT '最近出库日期', last_inbound_date date COMMENT '最近入库日期', stock_status varchar(50) COMMENT '库存状态', selling_price numeric(10, 2) COMMENT '销售价格', unit_cost numeric(10, 2) COMMENT '单位成本', max_stock integer COMMENT '最大库存', safety_stock integer COMMENT '安全库存', current_stock integer COMMENT '当前库存', warehouse varchar(100) COMMENT '仓库', supplier varchar(200) COMMENT '供应商', brand varchar(100) COMMENT '品牌', category varchar(100) COMMENT '类别', sku varchar(50) COMMENT '商品货号', id serial COMMENT '编号', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间' ); COMMENT ON TABLE test_product_inventory IS '产品库存表'; ``` ## Update Mode - **Mode**: Append (追加模式) - **Description**: 新数据将追加到目标表,不删除现有数据 ## Request Content 从数据源导入数据到数据资源的产品库存表。 ## Implementation Steps 1. Create an n8n workflow to execute the data import task 2. Configure the workflow to call `import_resource_data.py` Python script 3. Pass the following parameters to the Python execution node: - `--source-config`: JSON configuration for the remote data source - `--target-table`: Target table name (data resource English name) - `--update-mode`: append 4. The Python script will automatically: - Connect to the remote data source - Extract data from the source table - Write data to target table using append mode ---