]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Update the Column.nullable docstring for the primary_key=True case
authorMatt Riedemann <mriedem@us.ibm.com>
Mon, 10 Oct 2016 15:43:07 +0000 (11:43 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Oct 2016 15:54:04 +0000 (11:54 -0400)
commit4b94ee113baab901aee881ad94851587c912f785
tree449e4ae8a6bffc42c4b95c493237bb0af27d7565
parentb9d0e2d5c55f68193fae001bb553a51018ab8ed6
Update the Column.nullable docstring for the primary_key=True case

While reviewing a change that created a new table, the
primary_key column value was set to True but nullable was not
explicitly set, which led to some confusion over the default
behavior for the nullable column value when setting a primary_key.

Looking at the docs it's not clear, but the code shows that if
nullable is not specified, then nullable = not primary_key, so
nullable defaults to False when primary_key is True.

This patch adds a simple clarification to the docs so people
don't have to check the code.

Change-Id: I8553339d56fbae11370c7c6af6d8d4723163be1c
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/312
lib/sqlalchemy/sql/schema.py