Skip to content

v4.11.0

Latest

Choose a tag to compare

@nhumrich nhumrich released this 22 Apr 22:05

Added

Support INSERT with all default values

Table.insert() with no values now emits INSERT INTO t DEFAULT VALUES, useful when every column has a database or SQLAlchemy default. Combines with .returning() and .on_conflict_do_nothing() on Postgres/SQLite.

MyTable.insert().returning('id').render()
# ('INSERT INTO mytable DEFAULT VALUES RETURNING id', [])

MySQL note: DEFAULT VALUES is not valid MySQL syntax. Combining empty values with .on_duplicate_key_update() raises ValueError.

See commit 8148264 for full details.