SQLite是一个文件数据库,不像Mysql,Oracle等数据库有很多进程,被很多语言bullet-in成了自己的模块,python、php、ruby都支持,作为一个小app或者更大软件不需要连接网络上数据库是一个很好的选择,一些linux主机还会初始安装sqlite.


下面给出一个最简单的示例代码:

import sqlite3
conn = sqlite3.connect('test.db')
cur = conn.cursor()
cur.execute('select count(*) from tab_test ')
rs = cur.fetchone()
count = rs[0]
print "Records count:",count


参考文章

http://www.sqlite.org/    官网

http://www.sqlite.org/cli.html   shell command

http://blog.sina.com.cn/s/blog_3fc8570201000d6w.html