Skip to main content
All queries in BackAnt live in repository files (api/repositories/). The DBSession wrapper provides the methods for executing queries, and SQLAlchemy’s select() API builds the statements.

DBSession methods

All methods roll back the session automatically on failure.

Repository base class

All repositories extend Repository, which provides add(), add_all(), and delete():

SELECT queries

INSERT

UPDATE

Or fetch-then-modify pattern:

DELETE

Ordering and limiting

Joins

Raw SQL (when needed)

Use raw SQL sparingly — prefer the SQLAlchemy query API.