refactor: 引入 SQLAlchemy 多数据库抽象(PostgreSQL + SQL Server)
- 新增 orm.py:按 db_type 构建引擎(postgresql+psycopg2 / mssql+pyodbc), 声明式 Attachment 模型,init_schema 幂等建表 - 重写 db.py 为 SQLAlchemy Core 实现(动态 Table + quote 跨库正确引用、 id/sn 双键回查、跨库分页、先删后插幂等),对外签名不变 - 配置:config.yaml 默认 PostgreSQL,新增 config.mssql.yaml 保留 SQL Server, config_loader 支持可选 driver 与 db_type - write_attachments.py 新增 --init-db - 依赖 requirements.txt 增 sqlalchemy / psycopg2-binary(保留 pyodbc) - README 对齐:修正目标表字段描述并新增数据库抽象层小节
This commit is contained in:
@@ -10,7 +10,7 @@ import yaml
|
||||
|
||||
_REQUIRED_KEYS = {
|
||||
"database": [
|
||||
"driver", "server", "port", "database", "schema", "username", "password",
|
||||
"server", "port", "database", "schema", "username", "password",
|
||||
"table", "id_column", "param_column", "connect_timeout", "query_timeout",
|
||||
],
|
||||
"llm": [
|
||||
|
||||
Reference in New Issue
Block a user