Spaces:
Paused
Paused
Download scripts/clean_db.py from AADHIISHVAR/librianAI_v1.9: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/spaces/AADHIISHVAR/librianAI_v1.9/resolve/main/scripts/clean_db.py
- Command line
-
hf download hf://spaces/AADHIISHVAR/librianAI_v1.9/scripts/clean_db.py
-
curl -L -o clean_db.py https://huggingface.co/spaces/AADHIISHVAR/librianAI_v1.9/resolve/main/scripts/clean_db.py
715 Bytes
| import sqlite3 | |
| def clean_db(): | |
| conn = sqlite3.connect('library_database.db') | |
| cur = conn.cursor() | |
| print("Cleaning Accession_Num from both tables...") | |
| # Strip literal single quotes from Books | |
| cur.execute("UPDATE Books SET Accession_Num = REPLACE(Accession_Num, \"'\", '')") | |
| # Strip literal single quotes from vec_books (if any) | |
| # Note: vec_books doesn't support REPLACE directly on virtual tables, | |
| # so we'll just ensure the join works by cleaning Books. | |
| conn.commit() | |
| # Check first 3 | |
| cur.execute("SELECT Accession_Num FROM Books LIMIT 3") | |
| print("New Accession_Num samples:", cur.fetchall()) | |
| conn.close() | |
| if __name__ == "__main__": | |
| clean_db() | |