Coverage for src/local_deep_research/database/base.py: 100%

2 statements  

« prev     ^ index     » next       coverage.py v7.15.1, created at 2026-07-19 23:35 +0000

1"""Canonical SQLAlchemy declarative ``Base`` for the application schema. 

2 

3This lives in a dependency-free leaf (it imports only SQLAlchemy) so that model 

4modules — including ones in *other* top-level packages, e.g. 

5``domain_classifier.models`` — can import ``Base`` without pulling in the 

6``database.models`` package. ``database.models`` eagerly imports every model to 

7register it on ``Base.metadata``; if a model reached ``Base`` *through* that 

8package it would create an import cycle (``domain_classifier.models`` -> 

9``database.models`` -> ``domain_classifier.models``). Importing from here avoids 

10that entirely. 

11 

12``database.models.base`` re-exports this same object for backwards 

13compatibility, so ``from .base import Base`` inside the models package keeps 

14working and there is exactly one ``Base`` / one ``metadata``. 

15""" 

16 

17from sqlalchemy.orm import declarative_base 

18 

19Base = declarative_base()