Skip to content

Commit 57a12dc

Browse files
author
kiddick
committed
Fix for encode#28 add alias in count
1 parent fc7bf46 commit 57a12dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

orm/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def limit(self, limit_count: int):
186186

187187
async def count(self) -> int:
188188
expr = self.build_select_expression()
189-
expr = sqlalchemy.func.count().select().select_from(expr)
189+
expr = sqlalchemy.func.count().select().select_from(sqlalchemy.sql.expression.alias(expr))
190190
return await self.database.fetch_val(expr)
191191

192192
async def all(self, **kwargs):

0 commit comments

Comments
 (0)