|
|
- from sqlalchemy import create_engine
- from sqlalchemy import Column, Integer, TEXT,VARCHAR
- from sqlalchemy.ext.declarative import declarative_base
-
- engine = create_engine('mysql+pymysql://root:yyj0010YYJ@10.23.174.207/cloud',encoding="utf-8",echo=True)
- base = declarative_base()
-
-
- class User(base):
- __tablename__ = 'users'
- user_id = Column('user_id', VARCHAR(20), primary_key=True)
- password = Column('password', TEXT, nullable=False)
-
-
- class predict(base):
- __tablename__= 'predictcouplet'
- up = Column('up',VARCHAR(20),primary_key=True)
- down= Column('down',VARCHAR(20),primary_key=True)
-
- class train(base):
- __tablename__= 'trainingcouplet'
- up = Column('up',VARCHAR(20),primary_key=True)
- down= Column('down',VARCHAR(20),primary_key=True)
-
-
- class evaluate(base):
- __tablename__= 'evaluatecouplet'
- up = Column('up',VARCHAR(20),primary_key=True)
- down= Column('down',VARCHAR(20),primary_key=True)
- popular=Column('popular',Integer)
-
-
- base.metadata.create_all(engine) # 创建表结构
-
-
|