Home
Sign Up
Sign In
CRITICAL7's recent timeline updates
CRITICAL7
V2EX member #245618, joined on 2017-07-30 19:48:03 +08:00
CRITICAL7
提问
技术话题
好玩
工作信息
交易信息
城市相关
Per CRITICAL7's settings, the topics list is hidden
Deals
info, including closed deals, is not hidden
CRITICAL7's recent replies
Jun 3, 2020
Replied to a topic by
LennonChin
›
Python
›
请问, SQLAlchemy 无外键约束的多对多关系模型该怎么写啊?
emm 就是这么写吧大概。。官网 tutorial 改了改
```
class User(Base):
id = Column(Integer, primary_key=True)
class UserAddress(Base):
id = Column(Integer, primary_key=True)
user_id = Column(Integer)
address_id = Column(Integer)
user = relationship("User", primaryjoin="foreign(UserAddress.user_id) ==
User.id
")
address = relationship("Address", primaryjoin="foreign(UserAddress.address_id) ==
Address.id
")
class Address(Base):
id = Column(Integer, primary_key=True)
```
»
More replies by CRITICAL7
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
2581 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms ·
UTC 15:49
·
PVG 23:49
·
LAX 08:49
·
JFK 11:49
♥ Do have faith in what you're doing.
❯