Skip to content

save() may break database consistency (concurrency issue) #564

Open
@tahajahangir

Description

@tahajahangir

save() only saves changed fields in existing documents, This is pretty fine, but it saves with upsert=True! So, if someone deleted the document in the meanwhile, we end-up with a document with only updated fields (and missing required fields). (We encountered to these mal-structured rows in our database.)

save() should not use upsert=True when updating only changed fields. It may check for results and raise an exception if no document is updated (sqlalchemy has a StaleDataError for this porpose)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions