codestates / codestates/ds-TIL

[TIL] 오예은_201204

Open
#1,108 0 comments 0 reactions 0 assignees View on GitHub
DSFT01
Dominant language
No language data
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Section3 Project Week) day 5

### To-do
- 기능 구현(진행중)
- 블로그 초안 작성

### 에러 리포트
#### File "/home/doris/twitter_webapp/twitter_webapp/models.py", line 43, in set_tweetdata
userid = User.query.filter_by(username=username).first().id
AttributeError: 'NoneType' object has no attribute 'id'
- 조건을 걸어 데이터를 조회했는데 0개가 조회되면(아이디가 테이블에 없는 경우) 이런 오류가 발생한다.
조회하고자 하는 조건의 검색결과가 0개일 때(예외 처리) 어떻게 조치할 수 있는지 알아봐야 할 것 같다.

#### File "/home/doris/anaconda3/envs/twit_app/lib/python3.9/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 898, in do_executemany
cursor.executemany(statement, parameters)
sqlalchemy.exc.DataError: (psycopg2.errors.NumericValueOutOfRange) integer out of range
- 트위피로 받은 Twitter id가 일정 수준을 넘어선 데이터라서 나는 오류였다.
내가 만든 User table의 ID는 Int4형이었기 때문에 너무 큰 수는 들어갈 수 없다.
큰 수를 넣기 위해 BigInteger(사실상 무한대 정수라고 하는...)로 바꿔주고 migration을 다시 해주었더니 해결되었다.
(migration을 다시 하면 기존 데이터가 지워진다는 단점도 기억하기)

### 느낀 것
- 우려했던 바 대로 기능 구현이 채 되지 않은 채 (오히려 기능을 넣다가 다른 오류까지 덤으로 얻어버린 채로ㅠㅜ) 발표를 했다.
교육 들어와서 가장 나에게 실망스러운 날이기도 했지만, 무사히 발표를 마칠 수 있음에 감사했다.
그리고 발표가 끝나고도 한동안 쉬어야겠다는 강박이 들어 기능구현은 한참있다가 완료하고나서 든 생각은
미리미리 제시된 양을 끝내는 것이 가장 슬기로운 수강생의 자세라는 깨달음이다.
- 다음 프로젝트 때는 부디 이런 참사가 일어나지 않기를 기도하며 그때 그때 최선을 다 해야겠다고 다짐한다.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.