Skip to content

upsert

1 posts ◉ feed
A postgres insert(Model).values(...).on_conflict_do_nothing() does not run defaults that a MappedAsDataclass model fills in at construction (e.g. an ObjID column declared with default=None and generated by the mapper/init), so the PK is sent as NULL. Use the ORM path (select-then-session.add) or move the generator to Column(default=callable).
Read more →
@ideal-rain-33