Skip to content

Python3 连接sqlite数据库 增删改查简单封装

Notifications You must be signed in to change notification settings

lucoo01/py3_sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

py3_sqlite

Python3 连接sqlite数据库 增删改查简单封装

使用说明

-- 生成实例
db = SqliteDB()

-- 创建表格
sql = "CREATE TABLE asin (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, asin VARCHAR, status VARCHAR, title VARCHAR, cover VARCHAR, stars double, lreviewdate VARCHAR, description VARCHAR, url VARCHAR, atime timestamp NULL DEFAULT NULL, mtime timestamp NULL DEFAULT NULL, price double, flag INTEGER DEFAULT 0, reviewcount INTEGER DEFAULT 0)"
res = db.createtb(sql=sql,table='asin')
print(res)

-- 插入
cs = db.insert(table="asin", asin=asin, title="标题", stars=4.3)
print(cs)

-- 删除
cs = db.delete(table="asin", where="id=6")
print(cs)

-- 更新
cs = db.update(table="asin", title="8888", stars=4.9, where="id=2")
print(cs)

-- 查询
cs = db.getAll(table="asin", where="1")
print(cs)

About

Python3 连接sqlite数据库 增删改查简单封装

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages