import sqlite3
db = sqlite3.connect('mydb.db')
cur = db.cursor()
# create users table
cur.execute('CREATE TABLE IF NOT EXISTS users (name str, image blob)')
# insert new user in users table
cur.execute(
'INSERT INTO users (name, image) VALUES (?, ?)',
('USER-123', open('smile.png', 'rb').read())
)
db.commit()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter