MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _warn_pk_with_no_anticipated_value

Function _warn_pk_with_no_anticipated_value

lib/sqlalchemy/sql/crud.py:1797–1816  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

1795
1796
1797def _warn_pk_with_no_anticipated_value(c):
1798 msg = (
1799 "Column '%s.%s' is marked as a member of the "
1800 "primary key for table '%s', "
1801 "but has no Python-side or server-side default generator indicated, "
1802 "nor does it indicate 'autoincrement=True' or 'nullable=True', "
1803 "and no explicit value is passed. "
1804 "Primary key columns typically may not store NULL."
1805 % (c.table.fullname, c.name, c.table.fullname)
1806 )
1807 if len(c.table.primary_key) > 1:
1808 msg += (
1809 " Note that as of SQLAlchemy 1.1, 'autoincrement=True' must be "
1810 "indicated explicitly for composite (e.g. multicolumn) primary "
1811 "keys if AUTO_INCREMENT/SERIAL/IDENTITY "
1812 "behavior is expected for one of the columns in the primary key. "
1813 "CREATE TABLE statements are impacted by this change as well on "
1814 "most backends."
1815 )
1816 util.warn(msg)

Callers 3

_scan_colsFunction · 0.85

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected