-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdata_model.py
35 lines (29 loc) · 1012 Bytes
/
data_model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# ---------------------------------------------------------------------------- #
# Course: PYTHON 220: Advanced Programming in Python
# Script Title: Lesson 3 Assignment Peewee Data Model
# Change Log: (Who, When, What)
# D. Rodriguez, 2019-04-21, Initial release
# ---------------------------------------------------------------------------- #
"""
Customers data model.
"""
from peewee import *
#
database = SqliteDatabase('customers.db')
database.connect()
database.execute_sql('PRAGMA foreign_keys = ON;')
class BaseModel(Model):
class Meta:
database = database
class Customers(BaseModel):
"""
This class defines customers data
"""
customer_id = CharField(primary_key=True, max_length=30)
name = CharField(max_length=40)
last_name = CharField(max_length=40)
home_address = CharField(max_length=40)
phone_number = CharField(max_length=10)
email_address = CharField(max_length=40)
status = CharField(max_length=40)
credit_limit = CharField()