(many to many)에러문구 관련
369
작성한 질문수 58
안녕하세요.
그대로 코드를 진행했는데요. 상호참조하는 것 관련해서 에러가 나는데 그냥 무시를 해도 될까요?

=>
admin = Role(position='admin') 실행시 에러문구
workspace/inflearn_240120/venv/bin/ipython:1: SAWarning: relationship 'User.project' will copy column user.id to column user_project.user_id, which conflicts with rel
ationship(s): 'Project.user' (copies user.id to user_project.user_id), 'User.projects' (copies user.id to user_project.user_id). If this is not the intention, consider
if theserelationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that
foreign key constraints are partially overlapping, the orm.foreign()annotation can be used to isolate the columns that should be written towards. To silence this war
ning, add the parameter 'overlaps="projects,user"' to the 'User.project' relationship. (Background on this warning at: https://sqlalche.me/e/20/qzyx) (This warning ori
ginatedfrom the configure_mappers() process, which was invoked automatically in response to a user-initiated operation.)

답변 1
0
backref ='user' -> back_populates='users'
backref='project' -> back_populates='projects'
로 수정하니 경고문구가 없어졌고 실행도 잘 되는데요.
Document를 여러번 읽어보니, 헷갈리기는 한데요..
backref를 사용할 때는 parent 이든 child 이든 한쪽에만 하고 양쪽으로는 back_populates 를 넣는 듯 한데..
사실 sqlalchemy 에서 이 관계설정이 핵심일 거 같은데.
혹시 추가적인 설명을 좀 해주실 수 있을지요?
늘 컴퓨터를 켜두어야 하는 것에 대한 질문입니다.
0
7
1
MMDetection 버전 이슈
0
9
2
1유형 강의 다 나간 후 어떻게 할까요?
0
12
1
점수차가 많이 나는데 따로 하신게 있으신가요?
0
8
1
노션 승인 관련
0
20
3
만세력 계산 오류 및 결과 오류
0
26
2
한글 변수의 한글 상태를 만드는 법?
0
18
0
작업형1 모의문제 4번에 3)문제 질문
0
18
2
강의 수강 순서
0
19
1
(등록 웹 페이지 개발 3) relationship등록관련 경고문구
0
289
1
(one-to-many) admin.users.all() 시 출력화면
0
378
1
[db, model2] inflearn 테이블 생성오류시 참고하세요.
0
258
1
use inflearn;
0
314
1
공유 템플릿
0
344
1
run이 작동이 안됩니다ㅠㅠ
0
279
1
서버를 열었을때 404 오류가 납니다
0
277
1
실습 중 질문이 있습니다.
0
561
3
BluePrint 질문입니다.
0
324
1
Project.query.get(1) 질문
0
360
2
db, model2에서 db.create_all()수행시 나타나는 오류입니다..
0
530
1
sql db중에 id 1의 정보가없습니다
0
290
1
relationship 코드위치.
0
170
1
ForeignKey 에러 관련.
0
241
3
Delete가아니고 Update강의가 올라와있네요
0
222
2





