Repository navigation
Expand file tree
/
Copy pathmodels.py
More file actions
53 lines (38 loc) · 1.81 KB
/
Copy pathmodels.py
File metadata and controls
53 lines (38 loc) · 1.81 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.types import PickleType
from sqlalchemy.orm import relationship
from database import Base
class Product(Base):
__tablename__ = "PRODUCT"
id_ = Column('ProdId', String(7), primary_key=True, unique=True)
name = Column('ProdName', String(50), nullable=False)
img_path = Column('ProdImgPath', String)
img_url = Column('ProdImgUrl', String)
price = Column('ProdPrice', Integer, nullable=False)
cate1 = Column('ProdCategory1', String(2), nullable=False)
cate2 = Column('ProdCategory2', String(2))
description = Column('ProdDescription', String(200), nullable=False)
hashtag = Column('Hashtag', String(200)) # 띄어쓰기로 구분
class Review(Base):
__tablename__ = "REVIEW"
id_ = Column('RevId', Integer, primary_key=True, autoincrement=True)
prod_id = Column('ProdId', String(6), ForeignKey('PRODUCT.ProdId'), nullable=False)
writer = Column('Writer', String(4), nullable=False)
img_path = Column('RevImgPath', String)
img_url = Column('RevImgUrl', String)
content = Column('Content', String(300), nullable=False)
points = Column('Points', Integer, default=0)
status = Column('Status', Integer, default=0)
products = relationship('Product', backref='reviews')
class Cate_1(Base):
__tablename__ = "CATE1"
id_ = Column('CateId', String(2), primary_key=True, unique=True)
name = Column('CateName', String(10), nullable=False)
class Cate_2(Base):
__tablename__ = "CATE2"
id_ = Column('CateId', String(2), primary_key=True, unique=True)
name = Column('CateName', String(10), nullable=False)
class Vectors(Base):
__tablename__ = "VECTORS"
id_ = Column('RevId', String(6), primary_key=True, unique=True)
vector = Column('Vector', PickleType(), nullable=False)