save multi images in sql table
Loading
save multi images in sql table
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jayraj ChhayaPosted Sep 18, 2025, 10:53 AM
The best way is to store images in a separate table with one row per image. Either save them as BLOB/VARBINARY (binary data) or, preferably, store just the file path/URL and keep the images in file storage (server, AWS S3, Azure, etc.) for better performance.
Sangeetha SPosted Sep 16, 2025, 9:31 AM
INSERTstatements.import sqlite3
conn = sqlite3.connect('images.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS images (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
image BLOB
)
''')
conn.commit()