Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python lightweight database wrapper for SQLite

Tags:

python

sqlite

Is there a lightweight database wrapper in Python that I can use for SQLite. I would like something like Django's ORM, but that I can just point to a database file and it'll make the required API for me (i.e handle all the CRUD).

like image 980
Puzzled79 Avatar asked Jan 26 '12 22:01

Puzzled79


People also ask

What is Apsw in Python?

APSW is a Python wrapper for the SQLite embedded relational database engine. It focuses translating between the complete SQLite C API and Python's C API. It is recommended to use the builtin sqlite3 module, unless you want SQLite specific functionality.

Is SQLite good for Python?

SQLite3 can be integrated with Python using sqlite3 module, which was written by Gerhard Haring. It provides an SQL interface compliant with the DB-API 2.0 specification described by PEP 249. You do not need to install this module separately because it is shipped by default along with Python version 2.5.

How lightweight is SQLite?

The default build is less than a megabyte of code and requires only a few megabytes of memory. With some adjustments, both the library size and memory use can be significantly reduced. Transactional. SQLite transactions are fully ACID-compliant, allowing safe access from multiple processes or threads.

How much data can Python SQLite handle?

There is no 2 GB limit. SQLite database files have a maximum size of about 140 TB. On a phone, the size of the storage (a few GB) will limit your database file size, while the memory size will limit how much data you can retrieve from a query. Furthermore, Android cursors have a limit of 1 MB for the results.


1 Answers

Yeah, SQLAlchemy is great, but there are also other options. One of them is Peewee. Very lightweight and it may fits perfectly with what you are looking for.

https://github.com/coleifer/peewee

like image 84
Gabriel Jordão Avatar answered Sep 22 '22 00:09

Gabriel Jordão