| 123456789101112131415161718192021222324252627 |
- # -*- coding: utf-8 -*-
- """PostgreSQL 连接池(向后兼容 re-export 层)。
- Phase 1 重构后真实实现在 BiddingKG.dl.infra.db。
- 本文件与 common/Connection.py 原本完全一致,已合并为统一实现,
- 此处仅 re-export 以保留 interface.Connection 的导入路径。
- 原硬编码:
- host="192.168.2.101", user="postgres", password="postgres"
- 已移除,改走 config/db.yaml + 环境变量。
- """
- from __future__ import absolute_import
- from BiddingKG.dl.common.Connection import ( # noqa: F401
- getConnection,
- get_connection,
- pool,
- )
- __all__ = ["getConnection", "get_connection", "pool"]
- if __name__ == "__main__":
- conn = getConnection()
- cursor = conn.cursor()
- cursor.execute(" select 1")
- print(cursor.fetchall()[0][0])
|