1234567891011121314151617181920212223 |
- from sqlalchemy import create_engine
- from sqlalchemy.orm import sessionmaker
- from urllib import parse
- import pymysql
- import pandas as pd
- # 数据库配置
- host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
- port=3306
- database='algo_dict'
- user='qx_algo_readonly'
- password='qx@123456'
- db_engine = create_engine(
- "mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(
- user, password, host, port, database
- ))
- DbSession = sessionmaker(bind=db_engine)
- errorcode_map = pd.read_sql("select * from faultcode_map", db_engine)
- p=1 # 协议 1:科易,2: 优旦/格林美, 3:自研'
- code = 1 # 终端故障码
- platform_code = errorcode_map[(errorcode_map['protocol']==p)&(errorcode_map['end_errorcode']==str(p))]['platform_errorcode']
- db_engine.dispose()
|