Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
deepak kumar pradhanCourses Plus Student 3,133 Points
i am not able to see the table after connecting to sqlite3 db. i ran these cmd sqlite3 students.db .tables
from peewee import * db = SqliteDatabase('students.db') class Student(Model): username = CharField(max_length=255 , unique=True) points=IntegerField(default=0) class Meta: database = db if __name__ == '__main__': db.connect() db.create_tables([Student],safe=True)
Josh Keenan19,528 Points
Here's the problem, you don't close the database after, use:
If I'm wrong post to this thread again!
Chris FreemanTreehouse Moderator 68,030 Points
I ran your code locally (saved as dbtest.py) and inspected with
$ python dbtest.py $ sqlite3 students.db SQLite version 3.8.2 2013-12-06 14:53:30 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables student sqlite> .dump student PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE "student" ("id" INTEGER NOT NULL PRIMARY KEY, "username" VARCHAR(255) NOT NULL, "points" INTEGER NOT NULL); CREATE UNIQUE INDEX "student_username" ON "student" ("username"); COMMIT; sqlite> .q $
What errors were you seeing?