基于用户需求,Data Pipeline API 进行了重要的配置变更,主要目的是:
db_connection
必填参数app_config.py
中的配置{
"db_connection": "postgresql://user:pass@host:5432/dbname", // 必填
"table_list_file": "tables.txt",
"business_context": "业务描述"
}
{
"table_list_file": "tables.txt", // 必填
"business_context": "业务描述", // 必填
"db_name": "highway_db" // 可选
}
app_config.py
中的 APP_DB_CONFIG
schema_workflow
执行app_config.py
中的 PGVECTOR_CONFIG
data_pipeline/api/simple_db_manager.py
create_task()
方法签名db_connection
必填参数_build_db_connection_string()
方法APP_DB_CONFIG
自动获取业务数据库配置data_pipeline/api/simple_workflow.py
SimpleWorkflowManager.create_task()
方法citu_app.py
/api/v0/data_pipeline/tasks
POST 接口db_connection
参数验证db_name
参数支持文档更新
docs/data_pipeline_api_usage_guide.md
docs/data_pipeline_api_design.md
┌─────────────────────┐ ┌─────────────────────┐
│ 业务数据库 │ │ 向量数据库 │
│ (APP_DB_CONFIG) │ │ (PGVECTOR_CONFIG) │
├─────────────────────┤ ├─────────────────────┤
│ • 业务表数据 │ │ • 任务管理表 │
│ • Schema信息 │ ───→ │ • 执行记录表 │
│ • 训练数据源 │ │ • 日志表 │
│ │ │ • 文件输出表 │
└─────────────────────┘ └─────────────────────┘
↑ ↑
│ │
schema_workflow SimpleTaskManager
数据处理执行 任务状态管理
db_connection
必填参数db_connection
参数app_config.py
中正确配置了 APP_DB_CONFIG
db_name
参数指定特定数据库data_pipeline/sql/init_tables.sql
在向量数据库中创建# 业务数据库配置(用于数据处理)
APP_DB_CONFIG = {
'host': '192.168.67.1',
'port': 6432,
'dbname': 'highway_db',
'user': 'postgres',
'password': 'password'
}
# 向量数据库配置(用于任务管理)
PGVECTOR_CONFIG = {
'host': '192.168.67.1',
'port': 5432,
'dbname': 'highway_pgvector_db',
'user': 'postgres',
'password': 'password'
}
curl -X POST http://localhost:8084/api/v0/data_pipeline/tasks \
-H "Content-Type: application/json" \
-d '{
"table_list_file": "data_pipeline/tables.txt",
"business_context": "高速公路服务区管理系统",
"db_name": "highway_db"
}'
python test_api_changes.py
app_config.py
中的数据库配置正确init_tables.sql
A:
A:
db_name
参数app_config.py
中修改 APP_DB_CONFIG
A:
db_connection
的请求会被忽略此参数table_list_file
和 business_context
A:
这次变更使Data Pipeline API更加简洁和易用,同时保持了系统的功能完整性。通过将配置管理集中到 app_config.py
,提高了系统的可维护性和安全性。