ORM & Migrations
bloom_db and bloom_migrate provide a unified, chainable QuerySet API modeled on Django's ORM and djangors-orm, with symmetric SQLite and PostgreSQL support and transactional DDL migrations.
Defining Models with bloom_db
Models subclass Model and declare field metadata via ModelMeta and @BloomModel annotations. All SQL query values use bound parameters to prevent SQL injection:
QuerySet API & Q() Expressions
The QuerySet<T> API provides chainable querying methods: filter, exclude, orderBy, limit, offset, get, first, all, exists, count, update, delete, bulkCreate, getOrCreate, updateOrCreate, values, and valuesList:
Optional Codegen with bloom_db_generator
If you prefer not to write ModelMeta, fieldValues(), and fromRow by hand, bloom_db_generator uses build_runner to generate the mapping mixins automatically:
Database Migrations with bloom_migrate
Migration files live under migrations/<app>/NNNN_name.sql and contain structured -- up and -- down SQL blocks:
Manage migrations using the bloom_migrate CLI:
Programmatic MigrationRunner
Execute pending migrations programmatically during server boot: