A lightweight ORM for Python
Project description
Pisces ORM
💡 Design Philosophy
Chinese ver. ->中文版
When we load data from a JSON file using json.load(f), the file doesn't need to remain open—we can access the data anytime. However, many ORM frameworks still require a persistent Session object during data queries. Personally, I find this design unintuitive and overly cumbersome.
Before getting into database systems, I (and perhaps many others) used JSON for data storage. That’s why I aimed to design this ORM to mimic JSON-style context management. As a result, Pisces ORM performs queries in a session-free manner: all data is fetched and packed at once. While this approach may incur higher memory usage, my goal is to prioritize simplicity, ease of use, and approachability, allowing anyone to build projects efficiently.
The name "Pisces" reflects the dual-mode nature of the ORM—supporting both synchronous and asynchronous APIs under consistent naming conventions. Switching between modes is as simple as choosing a different engine, with no learning curve. (I originally wanted to call it Gemini, but Google already took that for its AI... luckily, Pisces was still available)
✨ Features
-
Session-free data fetching: objects are fully populated in a single query.
-
Dual support for synchronous and asynchronous methods with unified API names.
-
Easy-to-update database schema: ideal for early-stage projects with evolving database structures.
⚠️ Note: Not recommended for production use yet due to missing validations and protections.
🔭 Roadmap
- Support for databases beyond SQLite.
- Implement a user-friendly pessimistic locking mechanism that allows automatic row locking during queries—even in async mode—to ensure atomicity with SQLite in single-application environments.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
雙魚座 ORM
💡 設計理念:
在使用 json.load(f) 讀取 JSON 資料時,我們不需要持續維持檔案開啟狀態,資料也能隨時調用。然而,許多 ORM 框架在存取資料時卻仍需倚賴 Session 的存在。至少對我而言,這種設計既不直覺,也相當繁瑣。
或許有不少人跟我一樣,在接觸資料庫系統前,是透過 JSON 儲存資料。因此,我希望這個 ORM 框架的使用方式,能夠更貼近 JSON 處理的上下文管理邏輯。也因此,雙魚座 ORM 採取無 Session 依賴的查詢模式,一次性將所需資料打包完成。雖然這可能會帶來較高的記憶體使用等硬體成本,但我更希望它能以「簡單、輕鬆、易上手」為出發點,讓所有人都能快速應用在自己的專案中。
命名為「雙魚座」的原因,是因為它同時支援同步與非同步兩種操作模式,並且保有一致的 API 命名方式。你只需選擇不同的引擎,即可切換模式,使用上不會產生額外的負擔。(其實原本想叫雙子座,但「Gemini」已經被 Google 的 AI 用走了,幸好還有雙魚座可用)
✨ ORM特點:
-
查詢時物件一次性打包完成,完全不依賴 Session。
-
同步與非同步方法皆有提供,且命名一致。
-
支援動態更新資料庫結構,對於開發初期結構尚未穩定的專案十分友好。
⚠️ 注意:由於目前缺乏某些驗證與保護機制,不建議用於正式生產環境。
🔭 未來計畫:
- 支援除 SQLite 外的其他資料庫系統。
- 設計簡易配置的「悲觀鎖」機制,讓搜尋時可自動為資料上鎖,即便在非同步模式下,SQLite 也能實現資料的原子性操作 (由於SQLite特性,原子性僅能在單程式範圍內實現)。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file piscesorm-0.0.2.tar.gz.
File metadata
- Download URL: piscesorm-0.0.2.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecc71267f1b8312c6b90aa26652749725b5dba14e0b64aab95dea45d21fe9a6e
|
|
| MD5 |
05600f8146d9afd52ad25cbf690db070
|
|
| BLAKE2b-256 |
c582165dc884509f7a6337f37b4cd27b569fd8837ee93567af5cd96c216d8283
|
File details
Details for the file piscesorm-0.0.2-py3-none-any.whl.
File metadata
- Download URL: piscesorm-0.0.2-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48696a0820dbf0b6a285f23c243fa491d9ae97c30e0b4fdfa13701ca8bb06f92
|
|
| MD5 |
c608791ca59455196a6fc68bb9c7d4c3
|
|
| BLAKE2b-256 |
3a532e0ae222620bd28c5e4954c6e56a0b1c56357ce99cdaebbdbb4ad3001acb
|