| 1234567891011121314151617181920212223242526272829 |
- # -*- coding: utf-8 -*-
- """PostgreSQL 连接池(向后兼容 re-export 层)。
- Phase 1 重构后真实实现在 BiddingKG.dl.infra.db。
- 本文件与 interface/Connection.py 原本完全一致,已合并为统一实现。
- 原硬编码:
- host="192.168.2.101", user="postgres", password="postgres"
- 已移除,改走 config/db.yaml + 环境变量。
- """
- from __future__ import absolute_import
- from BiddingKG.dl.infra.db import get_connection as _get_connection, get_pool as _get_pool
- __all__ = ["getConnection", "pool"]
- def getConnection():
- """原 common/Connection.getConnection(),默认 BiddingKG 库。"""
- return _get_connection("BiddingKG")
- def get_connection(dbname="BiddingKG"):
- """显式按库名取连接。"""
- return _get_connection(dbname)
- # 向后兼容:保留模块级 pool 变量名(原为 None 占位)
- pool = None
|