(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 에서 이 관계설정이 핵심일 거 같은데.
혹시 추가적인 설명을 좀 해주실 수 있을지요?
65강 소리
0
3
1
작업형2 모의문제1 (30강)
0
11
1
섹션 5 CSS selector사용해서 클로링하기2의 커리큘럼 일정 부재?
0
11
2
가상환경 초반 에러_create name
0
17
1
안녕하세요 유튜브 보고 재밌을꺼 같아서 강의 결제해서 보고잇습니다.
0
16
2
수강 기간 연장 문의 드립니다.
0
14
1
수강 계획과 관련해 문의 드립니다.
0
18
1
노션 열기에 도움이 필요합니다.
0
26
2
노션 파일 권한
0
24
2
(등록 웹 페이지 개발 3) relationship등록관련 경고문구
0
288
1
(one-to-many) admin.users.all() 시 출력화면
0
378
1
[db, model2] inflearn 테이블 생성오류시 참고하세요.
0
256
1
use inflearn;
0
313
1
공유 템플릿
0
344
1
run이 작동이 안됩니다ㅠㅠ
0
277
1
서버를 열었을때 404 오류가 납니다
0
277
1
실습 중 질문이 있습니다.
0
557
3
BluePrint 질문입니다.
0
322
1
Project.query.get(1) 질문
0
359
2
db, model2에서 db.create_all()수행시 나타나는 오류입니다..
0
528
1
sql db중에 id 1의 정보가없습니다
0
290
1
relationship 코드위치.
0
167
1
ForeignKey 에러 관련.
0
241
3
Delete가아니고 Update강의가 올라와있네요
0
221
2





