SQLite笔记

基础知识

# -*- coding: utf-8 -*-
import sqlite3
from dbutils.persistent_db import PersistentDB # pip install DBUtils
    
db_path = r'to_db_path.db'
dbpool = PersistentDB(sqlite3, maxusage=2, database=db_path)
db = dbpool.connection()
cur = db.cursor()
#--------- deal sql ---------
pass
#--------- deal sql ---------
cur.close()
db.close()

Python中编写SQL使用SQLite

  • SQL语法,参考: https://sqlite.org/lang.html
  • 每次只能调用一条SQL语句,否则提示:Warning: You can only execute one statement at a time.

正文完
 
评论(没有评论)