Skip to content

Commit 3d6bcb9

Browse files
authored
fix: Upgrading psycopg (#3869)
1 parent 8031b0a commit 3d6bcb9

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

apps/application/migrations/0015_re_database_index.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Generated by Django 4.2.15 on 2024-09-18 16:14
22
import logging
33

4-
import psycopg2
4+
import psycopg
55
from django.db import migrations
6-
from psycopg2 import extensions
76

87
from smartdoc.const import CONFIG
98

@@ -17,7 +16,7 @@ def get_connect(db_name):
1716
"port": CONFIG.get('DB_PORT')
1817
}
1918
# 建立连接
20-
connect = psycopg2.connect(**conn_params)
19+
connect = psycopg.connect(**conn_params)
2120
return connect
2221

2322

@@ -28,7 +27,7 @@ def sql_execute(conn, reindex_sql: str, alter_database_sql: str):
2827
@param conn:
2928
@param alter_database_sql:
3029
"""
31-
conn.set_isolation_level(extensions.ISOLATION_LEVEL_AUTOCOMMIT)
30+
conn.autocommit = True
3231
with conn.cursor() as cursor:
3332
cursor.execute(reindex_sql, [])
3433
cursor.execute(alter_database_sql, [])

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ langchain-huggingface = "0.1.2"
2323
langchain-ollama = "0.3.2"
2424
langgraph = "0.3.27"
2525
mcp = "1.8.0"
26-
psycopg2-binary = "2.9.10"
26+
psycopg = { extras = ["binary"], version = "3.2.9" }
2727
jieba = "0.42.1"
2828
diskcache = "5.6.3"
2929
pillow = "10.4.0"

0 commit comments

Comments
 (0)