Skip to content

fix: logging and connect db refactoring #89

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ParkGyeongTae
Copy link
Contributor

#️⃣ Issue Number

📝 요약(Summary)

  • Database 연결 리펙토링 및 로깅 추가, DB 연결 두번 시도하는 현상 수정
    • llm_utils/connect_db.py 코드 리펙토링
    • 클래스 객체로 선언시 자동 연결 확인
    • 로깅 추가
    • lang2sql.py 기존 코드에서 두번씩 연결 확인하는 부분 수정
2025-05-01 11:13:11 [INFO] Successfully connected to ClickHouse.
2025-05-01 11:13:11 [INFO] Successfully connected to ClickHouse.

💬 To Reviewers (선택)

  • 없음

PR Checklist

reference) How to Code Review

  • 따봉(👍): 리뷰어가 리뷰이의 코드에서 칭찬의 의견을 남기고 싶을 때 사용합니다.
  • 느낌표(❗): 리뷰어가 리뷰이에게 필수적으로 코드 수정을 요청할 때 사용합니다.
  • 물음표 (❓): 리뷰어가 리뷰이에게 의견을 물어보고 싶을 때 사용합니다.
  • 알약 (💊): 리뷰어가 리뷰이의 코드에서 개선된 방법을 제안하지만 그것의 반영이 필수까지는 아닐 때 사용합니다.

Copy link
Collaborator

@ehddnr301 ehddnr301 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 조금 더 구조화된 코드인것으로 보여 너무 좋습니다! @anjaaaaeeeellll 님도 확인 한번 해주시면 좋을것 같습니다!

💬 DB selectbox를 조정할때마다 연결 로깅이 남네요! 요건 streamlit의 구조때문인것 같습니다ㅎㅎ 링크에서 When users interact with widgets, your script reruns from top to bottom, and your app's frontend is updated 라는 문장을 발견했습니다.

image


except Exception as e:
logger.exception("An error occurred while executing SQL: %s", e)
raise
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 이 부분을 처음봐서 GPT에 질문해보았는데 아래와 같다고 하네요!

  • raise → 현재 예외를 그대로 위로 전파 (traceback 유지 ✅)
  • raise e → 예외 객체는 같지만, traceback은 새로 시작 (원래 위치 정보 ❌)

@ParkGyeongTae
Copy link
Contributor Author

👍 조금 더 구조화된 코드인것으로 보여 너무 좋습니다! @anjaaaaeeeellll 님도 확인 한번 해주시면 좋을것 같습니다!

💬 DB selectbox를 조정할때마다 연결 로깅이 남네요! 요건 streamlit의 구조때문인것 같습니다ㅎㅎ 링크에서 When users interact with widgets, your script reruns from top to bottom, and your app's frontend is updated 라는 문장을 발견했습니다.

image

@ehddnr301 오 저도 이걸 확인했는데, 옵션을 수정할때마다 재설정을 하는 것 같습니다..!
@anjaaaaeeeellll 확인 한번 부탁드립니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants