Skip to content

Instantly share code, notes, and snippets.

@richbpark
Created February 9, 2019 21:36
Show Gist options
  • Save richbpark/5aa27d83393e23a1f0d850de807ccb85 to your computer and use it in GitHub Desktop.
Save richbpark/5aa27d83393e23a1f0d850de807ccb85 to your computer and use it in GitHub Desktop.
Interactive commands displaying all records using Python CLI
(lab_app) root@RPiFSv2:/var/www/lab_app# python3
>>> import sqlite3
>>> conn=sqlite3.connect('/var/www/lab_app/lab_app.db')
>>> curs=conn.cursor()
>>> curs.execute("SELECT * FROM temperatures")
<sqlite3.Cursor object at 0x75db9d60> #NOTE: This is informational feedback. Don't Type
>>> temperatures = curs.fetchall()
>>> print (temperatures)
>>> conn.close()
>>> exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment