存在PrimaryKeyConstraint时无法为映射表组装任何主键列

时间:2018-09-28 16:37:49

标签: python sqlalchemy

我有一个定义如下的表,带有多列主键约束:

curl http://netstorage.unity3d.com/unity/3757309da7e7/MacEditorInstaller/Unity-5.2.2f1.pkg

File not found."

但是,当我尝试运行该应用程序时,收到以下错误:class ExampleTable(db.Model): __tablename__ = "example_table" __table_args__ = tuple(db.PrimaryKeyConstraint("model_id_1", "model_id_2", "model_id_3", name="models_pk")) model_id_1 = db.Column(db.SmallInteger, nullable=False) model_id_2 = db.Column(db.Integer, nullable=False) model_id_3 = db.Column(db.Integer, nullable=False) rank = db.Column(db.REAL, nullable=False) 。如果我将could not assemble any primary key columns for mapped table 'example_table'添加到三个相关列中,则它起作用,但是未命名生成的pk约束。如何正确创建名称,多列主键约束?

0 个答案:

没有答案