Skip to content

로컬 디비 생성 로직 및 utils, 암호화 부분 생성 - #32

Merged
apaals2 merged 9 commits into
developfrom
feature/local-db-setup
Aug 3, 2025
Merged

로컬 디비 생성 로직 및 utils, 암호화 부분 생성#32
apaals2 merged 9 commits into
developfrom
feature/local-db-setup

Conversation

@ChoiSeungWoo98

Copy link
Copy Markdown
Contributor

Comment thread app/core/security.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

_key 값은 추후에 환경변수로 분리하실 예정이시죠?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. 해당 부분은 환경 변수로 분리하면 좋으나 .env 파일로 해당 앱에 저장해도 노출되는 문제가 존재하여 고민이 필요할 거 같습니다.

Comment thread app/core/utils.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

추후에 UUID 는 언제 사용해야하나요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

uuid는 auto_increment로 진행되는 부분을 uuid로 진행할지 고민중이라 일단 만들어놨습니다.
아래 장단점 적어놓겠습니다.

  • auto_increment
    • 사용하기 매우 쉽고 직관적
    • 정수형이라 인덱싱과 조인속도가 UUID보다 빠름
    • 저장 공간을 적게 차지
    • ID가 순차적으로 증가하여 외부로 노출될 경우 다음 ID를 쉽게 예측
    • 여러 데이터베이스의 내용을 하나로 합칠 때 ID가 충돌
  • uuid
    • 다른 시스템과 동기화하거나 병합할 때 매우 안전
    • ID를 추측할 수 없어 보안에 더 유리
    • 애플리케이션 코드에서 ID를 미리 만들어 데이터베이스에 삽입
    • 문자열이라 상대적으로 저장 공간을 더 많이 차지
    • 정수보다 인덱싱과 조인 속도가 느릴 수 있음
    • 향후 기능 확장이나 데이터 동기화 가능성시 유리

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

그러면 로컬 db에 값 추가(생성)할때 generate_prefixed_uuid 사용하면 되는건가요?

Comment thread app/db/init_db.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ConnectionProfile 테이블 생성안의 name이 profile_name인거죠?

나머지 DB 테이블들은 추후 추가 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. 네, profile_name 맞습니다. 디비 자체가 프로필 정보를 담는 부분이기 때문에 프로필을 제거한 상태입니다.
  2. 나머지 테이블도 다 만들고 올리려고 합니다. 시간이 없어 해당 부분 진행하다가 멈춘 상태입니다.

@ChoiSeungWoo98 ChoiSeungWoo98 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

리뷰 감사합니다.

Comment thread app/core/security.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. 해당 부분은 환경 변수로 분리하면 좋으나 .env 파일로 해당 앱에 저장해도 노출되는 문제가 존재하여 고민이 필요할 거 같습니다.

Comment thread app/core/utils.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

uuid는 auto_increment로 진행되는 부분을 uuid로 진행할지 고민중이라 일단 만들어놨습니다.
아래 장단점 적어놓겠습니다.

  • auto_increment
    • 사용하기 매우 쉽고 직관적
    • 정수형이라 인덱싱과 조인속도가 UUID보다 빠름
    • 저장 공간을 적게 차지
    • ID가 순차적으로 증가하여 외부로 노출될 경우 다음 ID를 쉽게 예측
    • 여러 데이터베이스의 내용을 하나로 합칠 때 ID가 충돌
  • uuid
    • 다른 시스템과 동기화하거나 병합할 때 매우 안전
    • ID를 추측할 수 없어 보안에 더 유리
    • 애플리케이션 코드에서 ID를 미리 만들어 데이터베이스에 삽입
    • 문자열이라 상대적으로 저장 공간을 더 많이 차지
    • 정수보다 인덱싱과 조인 속도가 느릴 수 있음
    • 향후 기능 확장이나 데이터 동기화 가능성시 유리

Comment thread app/db/init_db.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. 네, profile_name 맞습니다. 디비 자체가 프로필 정보를 담는 부분이기 때문에 프로필을 제거한 상태입니다.
  2. 나머지 테이블도 다 만들고 올리려고 합니다. 시간이 없어 해당 부분 진행하다가 멈춘 상태입니다.

@ChoiSeungWoo98
ChoiSeungWoo98 force-pushed the feature/local-db-setup branch from 1c3a220 to 6bb4811 Compare August 2, 2025 06:46
@ChoiSeungWoo98
ChoiSeungWoo98 force-pushed the feature/local-db-setup branch from 91f1966 to 416235e Compare August 3, 2025 15:28
@apaals2

apaals2 commented Aug 3, 2025

Copy link
Copy Markdown
Contributor

sqlite 관련 내용(사용법 등) readme에 추가 하실 예정인가요?

@apaals2
apaals2 merged commit 4271628 into develop Aug 3, 2025
1 check passed
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