-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTable.py
24 lines (19 loc) · 784 Bytes
/
Table.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
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
engine = create_engine("mysql://root:#sqlpassword@localhost:3306/collegeproject")
Session = sessionmaker(bind=engine)
session = Session()
class File(Base):
__tablename__ = 'file'
id= Column(Integer, primary_key=True)
filename = Column(String(255), nullable=False)
token = Column(String(16), unique=True, nullable=False)
class User(Base):
__tablename__ = 'user'
id=Column(Integer,primary_key=True)
username=Column(String(255),nullable=False)
password=Column(String(16),unique=True,nullable=False)
emailid=Column(String(255),nullable=False)
Base.metadata.create_all(engine)