当前位置:网站首页>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边栏推荐
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 2
- Leetcode force buckle (Sword finger offer 31-35) 31 Stack push pop-up sequence 32i II. 3. Print binary tree from top to bottom 33 Post order traversal sequence 34 of binary search tree The path with a
- 强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
- 指定的服务已标记为删除
- 二叉堆(一) - 原理与C实现
- I'm in Zhongshan. Where is a better place to open an account? Is it actually safe to open an account online?
- Why does the JVM heap memory exceed 32g and pointer compression fail?
- Prepare for the Blue Bridge Cup Day10__ PWM control light brightness
- Interpretation of R & D effectiveness measurement framework
- Consolidate -c operator
猜你喜欢

On recursion and Fibonacci sequence

Technology sharing | MySQL: how about copying half a transaction from the database?

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

Use set_ Handler filters out specific SystemC wrapping & error messages

Theoretical basis of graph

Leetcode force buckle (Sword finger offer 31-35) 31 Stack push pop-up sequence 32i II. 3. Print binary tree from top to bottom 33 Post order traversal sequence 34 of binary search tree The path with a

LeetCode力扣(剑指offer 31-35)31. 栈的压入弹出序列32I.II.III.从上到下打印二叉树33. 二叉搜索树的后序遍历序列34. 二叉树中和为某一值的路径35. 复杂链表的复制

Learning summary on June 28, 2022

GID: open vision proposes a comprehensive detection model knowledge distillation | CVPR 2021

ACLY与代谢性疾病
随机推荐
Emotion analysis based on IMDB comment data set
Value/hush in redis
Build yocto system offline for i.mx8mmini development board
CPU 上下文切换的机制和类型 (CPU Context Switch)
自定義 grpc 插件
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8
About keil compiler, "file has been changed outside the editor, reload?" Solutions for
Learning summary on June 28, 2022
On recursion and Fibonacci sequence
Compile and debug net6 source code
leetcode 406. Queue Reconstruction by Height(按身高重建队列)
91. (cesium chapter) cesium rocket launch simulation
Machine learning - Data Science Library - day two
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 6
Chen Gong: Micro service, is it still so pure?
CPI tutorial - asynchronous interface creation and use
二叉堆(一) - 原理与C实现
241. Design priority for operational expressions: DFS application questions
指纹浏览器工作原理、使用场景以及重要性简单讲解
构建外部模块(Building External Modules)