当前位置:网站首页>Pandas reads MySQL data
Pandas reads MySQL data
2022-07-01 12:07:00 【Paper scum】
def get_data():
conn = pymysql.connect(host=RSYS_HOST,
port=RSYS_PORT,
user=RSYS_USER,
passwd=RSYS_PASSWORDD,
db=RSYS_DB_NAME,
charset='utf8')
results = None
try:
read_result = pd.read_sql(sql, conn)
result_json = json.loads(read_result.reset_index().to_json(orient='records', force_ascii=False))
logger.info(sql)
return result_json
except Exception as e:
# Rollback on error
logger.error("Error: unable to fecth data: %s,%s" % (repr(e), sql))
conn.rollback()
finally:
conn.close()
return results边栏推荐
- Uniapp uses uni upgrade Center
- Golang introduces the implementation method of the corresponding configuration file according to the parameters
- Neo4j Chinese developer monthly - issue 202206
- Typora realizes automatic uploading of picture pasting
- [classic example] classic list questions @ list
- 陈珙:微服务,它还那么纯粹吗?
- 消息队列之监控退款任务批处理过程
- JS date format conversion method
- redis中value/hush
- Building external modules
猜你喜欢

【datawhale202206】pyTorch推荐系统:精排模型 DeepFM&DIN

Talk about biological live broadcast - genovis Zhang Hongyan antibody specific enzyme digestion technology helps to characterize the structure of antibody drugs

Prepare for the Blue Bridge Cup Day10__ PWM control light brightness

Deep understanding of grpc part1

【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE

Botu V15 add GSD file

Interpretation of R & D effectiveness measurement framework
![[MCU] [nixie tube] nixie tube display](/img/5e/9e14302b4e4f5e03601392ac90479d.png)
[MCU] [nixie tube] nixie tube display

91. (chapitre Cesium) simulation de lancement de fusées cesium

Acly and metabolic diseases
随机推荐
Emotion analysis based on IMDB comment data set
Neo4j Chinese developer monthly - issue 202206
Technology sharing | MySQL: how about copying half a transaction from the database?
Computer graduation project asp Net attendance management system vs developing SQLSERVER database web structure c programming computer web page source code project
91.(cesium篇)cesium火箭发射模拟
Onenet Internet of things platform - create mqtts products and devices
Redis common sense
redis中value/hush
Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
C#依赖注入(直白明了)讲解 一看就会系列
Consolidate -c operator
Golang des-cbc
uniapp 使用 uni-upgrade-center
LeetCode 454. Add four numbers II
Is it safe for Huatai Securities to open an account online?
迅为i.MX8Mmini开发板离线构建Yocto系统
【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE
GID:旷视提出全方位的检测模型知识蒸馏 | CVPR 2021
Understanding of MVVM and MVC
Value/list in redis