当前位置:网站首页>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()
边栏推荐
- Careercup its 1.8 serial shift includes problems
- Binary search
- @Validated basic parameter verification, grouping parameter verification and nested parameter verification
- 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
- Learning robots have no way to start? Let me show you the current hot research directions of robots
- PVC 塑料片BS 476-6 火焰传播性能测定
- EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
- wpf 获取datagrid 中指定行列的DataGridTemplateColumn中的控件
- vant 源码解析 之深层 合并对象 深拷贝
- Display DIN 4102-1 Class B1 fire test requirements
猜你喜欢

Learning robots have no way to start? Let me show you the current hot research directions of robots

XML modeling

Add ICO icon to clion MinGW compiled EXE file

ArcGIS\QGIS无插件加载(无偏移)MapBox高清影像图

基于vertx-web-sstore-redis的改造实现vertx http应用的分布式session

教你自己训练的pytorch模型转caffe(二)

EN 438-7 laminated sheet products for building covering decoration - CE certification

Phpstudy Xiaopi's MySQL Click to start and quickly flash back. It has been solved

教你自己训练的pytorch模型转caffe(一)

The development of research tourism practical education helps the development of cultural tourism industry
随机推荐
MySQL 千万数据量深分页优化, 拒绝线上故障!
Introduction to TS, constructor and its this, inheritance, abstract class and interface
SYSTEMd resolved enable debug log
木板ISO 5660-1 热量释放速率摸底测试
What are the requirements of UL 2043 test for drive housing in the United States?
【案例】定位的运用-淘宝轮播图
最长摆动序列[贪心练习]
基於flask寫一個接口
水泥胶黏剂BS 476-4 不燃性测试
Traps in the explode function in PHP
Display DIN 4102-1 Class B1 fire test requirements
selenium 查找b或p标签的内容
LeetCode_ Hash table_ Difficulties_ 149. Maximum number of points on the line
systemd-resolved 开启 debug 日志
Establishment of terminal security capability verification environment and penetration test records
SQL series (basic) - Chapter 2 limiting and sorting data
XML modeling
Learning robots have no way to start? Let me show you the current hot research directions of robots
ODPs next map / reduce preparation
中国的软件公司为什么做不出产品?00后抛弃互联网;B站开源的高性能API网关组件|码农周刊VIP会员专属邮件周报 Vol.097