import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey, UniqueConstraint, Index,DATE
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy import create_engine,text
import datetime, pymysql,hashlib,getpass,re
from core import setting

hash = hashlib.md5()
hash.update('123456'.encode())
default_pw=hash.hexdigest()

mysql_user = setting.mysql_user
mysql_pw = setting.mysql_pw
mysql_host = setting.mysql_host
mysql_port = setting.mysql_port

# conn = pymysql.connect(host='192.168.153.132',port=3306,user='root',passwd='mysql',db='class')
conn = pymysql.connect(host=mysql_host,port=mysql_port,user=mysql_user,passwd=mysql_pw,db='class')
cursor = conn.cursor()

# engine = create_engine("mysql+pymysql://root:mysql@192.168.153.132:3306/class",encoding='utf-8', echo=False)
engine = create_engine("mysql+pymysql://%s:%s@%s:%s/class" %(mysql_user,mysql_pw,mysql_host,mysql_port),encoding='utf-8', echo=False)

Base = declarative_base()