# database-operations > Instructions on how to write database queries with SQLAlchemy. - Author: Tuomas Salmi - Repository: Crossbill-Highlights/crossbill-web - Version: 20260120211443 - Stars: 9 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/Crossbill-Highlights/crossbill-web - Web: https://mule.run/skillshub/@@Crossbill-Highlights/crossbill-web~database-operations:20260120211443 --- --- name: database-operations description: Instructions on how to write database queries with SQLAlchemy. --- When performing database operations using SQLAlchemy, follow these guidelines to ensure efficient and maintainable code: - Avoid for-loops. Instead always prefer bulk operations using SQLAlchemy's built-in methods or use SQL joins to get related data in a single query. - Database operations should be contained in repository classes