Revert "fix(mypy): resolve OpenTelemetry typing issues in telemetry.py (#3931)"

This reverts commit 9afc52a36a.
This commit is contained in:
Ashwin Bharambe 2025-10-28 09:48:46 -07:00
parent 9afc52a36a
commit 85887d724f
2 changed files with 423 additions and 49 deletions

View file

@ -4,7 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from collections.abc import Mapping, Sequence
from typing import Any, Literal, cast
from typing import Any, Literal
from sqlalchemy import (
JSON,
@ -55,17 +55,17 @@ def _build_where_expr(column: ColumnElement, value: Any) -> ColumnElement:
raise ValueError(f"Operator mapping must have a single operator, got: {value}")
op, operand = next(iter(value.items()))
if op == "==" or op == "=":
return cast(ColumnElement[Any], column == operand)
return column == operand
if op == ">":
return cast(ColumnElement[Any], column > operand)
return column > operand
if op == "<":
return cast(ColumnElement[Any], column < operand)
return column < operand
if op == ">=":
return cast(ColumnElement[Any], column >= operand)
return column >= operand
if op == "<=":
return cast(ColumnElement[Any], column <= operand)
return column <= operand
raise ValueError(f"Unsupported operator '{op}' in where mapping")
return cast(ColumnElement[Any], column == value)
return column == value
class SqlAlchemySqlStoreImpl(SqlStore):
@ -210,8 +210,10 @@ class SqlAlchemySqlStoreImpl(SqlStore):
query = query.limit(fetch_limit)
result = await session.execute(query)
# Iterate directly - if no rows, list comprehension yields empty list
rows = [dict(row._mapping) for row in result]
if result.rowcount == 0:
rows = []
else:
rows = [dict(row._mapping) for row in result]
# Always return pagination result
has_more = False