~/Why Use SQLite For Projects

Oct 13, 2021


SQLite is a lightweight, serverless database available in the public domain. It is bundled with most programming languages and offers benefits for many users.

Key Benefits

  1. Zero Setup: No server install needed. Just include the library and use a database file.
  2. Fast: Benchmarks show SQLite is often faster than file I/O for most read-heavy apps.
  3. Reliable: Used by major companies in browsers, mobile apps, and embedded devices.
  4. Portable: One cross-platform file stores your entire database. Move it anywhere with the application.
  5. ACID Compliant: Supports atomic transactions, foreign keys and more.

Sample Usage

Open and create a table:

1
2
3
4
5
6
import sqlite3
con = sqlite3.connect("app.db")
cur = con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS items(id INTEGER PRIMARY KEY, name TEXT)")
con.commit()
con.close()

Great For Many Uses

SQLite is not for high-concurrency client-server apps but is ideal for most other cases.

Find detailed info at the official site.

Tags: [sqlite] [database] [dev]