Getting database model code using peewee’s pwiz

One of the great things I love about peewee is it’s ability to generate a Python database model from an existing database:

C:\Users\joel\git>python -m pwiz -e mysql -u root -P vagrant -H 127.0.0.1 -p 13306 test_1 -t coa

from peewee import *

database = MySQLDatabase('test_1', **{'host': '127.0.0.1', 'password': 'va
grant', 'port': 13306, 'user': 'root'})

class UnknownField(object):
pass

class BaseModel(Model):
class Meta:
database = database

class Coa(BaseModel):
account = CharField(db_column='Account', null=True)
accountno = CharField(db_column='AccountNo', null=True)
activestatus = CharField(db_column='ActiveStatus', null=True)
banknonote = CharField(db_column='BankNoNote', null=True)
job = IntegerField(db_column='job_id', null=True)
code = CharField(db_column='Code', null=True)
description = CharField(db_column='Description', null=True)
taxline = CharField(db_column='TaxLine', null=True)
type = CharField(db_column='Type', null=True)

class Meta:
db_table = 'coa'

Author: Joel Sutton

Me