Blending SQL and Python with Sqlorm
12 days ago
- #Python
- #SQL
- #ORM
- SQLORM is a Python ORM designed with SQL as the primary focus, allowing direct SQL query execution.
- Key features include immediate query execution, unattached objects to sessions, and preference for hand-written SQL over query builders.
- SQLORM supports templated SQL queries via Python functions, using docblocks for SQL statements.
- Connections and transactions are managed via context managers with the Engine class.
- Rows can be returned as dictionaries or hydrated into objects, with support for Active Record pattern via the Model class.
- Model classes can include SQL methods and column definitions via Python annotations for better tooling support.
- Supports operations across different databases, like reading from a replica and writing to a primary.
- Includes utilities for relationships, lazy loading, and integrates with Flask.