main
HuangHai 2 weeks ago
parent fe6fbc5ffd
commit 39e9ad7925

@ -147,7 +147,6 @@ async def get_tree_data():
try: try:
pg_pool = await init_postgres_pool() pg_pool = await init_postgres_pool()
async with pg_pool.acquire() as conn: async with pg_pool.acquire() as conn:
await conn.ping()
async with conn.cursor() as cur: async with conn.cursor() as cur:
await cur.execute(""" await cur.execute("""
SELECT id, SELECT id,
@ -215,7 +214,6 @@ async def update_knowledge(request: fastapi.Request):
pg_pool = await init_postgres_pool() pg_pool = await init_postgres_pool()
async with pg_pool.acquire() as conn: async with pg_pool.acquire() as conn:
await conn.ping()
async with conn.cursor() as cur: async with conn.cursor() as cur:
if update_type == 'prerequisite': if update_type == 'prerequisite':
await cur.execute( await cur.execute(

@ -1,15 +1,10 @@
""" """
pip install asyncpg pip install asyncpg
""" """
import logging
import asyncpg import asyncpg
from Config.Config import * from Config.Config import *
# 配置日志
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger(__name__)
# PostgreSQL 配置 # PostgreSQL 配置
POSTGRES_CONFIG = { POSTGRES_CONFIG = {
"host": POSTGRES_HOST, "host": POSTGRES_HOST,

Loading…
Cancel
Save