Created
July 17, 2014 18:17
-
-
Save driscollis/7342902408b0352cb717 to your computer and use it in GitHub Desktop.
peewee model demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import peewee | |
database = peewee.SqliteDatabase("wee.db") | |
######################################################################## | |
class Artist(peewee.Model): | |
""" | |
ORM model of the Artist table | |
""" | |
name = peewee.CharField() | |
class Meta: | |
database = database | |
######################################################################## | |
class Album(peewee.Model): | |
""" | |
ORM model of album table | |
""" | |
artist = peewee.ForeignKeyField(Artist) | |
title = peewee.CharField() | |
release_date = peewee.DateTimeField() | |
publisher = peewee.CharField() | |
media_type = peewee.CharField() | |
class Meta: | |
database = database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment