task_execute_instructions.md 3.1 KB

🤖 Cursor 自动任务执行指令

⚠️ 重要:请立即执行以下任务!

生成时间: 2026-01-07 16:35:20

待执行任务数量: 1

📋 任务完成后的操作

完成每个任务后,请更新 tasks/pending_tasks.json 中对应任务的 statuscompleted, 并填写 code_name(代码文件名)和 code_path(代码路径)。

调度脚本会自动将完成的任务同步到数据库。

⚠️ 任务约束要求

重要约束:完成脚本创建后,不需要生成任务总结文件

  • ❌ 不要创建任何 summary、report、总结类的文档文件
  • ❌ 不要生成 task_summary.md、execution_report.md 等总结文件
  • ✅ 只需创建任务要求的功能脚本文件
  • ✅ 只需更新 tasks/pending_tasks.json 中的任务状态

🔴 任务 1: 导入原始的产品库存表

  • 任务ID: 22
  • 创建时间: 2026-01-07 10:29:12
  • 创建者: cursor

📝 任务描述

Task: 导入原始的产品库存表

DataFlow Configuration

  • Schema: dags

Data Source

  • Type: RDBMS
  • Host: 192.168.3.143
  • Port: 5432
  • Database: dataops

Target Tables (DDL)

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