Difference between revisions of "Database Reader - Code"
From RoboWiki
(Created page with "Return back to project page: Door camera - Jakub Vojtek Python code for the Database Reader: <syntaxhighlight lang=python> impo...") |
(No difference)
|
Revision as of 18:48, 9 June 2024
Return back to project page: Door camera - Jakub Vojtek
Python code for the Database Reader:
import sqlite3
# Connect to the SQLite database
conn = sqlite3.connect('database/face_images.db')
c = conn.cursor()
def print_data():
c.execute('SELECT * FROM images')
rows = c.fetchall()
for row in rows:
print(row)
def delete_data_with_no_faces():
c.execute('DELETE FROM images WHERE detected_faces = 0')
conn.close()