revert docs changes, pin databases, fix mypy
This commit is contained in:
@ -381,7 +381,6 @@ if TYPE_CHECKING: # pragma: nocover
|
||||
def Boolean(**kwargs: Any) -> bool:
|
||||
pass
|
||||
|
||||
|
||||
else:
|
||||
|
||||
class Boolean(ModelFieldFactory, int):
|
||||
@ -545,7 +544,6 @@ if TYPE_CHECKING: # pragma: nocover # noqa: C901
|
||||
) -> Union[str, bytes]:
|
||||
pass
|
||||
|
||||
|
||||
else:
|
||||
|
||||
class LargeBinary(ModelFieldFactory, bytes):
|
||||
|
||||
@ -18,6 +18,15 @@ import databases
|
||||
import sqlalchemy
|
||||
from sqlalchemy import bindparam
|
||||
|
||||
try:
|
||||
from sqlalchemy.engine import LegacyRow
|
||||
except ImportError:
|
||||
if TYPE_CHECKING:
|
||||
|
||||
class LegacyRow(dict): # type: ignore
|
||||
pass
|
||||
|
||||
|
||||
import ormar # noqa I100
|
||||
from ormar import MultipleMatches, NoMatch
|
||||
from ormar.exceptions import ModelPersistenceError, QueryDefinitionError
|
||||
@ -605,7 +614,9 @@ class QuerySet(Generic[T]):
|
||||
model_cls=self.model_cls, # type: ignore
|
||||
exclude_through=exclude_through,
|
||||
)
|
||||
column_map = alias_resolver.resolve_columns(columns_names=list(rows[0].keys()))
|
||||
column_map = alias_resolver.resolve_columns(
|
||||
columns_names=list(cast(LegacyRow, rows[0]).keys())
|
||||
)
|
||||
result = [
|
||||
{column_map.get(k): v for k, v in dict(x).items() if k in column_map}
|
||||
for x in rows
|
||||
|
||||
Reference in New Issue
Block a user