当前位置:网站首页>Postgres establish connection and delete records
Postgres establish connection and delete records
2022-07-05 21:07:00 【cuisidong1997】
establish Cursor object
cur = conn.cursor()
perform sql command : Create a new table test
cur.execute(“CREATE TABLE test (id serial PRIMARY KEY, num integer, data varchar);”)
Pass data to formal parameters in the statement , Give Way Psycopg Deal with the correct conversion ( You can avoid sql Inject )
cur.execute(“INSERT INTO test (num, data) VALUES (%s, %s)”,
… (100, “abc’def”))
Interpolated data , And get the results
cur.execute(“SELECT * FROM test;”)
cur.fetchone()
(1, 100, “abc’def”)
Submit data changes
conn.commit()
close Cursor Object and connection object
cur.close()
conn.close()
边栏推荐
- XML建模
- Mode - "Richter replacement principle"
- When a user logs in, there is often a real-time drop-down box. For example, entering an email will @qq com,@163. com,@sohu. com
- 【日常训练--腾讯精选50】89. 格雷编码(看题解才会的)
- Influence of oscilloscope probe on measurement bandwidth
- EN 438-7 laminated sheet products for building covering decoration - CE certification
- 浅聊我和一些编程语言的缘分
- 2022-07-03-CKA-粉丝反馈最新情况
- Learning notes of SAS programming and data mining business case 19
- 木板ISO 5660-1 热量释放速率摸底测试
猜你喜欢

2. < tag hash table, string> supplement: Sword finger offer 50 The first character DBC that appears only once

木板ISO 5660-1 热量释放速率摸底测试

显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??

Why can't Chinese software companies produce products? Abandon the Internet after 00; Open source high-performance API gateway component of station B | weekly email exclusive to VIP members of Menon w

Write an interface based on flask

Explain various hot issues of Technology (SLB, redis, mysql, Kafka, Clickhouse) in detail from the architecture
![[case] Application of element display and hiding -- element mask](/img/6e/6ea484a6e5d547e01dd8820af8e314.png)
[case] Application of element display and hiding -- element mask

秋招将临 如何准备算法面试、回答算法面试题

Golang(1)|从环境准备到快速上手

五层网络协议
随机推荐
当用户登录,经常会有实时的下拉框,例如,输入邮箱,将会@qq.com,@163.com,@sohu.com
selenium 获取dom内验证码图片
【日常训练】729. 我的日程安排表 I
postgres 建立连接并删除记录
Aitm2-0002 12s or 60s vertical combustion test
JS common method encapsulation
Traps in the explode function in PHP
研學旅遊實踐教育的開展助力文旅產業發展
vant 源码解析 event.ts 事件处理 全局函数 addEventListener详解
EN 438-7 laminated sheet products for building covering decoration - CE certification
R语言【数据管理】
Sophomore personal development summary
大二下个人发展小结
Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral
Mode - "Richter replacement principle"
sql系列(基础)-第二章 限制和排序数据
Talk about my fate with some programming languages
产品好不好,谁说了算?Sonar提出分析的性能指标,帮助您轻松判断产品性能及表现
ClickHouse 复制粘贴多行sql语句报错
wpf 获取datagrid 中指定行列的DataGridTemplateColumn中的控件