Page 24 - Phyton_GUIprogrammingwithTkinter
P. 24
P a ge | 15
3.2.4 SQLite Installation
SQLite3 can be integrated with Python using sqlite3 module. The module is no need
to install separately because it is imported by default along with Python version 2.5.x
onwards. To use sqlite3 module, firstly must create a connection object that
represents the database and then optionally create a cursor object, which will help in
executing all the SQL statements.
3.2.5 SQLite Syntax
a) Import sqlite3 module into python program.
b) Create sqlite3 database using connect () function and specifying a file name. If
the database does not exist, then it will be created and finally a database object
will be returned.
c) SQL command can be executed by calling execute () function.
d) The commit () function needs to be called if there is a modification (insert,
create, drop, delete and update) on the database for the command to take
effect.