Python Using Databases in Python Our Diary App Doing Data Entry

Jordan Featherstone
Jordan Featherstone
5,973 Points

0 Results on .tables

I'm not sure why, but the tables don't seem to be saving in the database, i have scanned through my code and couldn't notice any errors. So i'm guessing its something very small that i cant put my finger on.

from peewee import *
 import datetime

db = SqliteDatabase('dairy.db')

class Entry(Model):
    content = TextField()
    timestamp = DateTimeField(

    class Meta:
        database = db

def init():
     db.create_tables([Entry], safe=True)

def menu_loop():
     """ loop """

def add_entry():

def view_entries():
    """View pervious entries."""

def delete_entry(entry):
    """Delete an entry."""

if __name__ == '__main__':
Robin Burkett
Robin Burkett
3,642 Points

I noticed 2 typos, but they probably aren't the problem.

  1. import is indented one space
  2. diary.db is misspelled as dairy.db

What solved my problem when this happened to me was using the command "sqlite3 diary.db" to start sqlite3 instead of just "sqlite3".