Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Raspberry Pi) expand_more
Raspberry Pi / Automation

local SQLite logging

Learn local SQLite logging in Raspberry Pi with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.

12 min read • Intermediate
raspberry-pi-032.py
python
import sqlite3,datetime
db=sqlite3.connect('/home/pi/sensors.db')
db.execute('create table if not exists readings(ts text, celsius real)')
db.execute('insert into readings values(?,?)',(datetime.datetime.now().isoformat(),24.6)); db.commit()
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content