-
Notifications
You must be signed in to change notification settings - Fork 2
[AI] SISC2-40 [FIX] inference 오류 수정 #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "SISC2-40-AI-\uC11D\uC7AC\uBE48-inference-\uCF54\uB4DC-\uC218\uC815"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,23 +27,22 @@ | |
| # --- DB 연결 테스트 ------------------------------------------------------------ | ||
| conn = None | ||
| try: | ||
| # db 설정이 dict면 키워드 인자로, 문자열(DSN)이면 그대로 사용 | ||
| if isinstance(db_cfg, dict): | ||
| conn = psycopg2.connect(**db_cfg) # 예: {"host": "...", ...} | ||
| else: | ||
| conn = psycopg2.connect(dsn=str(db_cfg)) | ||
|
|
||
| with conn: | ||
| with conn.cursor() as cur: | ||
| cur.execute("SELECT version();") | ||
| print("✅ 연결 성공:", cur.fetchone()[0]) | ||
|
|
||
| cur.execute("SELECT current_database(), current_user;") | ||
| db, user = cur.fetchone() | ||
| print(f"ℹ️ DB/USER: {db} / {user}") | ||
| if isinstance(db_cfg, dict): | ||
| with psycopg2.connect(**db_cfg) as conn: | ||
| with conn.cursor() as cur: | ||
| cur.execute("SELECT version();") | ||
| print("✅ 연결 성공:", cur.fetchone()[0]) | ||
| cur.execute("SELECT current_database(), current_user;") | ||
| db, user = cur.fetchone() | ||
| print(f"ℹ️ DB/USER: {db} / {user}") | ||
| else: | ||
| with psycopg2.connect(dsn=str(db_cfg)) as conn: | ||
| with conn.cursor() as cur: | ||
| ... | ||
|
Comment on lines
+30
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Context manager의 변수 스코프 문제 및 DSN 경로 미완성 다음과 같은 심각한 문제들이 있습니다:
다음 diff를 적용하여 문제를 수정하세요: -conn = None
try:
if isinstance(db_cfg, dict):
- with psycopg2.connect(**db_cfg) as conn:
- with conn.cursor() as cur:
- cur.execute("SELECT version();")
- print("✅ 연결 성공:", cur.fetchone()[0])
- cur.execute("SELECT current_database(), current_user;")
- db, user = cur.fetchone()
- print(f"ℹ️ DB/USER: {db} / {user}")
+ conn = psycopg2.connect(**db_cfg)
+ with conn.cursor() as cur:
+ cur.execute("SELECT version();")
+ print("✅ 연결 성공:", cur.fetchone()[0])
+ cur.execute("SELECT current_database(), current_user;")
+ db, user = cur.fetchone()
+ print(f"ℹ️ DB/USER: {db} / {user}")
else:
- with psycopg2.connect(dsn=str(db_cfg)) as conn:
- with conn.cursor() as cur:
- ...
+ conn = psycopg2.connect(dsn=str(db_cfg))
+ with conn.cursor() as cur:
+ cur.execute("SELECT version();")
+ print("✅ 연결 성공:", cur.fetchone()[0])
+ cur.execute("SELECT current_database(), current_user;")
+ db, user = cur.fetchone()
+ print(f"ℹ️ DB/USER: {db} / {user}")
except Exception as e:
print("❌ 연결 실패:", repr(e))
finally:
if conn:
conn.close()
print("DB 연결 종료")
🧰 Tools🪛 Ruff (0.14.3)37-37: String contains ambiguous (RUF001) 🤖 Prompt for AI Agents |
||
| except Exception as e: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 광범위한 예외 처리 모든 더 구체적인 예외 처리를 원하신다면: -except Exception as e:
+except psycopg2.Error as e:
print("❌ 연결 실패:", repr(e))
🧰 Tools🪛 Ruff (0.14.3)42-42: Do not catch blind exception: (BLE001) 🤖 Prompt for AI Agents |
||
| print("❌ 연결 실패:", repr(e)) | ||
| finally: | ||
| if conn is not None: | ||
| if conn: | ||
| conn.close() | ||
| print("DB 연결 종료") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
특수 유니코드 문자 사용
ℹ️(INFORMATION SOURCE) 문자는 일부 터미널 환경에서 렌더링 문제를 일으킬 수 있습니다. 일반적인 ASCII 문자(예:[INFO])를 사용하는 것을 권장합니다.원하신다면 다음과 같이 수정할 수 있습니다:
📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.14.3)
37-37: String contains ambiguous
ℹ(INFORMATION SOURCE). Did you meani(LATIN SMALL LETTER I)?(RUF001)
🤖 Prompt for AI Agents