FAQ


1. Does pylite-orm support cross-database transactions?

No.

pylite-orm's transactions are based on the current database connection. If you need cross-database transactions, you need to handle them manually.


2. How does pylite-orm perform with massive data operations?

Extremely high.

pylite-orm uses Python generators for on-demand loading, so performance is extremely high. It won't exhaust memory or block I/O.

When processing massive data (for example, exporting 10 million records to a CSV file at once), you cannot use the standard all() or serial_list() methods. Please use a dedicated method not mentioned in the query guide: iter().

You don't need to change anything, just replace the ending all() or serial_list() with iter().

The only requirement is that the iter() method doesn't support the preload() method for preloading. If you have relational data, please use the join() method.


3. What is the overall performance of pylite-orm?

Infinitely close to native SQL query performance.

Here's a performance comparison for executing SELECT * FROM user LIMIT 10000:

Implementation Time Description
Native SQLite3 (fetchall) ~40 ms Baseline, only returns tuples
Pylite ORM (iter generator) ~45 ms Extremely fast, infinitely close to native performance
Pylite ORM (all or serial_list) ~70 ms Very fast. Uses __dict__ for brute-force assignment, almost no overhead
Peewee ORM ~90 ms Has additional metaclass tracking mechanism
SQLAlchemy ORM ~120 ms Heavyweight state machine, most feature-rich
Django ORM ~150 ms Massive signal dispatch, field validation, lazy loading mechanisms