Python query SQlite database example

In this example we use the database we created in the create database example and we will simply display all rows in the database

#!/usr/bin/python
 
import sqlite3 as lite
import sys
 
 
con = lite.connect('test.db')
 
with con: 
 
cur = con.cursor() 
cur.execute("SELECT * FROM Jobs")
 
rows = cur.fetchall()
 
for row in rows:
print (row)

 

SHARE
Previous articleCreate a SQLite database with Python
Next articleEnabling i2c on the Raspberry Pi