Tkinter to managing SQLite database Blob data using file browser to select upload photos and display



Tkinter to managing SQLite database Blob data using file browser to select upload photos and display

Tkinter to managing SQLite database Blob data using file browser to select upload photos and display

Blob: Binary Large Object
We can create our student table with one Blob column to store the image.
We will connect to our database by importing SQLAlchemy connect engine and using that we will create the connection object.
By using fileobject askopenfilename() we will browse the local file system and select one image to upload and insert to our student table.
file = filedialog.askopenfilename() # get file path
fob=open(file,’rb’) # Open in binary mode
blob_data=fob.read() # Binary data is ready
Using this we will create the binary data and along with our other data we will store the details inside the table.
We are using a try except error handling to insert data and return if any error message is generated. On successful completion of adding data , we will get the unique id of the row. This id is returned by lastrowid method.

SQlite Playlist
https://youtube.com/playlist?list=PLzz7R3Slbh5TI4RVHqapk3PUBmoW5JE_z

Download source code from here
https://www.plus2net.com/python/tkinter-sqlite-blob.php

#TkinterBlob #TkinterBinaryData #ShowBlobData #SQLiteBlobTkinter #plus2net #Python

Comments are closed.