Skip to content

Commit 9b3d02f

Browse files
committed
fix: handle nullable sa_inspect return for mypy strict compliance
1 parent cc10e7d commit 9b3d02f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/pyfly/data/relational/sqlalchemy/repository.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def _pk_column(self) -> Any:
8080
from sqlalchemy import inspect as sa_inspect
8181

8282
mapper = sa_inspect(self._model)
83+
if mapper is None:
84+
return self._model.id # type: ignore[attr-defined]
8385
pk_cols = mapper.primary_key
8486
if pk_cols:
8587
return getattr(self._model, pk_cols[0].name)

0 commit comments

Comments
 (0)