sqlalchemy foreign keys works only with primary key?
问题 Tables and foreign keys are creating ok, but working not ok: SQLite version 3.7.9 2011-11-01 00:52:41 sqlite> pragma foreign_keys=on; sqlite> sqlite> CREATE TABLE t1(id int primary key, uuid varchar(36)); sqlite> CREATE TABLE t2(id int primary key, t1_uuid varchar(36), FOREIGN KEY (t1_uuid) REFERENCES t1(uuid)); sqlite> sqlite> INSERT INTO t1(uuid) values ("uuid-1"); sqlite> INSERT INTO t2(t1_uuid) values ("uuid-1"); Error: foreign key mismatch But if i make t1(uuid) primary key, all works as