当前位置:网站首页>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边栏推荐
- Interpretation of R & D effectiveness measurement framework
- Value/string in redis
- CPU 上下文切换的机制和类型 (CPU Context Switch)
- C#依赖注入(直白明了)讲解 一看就会系列
- Force button homepage introduction animation
- Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
- Comment Nike a - t - il dominé la première place toute l'année? Voici les derniers résultats financiers.
- 91.(cesium篇)cesium火箭发射模拟
- The operation process of using sugar to make a large data visualization screen
- Exposure: a white box photo post processing framework reading notes
猜你喜欢

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

Istio, ebpf and rsocket Broker: in depth study of service grid

How to understand the developed query statements

技术分享 | MySQL:从库复制半个事务会怎么样?

比特熊直播间一周年,英雄集结令!邀你来合影!

博途V15添加GSD文件

MQ prevent message loss and repeated consumption

Interpretation of R & D effectiveness measurement framework

Prepare for the Blue Bridge Cup Day10__ PWM control light brightness

迅为i.MX8Mmini开发板离线构建Yocto系统
随机推荐
Golang des-cbc
【datawhale202206】pyTorch推荐系统:召回模型 DSSM&YoutubeDNN
ABBIRB120工业机器人机械零点位置
Virtualenv+pipenv virtual environment management
Force button homepage introduction animation
消息队列之监控退款任务批处理过程
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 6
巩固-C#运算符
如何看懂开发的查询语句
Personnaliser le plug - in GRPC
Rural guys earn from more than 2000 a month to hundreds of thousands a year. Most brick movers can walk my way ǃ
Technology sharing | MySQL: how about copying half a transaction from the database?
基于IMDB评论数据集的情感分析
Neo4j 中文开发者月刊 - 202206期
Share the method of how to preview PSD format and PSD file thumbnail plug-in [easy to understand]
MQ prevent message loss and repeated consumption
Typora realizes automatic uploading of picture pasting
Redis configuration environment variables
Talk about the pessimistic strategy that triggers full GC?
Adjacency matrix undirected graph (I) - basic concepts and C language