Skip to content

Insert same book by two different users #35

@badcrc

Description

@badcrc

So I started using it :)

After importing my goodreads exports (I already send a PR with a couple of fixes for the import) then I added an account for my SO, she tried to import her data and it failed on some books: the same books we both have on our list:

data: {"event": "error", "message": "Import failed on row 35: (sqlite3.IntegrityError) UNIQUE constraint failed: book.isbn\n[SQL: INSERT INTO book (title, subtitle, author, isbn, cover_url, publisher, published_year, page_count, language, notes, blurb, rating, reading_status, user_id, date_added, date_started, date_finished) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]\n[parameters: ('A Body at the Irish Book Club (A Mercy McCarthy Mystery #5)', None, 'Lucy Connelly', '9781805501503', None, 'Bookouture', 2026, 228, None, 'Thank you to Bookouture and NetGalley for this amazing ARC called A body at the Irish Book Club!\\n\\nI enjoyed this cozy mystery in a way I haven\u2019t ex ... (239 characters truncated) ... eck .', None, 5, 'read', 2, '2026-06-07 09:17:33.231752', '2026-03-23 00:00:00.000000', '2026-03-25 00:00:00.000000')]\n(Background on this error at: https://sqlalche.me/e/20/gkpj). All changes rolled back."}

Seems that this is caused by the Book having a unique attribute to the isbn.

In a site with a lot of users the ideal solution should be a table just for books and a different one serving as book list for the users (and thats a big change), this comes with a lot of bagagge though: ratings, notes, tags, etc.. per user.

IMHO if the intended use of the project is selfhosting (at least for me), data duplication shouldn't be an issue and just adding a constraint of isbn+user_id should be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions