import sqlite3
connection = sqlite3.connect('~/foo.db')
cursor = connection.execute('select * from bar')
# cursor.description is the description of columns
names = [description[0] for description in cursor.description]
import sqlite3
con = sqlite3.connect("users.db")
con.row_factory = sqlite3.Row # <-- This line does the trick.