graph LR
CRUDService["CRUDService"]
QueryBuilder["QueryBuilder"]
DatabaseSessionManager["DatabaseSessionManager"]
ORMModel["ORMModel"]
PydanticSchema["PydanticSchema"]
Database["Database"]
Unclassified["Unclassified"]
CRUDService -- "uses" --> PydanticSchema
CRUDService -- "delegates to" --> QueryBuilder
QueryBuilder -- "inspects" --> ORMModel
CRUDService -- "requests session from" --> DatabaseSessionManager
DatabaseSessionManager -- "manages connection to" --> Database
CRUDService -- "manipulates" --> ORMModel
click ORMModel href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/sqlalchemy-crud-plus/ORMModel.md" "Details"
The sqlalchemy_crud_plus project provides a streamlined approach to database interactions by centralizing CRUD operations within the CRUDService. This service acts as the primary interface, receiving data often validated by PydanticSchema and translating requests into database operations. It intelligently delegates complex query construction to the QueryBuilder, which dynamically builds SQLAlchemy expressions by inspecting ORMModel definitions. All database interactions are facilitated through DatabaseSessionManager, ensuring proper session and transaction handling with the underlying Database. This modular design promotes a clear separation of concerns, making the system easy to understand, extend, and maintain, while providing a robust foundation for data management.
The central component responsible for executing all Create, Read, Update, and Delete operations on ORM models, acting as the primary interface for database interactions.
Related Classes/Methods:
sqlalchemy_crud_plus.crud.CRUDPlus:create_modelsqlalchemy_crud_plus.crud.CRUDPlus:select_modelsqlalchemy_crud_plus.crud.CRUDPlus:update_modelsqlalchemy_crud_plus.crud.CRUDPlus:delete_modelsqlalchemy_crud_plus.crud.CRUDPlus:count
Constructs dynamic SQLAlchemy query components, including filter expressions (AND, OR, arithmetic) and sorting clauses, by translating high-level specifications into database-executable expressions.
Related Classes/Methods:
sqlalchemy_crud_plus.utils:parse_filterssqlalchemy_crud_plus.utils:apply_sortingsqlalchemy_crud_plus.utils:get_columnsqlalchemy_crud_plus.utils:get_sqlalchemy_filter
Provides and manages the SQLAlchemy AsyncSession instance, ensuring proper transaction scope and connection handling for all database operations.
Related Classes/Methods:
ORMModel [Expand]
Represents the user-defined SQLAlchemy declarative models, defining the database schema, data structure, and providing essential metadata for database operations.
Related Classes/Methods:
An external component (Pydantic) used for validating incoming data before processing by CRUD operations and for serializing outgoing ORM model instances into a desired format.
Related Classes/Methods:
The actual persistent data store (e.g., PostgreSQL, SQLite) where application data is stored and retrieved.
Related Classes/Methods:
Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)
Related Classes/Methods: None