There are various SQLite wrappers available using which you can interact with SQLite3 database. But the most popular one is PySQLite
. There is no need to install PySQLite
because it comes as a standard module from Python 2.5 onwards. In your coding, you have to import sqlite3
module to work with SQLite3.
sqlite3
module.
import sqlite3
connect()
function is used to connect to a database.
conn = sqlite3.connect('databasename.db')
cursor()
function.
cur = conn.cursor()
execute()
function.commit()
function so that changes are saved back to the file.
conn.commit()
close()
function to close the connection.
conn.close()
Following are the topics that are covered in Python SQLite tutorial-