Keys in SQLAlchemy
Learn about keys and the keyword nullable in SQLAlchemy.
We'll cover the following...
Primary key
Let’s look at the following code:
id = Column(types.Integer, primary_key=True)
The id
field indicates that it is the primary key
. This means that no two records can have the same id
in this table. In other words, the primary key
must remain unique at all times. When a record is submitted, it overwrites the existing record with the same id
, if any. The exception is when the id
is not ...