实体是否总是需要双向关系?
我有两张桌子。
表
和;
塔布莱
表
+------+----------------+-----------+
| id | some_attribute | tableB_id |
+------+----------------+-----------+
id
=主键
some_attribute
= VARCHAR
TableB_id
=外键
塔布莱
+------+----------------+
| id | some_attribute |
+------+----------------+
身份证件
=主键
某些属性
= VARCHAR
如何使用pony orm重新创建这种关系?
我的当前代码:
# establish a connection with the database (MySQL)
db = Connection.Connection.connect_db_server_default()
class TableB(db.Entity):
_table_ = "table_b"
id = PrimaryKey(int, auto=False)
some_attribute = Required(str)
class TableA(db.Entity):
_table_ = "table_a"
id = PrimaryKey(int, auto=False)
some_attribute = Required(str)
TableB_id = Set(TableA)
给出以下错误:
pony.orm.core.erdiagramerrror:表a.tableb_id的反向属性
找不到