-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpuppies.py
34 lines (28 loc) · 959 Bytes
/
puppies.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
import os
import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class Shelter(Base):
__tablename__='shelter'
id=Column(Integer,primary_key=True)
name=Column(String(80),nullable=False)
address=Column(String(250))
city=Column(String(80))
state=Column(String(20))
zipcode=Column(String(10)
website=Column(String(250))
class Puppy(Base):
__tablename__='puppy'
name=Column(String(250),nullable=False)
id=Column(Integer,primary_key=True)
dateofbirth=Column(Date)
gender=Column(String(6),nullable=False)
weight=Column(Numeric(10))
shelter_id=Column(Integer,ForeignKey(shelter.id)
shelter=relationship(Shelter)
picture=Column(String)
engine = create_engine('sqlite:///puppyshelter.db')
Base.metadata.create_all(engine)