sqlhub.processConnection = connection


class Song(SQLObject):
    name = StringCol()
artist = StringCol()
album = StringCol()

def MakeFakeDB():
    Song.createTable()
s1 = Song(name='B Song', artist='Artist1', album='Album1')
s2 = Song(name='A Song', artist='Artist2', album='Album2')

def Main():
    all_songs = Song.select().orderBy(Song.q.name)
Python MySQL module