当前位置:网站首页>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
边栏推荐
- Value/sortedset in redis
- S7-1500PLC仿真
- Virtualenv+pipenv virtual environment management
- LeetCode 454. 四数相加 II
- Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
- 241. Design priority for operational expressions: DFS application questions
- 博途V15添加GSD文件
- 二叉堆(一) - 原理与C实现
- Is it safe for Huatai Securities to open an account online?
- Golang introduces the implementation method of the corresponding configuration file according to the parameters
猜你喜欢
On recursion and Fibonacci sequence
CAD如何设置标注小数位
91. (cesium chapter) cesium rocket launch simulation
Virtualenv+pipenv virtual environment management
91.(cesium篇)cesium火箭發射模擬
uniapp 使用 uni-upgrade-center
Summary of JFrame knowledge points 1
Abbirb120 industrial robot mechanical zero position
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4
基于IMDB评论数据集的情感分析
随机推荐
消息队列之监控退款任务批处理过程
Is it safe for Huatai Securities to open an account online?
On recursion and Fibonacci sequence
【20211129】Jupyter Notebook远程服务器配置
Botu V15 add GSD file
Unity xlua co process packaging
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 6
uniapp 使用 uni-upgrade-center
用实际例子详细探究OpenCV的轮廓检测函数findContours(),彻底搞清每个参数、每种模式的真正作用与含义
Software project management 9.2 Software project configuration management process
GID:旷视提出全方位的检测模型知识蒸馏 | CVPR 2021
C # dependency injection (straight to the point) will be explained as soon as you see the series
Joint Time-Frequency and Time Domain Learning for Speech Enhancement
Learning summary on June 29, 2022
Redis configuration environment variables
241. 为运算表达式设计优先级 : DFS 运用题
[classic example] classic list questions @ list
Force button homepage introduction animation
Emotion analysis based on IMDB comment data set
Talk about the pessimistic strategy that triggers full GC?