|
|
#331 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,753
Karma: 13151503
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Quote:
|
|
|
|
|
|
|
#332 | |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 105
Karma: 362344
Join Date: Sep 2020
Device: Kindle
|
Quote:
|
|
|
|
|
|
|
#333 |
|
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31
Karma: 59820
Join Date: Jul 2009
Device: Kobo
|
As PeterT mentioned, one workaround for those who have the option is to switch to a Calibre Content Server. Syncing CalibreSync with that still works. I don't like it as much as syncing with my library in Dropbox, but at least it provides functionality while we wait (perhaps forever) to see if CalibreSync itself will be fixed, and doesn't require posthoc modification of the Calibre DB to add the removed columns back.
This means I can only update CalibreSync while the content server is running (something which I do rarely and only when necessary for particular tasks and only while I'm actively at home), rather than allowing me to update the DB on the fly from anywhere I have internet access, but it is better than having no access at all. |
|
|
|
|
|
#334 | |
|
U're so far away fr home
![]() Posts: 16
Karma: 10
Join Date: Jul 2021
Location: Seoul, KR
Device: Various (e.g. Boox Note Max, Go 7, Palma 2, Bigme HiBreak, Xteink X4)
|
Quote:
Can confirm this works brilliantly well, though it caused some anguish...and you only need to run the script once: https://www.mobileread.com/forums/sh...5&postcount=50 ! |
|
|
|
|
|
|
#335 |
|
Member
![]() Posts: 21
Karma: 10
Join Date: Oct 2014
Device: ASUS TF101
|
I have been using Calibre Sync on my Android devices for quite a while and has been working fine. However, just tried to Sync my library, which is on Dropbox and getting an error.....
"Metadata: true: Failed to load library info, reason: Database Exception (no such column: isbn (code 1): while compiling: SELECT id, title, timestamp, pubdate, series_index, author_sort, isbn, iccn, path, has_cover, last_modified, uuid FROM books)....." Any ideas of what has changed recently and/or how I can fix this? I have added a user-defined column called isbn to my Calibre library, but this has not made any difference |
|
|
|
|
|
#336 | |
|
Member
![]() Posts: 21
Karma: 10
Join Date: Oct 2014
Device: ASUS TF101
|
You beauty! This has saved me so much heartache! Thank you so much
![]() Quote:
|
|
|
|
|
|
|
#337 | |
|
Enthusiast
![]() Posts: 37
Karma: 10
Join Date: Feb 2011
Device: Android Tablet
|
Quote:
|
|
|
|
|
|
|
#338 | |
|
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: May 2011
Device: Nexus 7 (v1)
|
Quote:
[some path]\Calibre \[some name] library \[some name]library \[some name] library etc. And most of us have a single (or maybe two) libraries, name created when we installed Calibre. I happened to name mine "Calibre Library" but it's in a root directory - so I need to make the line $CalibreRoot ="D:" ------------------------------------------------------ The important bits (for me) were 1) columns got deleted (because Calibre wasn't using them?) 2) Calibre Sync does use those columns 3) here are the SQL statements to re-create them At one point in my career (mid 80s) I was 'toolsmith' for a software development group and got to be really good at .BAT files. 40 years later I'm pretty rusty, but to the extent that they syntax is the same (exceptions are new) this looks really good. For my own peace of mind I ran a test: 1) created c:\test 2) copied sqlite3.exe and Calibre-Fix-AllLibraries.ps1 to c:\test 3) created c:\test library 4) copied metadata.db to c:\test library 5) opened powershell 6) CD'd to c:\test 7) entered the line .\Calibre-Fix-AllLibraries.ps1 (note the ".\") ...and got "UPDATED: test library" I copied the modified metadata.db to my calibre library folder, started Calibre and the app appears to run fine. I copied metadata.db to the calibre library folders I have on my android tablet and phone and refresh is now working. For anyone else looking to replicate what I did here are the lines I changed Code:
# Path to sqlite3 command-line executable # This must be the sqlite3.exe tool, not the DLL $Sqlite3 = "C:\test\sqlite3.exe" # Root folder that contains all Calibre libraries # Each actual library is a subfolder ending in " Library" $CalibreRoot = "C:\test" Last edited by bobkoure; 03-17-2026 at 05:06 PM. |
|
|
|
|
|
|
#339 | |
|
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: May 2011
Device: Nexus 7 (v1)
|
Quote:
Simplest thing is to just modify the ps1 file to point at the root of your calibre library folder(s) and run it. But if you've already added 'isbn' maybe just add the other two? |
|
|
|
|
|
|
#340 |
|
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 77
Karma: 2345678
Join Date: Nov 2018
Device: 1. Kindle PW 6, 2. Kobo Forma
|
Thanks for this script! Now I can use my library again via OneDrive and without a connection to a running Calibre Content Server on my Laptop. Great work!
|
|
|
|
|
|
#341 | |
|
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Feb 2026
Device: Kindle Colorsoft & Kindle Scribe
|
For those of us on Linux, here's a bash script that I made based on your PS script that does the same thing:
Code:
#!/bin/bash
# -------------------------------------------------------------------
# calibre-fix-libraries.sh
#
# Purpose:
# - Back up metadata.db into DBbackups/<LibraryName>/
# - Add missing legacy columns (flags, isbn, lccn) to the books table
# - Safe to re-run
# - Keeps only the most recent N backups per library
#
# IMPORTANT:
# - Close Calibre before running this script
# -------------------------------------------------------------------
# Path to sqlite3 command-line executable
SQLITE3=$(command -v sqlite3)
# Calibre libraries to process
LIBRARIES=(
"/path/to/Calibre_Library"
)
# Central folder where database backups are stored
BACKUPS_ROOT="/path/to/DBbackups"
# Number of backups to keep per library
KEEP_BACKUPS=10
# -------------------------------------------------------------------
# Sanity checks
# -------------------------------------------------------------------
if [ -z "$SQLITE3" ] || [ ! -x "$SQLITE3" ]; then
echo "Error: sqlite3 not found or not executable. Please install sqlite3."
exit 1
fi
mkdir -p "$BACKUPS_ROOT"
# -------------------------------------------------------------------
# Process each library
# -------------------------------------------------------------------
for lib in "${LIBRARIES[@]}"; do
if [ ! -d "$lib" ]; then
echo "FAILED: Library directory not found: $lib"
continue
fi
# Friendly name of the library folder
libName=$(basename "$lib")
# Full path to this library's metadata.db
dbPath="$lib/metadata.db"
if [ ! -f "$dbPath" ]; then
echo "FAILED: metadata.db not found in $lib"
continue
fi
# Folder where backups for this library will live
backupDir="$BACKUPS_ROOT/$libName"
mkdir -p "$backupDir"
# Generate a timestamp for the backup filename
timestamp=$(date +"%Y%m%d_%H%M%S")
backupPath="$backupDir/metadata.db.backup_$timestamp"
# Step 1: Back up metadata.db
if ! cp "$dbPath" "$backupPath"; then
echo "FAILED: $libName - Could not back up metadata.db"
continue
fi
# Step 2: Read existing columns from the books table
# Query SQLite for column names in the books table
cols=$("$SQLITE3" "$dbPath" "SELECT name FROM pragma_table_info('books');" 2>/dev/null)
if [ $? -ne 0 ]; then
echo "FAILED: $libName - Could not read from database"
continue
fi
changed=false
# Step 3: Add missing columns
# Check for 'flags'
if ! echo "$cols" | grep -qx "flags"; then
"$SQLITE3" "$dbPath" "ALTER TABLE books ADD COLUMN flags INTEGER DEFAULT 1;"
changed=true
fi
# Check for 'isbn'
if ! echo "$cols" | grep -qx "isbn"; then
"$SQLITE3" "$dbPath" "ALTER TABLE books ADD COLUMN isbn TEXT;"
changed=true
fi
# Check for 'lccn'
if ! echo "$cols" | grep -qx "lccn"; then
"$SQLITE3" "$dbPath" "ALTER TABLE books ADD COLUMN lccn TEXT;"
changed=true
fi
# Step 4: Backup retention
# Get all backup files for this library, newest first
# using ls -t (sort by modification time, newest first)
backups=($(ls -t "$backupDir"/metadata.db.backup_* 2>/dev/null))
# If there are more backups than allowed, delete the oldest ones
if [ "${#backups[@]}" -gt "$KEEP_BACKUPS" ]; then
for (( i=$KEEP_BACKUPS; i<${#backups[@]}; i++ )); do
rm -f "${backups[$i]}"
done
fi
# Step 5: Status output
if [ "$changed" = true ]; then
echo "UPDATED: $libName"
else
echo "NO CHANGE: $libName"
fi
done
Code:
sqlite3 /path/to/Calibre_Library/metadata.db "PRAGMA table_info(books);" | grep -E "flags|isbn|lccn" Code:
sqlite3 /path/to/Calibre_Library/metadata.db "Select name FROM pragma_table_info('books');"
Quote:
|
|
|
|
|
|
|
#342 |
|
Plugin Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,336
Karma: 5007213
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
|
Make a Copy First!
It has been stated before, but bears repeating:
You should not be changing the database in your actual Calibre library. You should be making a copy first and modifying that. Just as the DB schema change broke Calibre Sync, changing your library DB might prevent Calibre itself from using your library in a future version. My personal script uses rsync to quickly update the copy of my library, then changes the DB file before sync'ing it to my device. I also want to reiterate: the issue isn't the change to Calibre, it's the fact Calibre Sync is not being maintained now. |
|
|
|
![]() |
| Tags |
| calibre, mobile, sync |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| BookFusion eBook Reader & Management Sync Across All Devices Android, iOS & Web | skillachie | Reading and Management | 244 | 01-25-2026 09:06 AM |
| Android/iOS reading position sync possible? | Freakeao | Android Devices | 3 | 11-08-2012 01:17 AM |
| PRS-T1 ePub Sync with other Android / iOS | Razva | Sony Reader | 10 | 06-29-2012 05:37 PM |
| Sync across IOS and Android? | spursbob | General Discussions | 0 | 06-24-2011 12:03 PM |
| Calibre and iOS 4 Sync | HarryO53 | Calibre | 25 | 07-02-2010 03:20 PM |