Skip to content

Instantly share code, notes, and snippets.

@driscollis
Created July 17, 2014 18:17
Show Gist options
  • Save driscollis/7342902408b0352cb717 to your computer and use it in GitHub Desktop.
Save driscollis/7342902408b0352cb717 to your computer and use it in GitHub Desktop.
peewee model demo
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