반응형
Database 관련
1. sqlalchemy.exc.InvalidRequestError: Class <class 'app.models.Blog'> does not have a __table__ or __tablename__ specified and does not inherit from an existing table-mapped class.
선언한 클래스에 테이블 이름을 지정하지 않아서 나타는 문제이다, 해당 클래스에 테이블명을 선언하면 된다.
(이전)
class Blog(Base):
...
(변경)
class Blog(Base):
__tablename__ = 'blog'
...
2. sqlalchemy.exc.CompileError: (in table 'blog', column 'body'): VARCHAR requires a length on dialect mysql
해당 컬럼에 길이를 지정하지 않아서 나타나는 문제였다. 해당 컬럼에 N 길이를 지정하면된다.
(이전)
body = Column(String)
(변경)
body = Column(String(100))
728x90
반응형
'Programming > Python' 카테고리의 다른 글
| [Python] Pycharm 에러 해결법 정리 (0) | 2023.01.14 |
|---|---|
| [에러] 파이썬 가상환경 보안 에러 (0) | 2023.01.13 |
| [FastAPI] 응답 모델 (0) | 2022.08.13 |
| [FastAPI] 요청 본문 (0) | 2022.08.12 |
| [FastAPI] 쿼리 매개변수 (0) | 2022.08.11 |