Home arrow Python arrow Using SQLite in Python

Using SQLite in Python

SQLite is a small C library that implements a self-contained SQL database engine. This article examines pysqlite, one of a number of libraries in Python, that is used as an interface with SQLite.

  1. Using SQLite in Python
  2. Connecting to a Database
  3. Writing Data
  4. Retrieving Data
  5. Adapting and Converting
By: Peyton McCullough
Rating: starstarstarstarstar / 132
April 12, 2006

print this article



SQLite is a small database engine that's gained quite a bit of popularity, and this popularity does appear to be deserved. SQLite stands alone and doesn't require any special dependencies. All the database interaction is done through whatever program needs to access the information, and the database itself is stored in a single file. Because of this, there is no confusing configuration involved, and SQLite is small and, in many applications, quite fast. It's also been released in the public domain.

Its presence in several languages is no secret, but what many people don't know is that there are also a few Python SQLite libraries. One of these libraries is pysqlite, which allows for painless database interaction. In this article, we'll explore SQLite and pysqlite and their capabilities. While prior database experience in Python is not required, you should be familiar with SQL in general.

Obtaining the Library

The pysqlite library may be obtained at its website:


Windows users can simply download and run the pysqlite binary to install the product. Users of Linux and other similar operating systems will need to download the source distribution, and they will need SQLite and the SQLite development files installed. Many distributions already come with the library, so check for it. If not, you may obtain SQLite from its website:


The library is installed just like most other Python libraries. First, you must build the library:

python setup.py build

Next, simply install what you've just built. Make sure you have the proper privileges to do this:

python setup.py install

If everything went as it should, then pysqlite is now installed and ready for use.

>>> More Python Articles          >>> More By Peyton McCullough

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates


Dev Shed Tutorial Topics: