Skip to content

Commit 5ff1e71

Browse files
committed
feat: update col function to return QueryableAttribute for improved type safety
1 parent 8e9fe31 commit 5ff1e71

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sqlmodel/sql/expression.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
WithinGroup,
2424
)
2525
from sqlalchemy.orm import InstrumentedAttribute
26+
from sqlalchemy.orm.attributes import QueryableAttribute
2627
from sqlalchemy.sql._typing import (
2728
_ColumnExpressionArgument,
2829
_ColumnExpressionOrLiteralArgument,
@@ -209,7 +210,7 @@ def within_group(
209210
return sqlalchemy.within_group(element, *order_by)
210211

211212

212-
def col(column_expression: _T) -> Column[_T]:
213+
def col(column_expression: _T) -> QueryableAttribute[_T]:
213214
if not isinstance(column_expression, (ColumnClause, Column, InstrumentedAttribute)):
214215
raise RuntimeError(f"Not a SQLAlchemy column: {column_expression}")
215216
return column_expression # type: ignore

0 commit comments

Comments
 (0)