引入 PostgreSQL 持久化:到货核销数据入库管道
- 新增 db_store.py:解析 downloads/ 下各站应到/实到/未到 Excel,幂等 UPSERT 入库(统一核心列 + raw JSONB 兜底,单号按文本存) - 新增 schema.sql:三表(expected/actual/undelivered_record),隔离到专用 schema inbound_verify(CREATE SCHEMA + search_path) - 韵达实到业务清洗:抛弃「交接单号」为空行 + 按子单号去重 - 同步 config.example.yaml(postgres 配置)与 requirements.txt(psycopg[binary]) 本次仅手动入库管道;自动挂载到下载流程留待后续。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -68,3 +68,22 @@ anneng:
|
||||
# 安能 Electron 应用的可执行文件路径。
|
||||
# 路径含反斜杠/空格/@,用单引号包裹即可(YAML 单引号串按字面解析)。
|
||||
app_path: 'D:\SoftWare\SoftWare Installation\@ane-electron-uiapp\安能全网门户.exe'
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# PostgreSQL 数据持久化(到货核销数据入库,详见 db_store.py)
|
||||
# ----------------------------------------------------------------------------
|
||||
# createdb 会连接名为 postgres 的维护库来创建下方 dbname 指定的数据库。
|
||||
# 命令行:
|
||||
# python db_store.py createdb 创建数据库(幂等)
|
||||
# python db_store.py init 建表(幂等)
|
||||
# python db_store.py ingest [site] 入库全站或单站(幂等 UPSERT)
|
||||
# python db_store.py all createdb → init → 全站 ingest
|
||||
postgres:
|
||||
host: 127.0.0.1
|
||||
port: 5432
|
||||
user: postgres
|
||||
# 连接密码;config.yaml 已 gitignore,真实凭据只写在那里,切勿提交示例值。
|
||||
password: "YOUR_PASSWORD_HERE"
|
||||
dbname: CQHXDB
|
||||
# 承载到货核销表的专用 schema(隔离 public);表建在此 schema 下。
|
||||
schema: inbound_verify
|
||||
|
||||
Reference in New Issue
Block a user