DEV Community

Cover image for Connect the DataBase | SQLite-Python Series

Connect the DataBase | SQLite-Python Series

Deepak Raj
Skilled in Data Science, Machine Learning, Deep Learning, As Well As Web Development Knowledge. React ❤️ to encourage Author.
Updated on ・2 min read

The DataBase💾 is one of the essential parts of the program, software, website, games. We'll discuss the SQLite Database in the SQLite-Python series. SQLite is one of the lightweight RDBMS. In this series, we'll use python to create/insert/delete data from SQLite.

Improvements are always welcome. Feel free to improve the article. So be Ready 🏁 to dive-in the Series.

SQLite has the following noticeable features:

  • self-contained: SQLite is self-contained means it requires minimal support from the operating system or external library. This makes SQLite usable in any environment especially in embedded devices like iPhones, Android phones, game consoles, handheld media players, etc.

  • serverless: SQLite doesn't need the server architecture.

  • zero-configuration: Because of the serverless architecture, you don’t need to “install” SQLite before using it. There is no server process that needs to be configured, started, and stopped.

  • transactional: All transactions in SQLite are fully ACID-compliant. It means all queries and changes are Atomic, Consistent, Isolated, and Durable.

You can download the SQLite from here

SQLite Module is already available in the python standard library since py2.5.

Create an SQLite Database with Python.

import sqlite3

def create_connection(db_file):
    """ create a database connection to a SQLite Database"""
        with sqlite3.connect(db_file):
            print("Sqlite version :", sqlite3.version)
    except Exception as e:

if __name__ == "__main__":

:memory: to the connect() function of the sqlite3 module,
it will create a new database that resides in the memory (RAM)
instead of a database file on disk.
Enter fullscreen mode Exit fullscreen mode

Thanks for reading the articles.
Join the open-source community on discord for Python & Machine learning.
Py-Contributors Discord Server

Discussion (0)