我正在玩SQLite和python。我正在使用sqlalchemy并有一个像这样的表设置:
quizzes = Table("quizzes", metadata,
Column("id", Integer, primary_key = True),
Column("subject", String, default = "Math"),
Column("description", String),
Column("answer_a", String),
Column("answer_b", String),
Column("answer_c", String),
Column("answer_d", String),
Column("can_retry", Boolean, default = False)
)
现在我尝试插入一行:
i = quizzes.insert()
i.execute({ "subject": "Biology",
"description": "Where is the heart?",
"answer_a": "In the head",
"answer_b": "In the arm",
"answer_c": "In the gut",
"answer_d": "Dunno",
"can_retry": True
})
然而,当我发现subject
为Math
且can_retry
为0
后我检查数据库时,即使我另外设置了它们。我究竟做错了什么?为什么即使我提供新的默认值,它仍然使用默认值?