From 7fca51e940cc60d1b6836eca1ed479f0b14558e4 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 12 Dec 2019 14:41:52 +0100 Subject: [PATCH] Fix default type for Numeric columns to Decimal --- sqlalchemy-stubs/sql/sqltypes.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sqlalchemy-stubs/sql/sqltypes.pyi b/sqlalchemy-stubs/sql/sqltypes.pyi index aa8f094..b3d84ba 100644 --- a/sqlalchemy-stubs/sql/sqltypes.pyi +++ b/sqlalchemy-stubs/sql/sqltypes.pyi @@ -78,7 +78,8 @@ class SmallInteger(Integer): class BigInteger(Integer): __visit_name__: str = ... -class Numeric(_LookupExpressionAdapter, TypeEngine[float]): # TODO: this can be also decimal.Decimal +# TODO: This can also be float (however, decimal is the default) +class Numeric(_LookupExpressionAdapter, TypeEngine[decimal.Decimal]): __visit_name__: str = ... precision: Optional[int] = ... scale: Optional[int] = ... @@ -90,7 +91,7 @@ class Numeric(_LookupExpressionAdapter, TypeEngine[float]): # TODO: this can be def literal_processor(self, dialect: Dialect) -> Callable[[Union[float, decimal.Decimal]], str]: ... @property def python_type(self) -> Union[Type[float], Type[decimal.Decimal]]: ... # type: ignore # return type incompatible - def bind_processor(self, dialect: Dialect) -> Optional[Callable[[Optional[str]], float]]: ... + def bind_processor(self, dialect: Dialect) -> Optional[Callable[[Optional[str]], decimal.Decimal]]: ... def result_processor(self, dialect: Dialect, coltype: Any) -> Optional[Callable[[Optional[Any]], Optional[Union[float, decimal.Decimal]]]]: ...