-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Description
Currently, the process_bind_param method on TypeDecorator[_T] has signature:
| def process_bind_param(self, value: Optional[_T], dialect: Dialect) -> Optional[typing_Text]: ... |
Unfortunately, it looks like this is incorrect: I believe it can return anything that the underlying impl can accept. For instance, in SQLAlchemy's tests there's type decorators that return ints:
class MyNewIntType(types.TypeDecorator):
impl = Integer
def process_bind_param(self, value, dialect):
return value * 10
def process_result_value(self, value, dialect):
return value * 10
def copy(self):
return MyNewIntType()The process_bind_param return value should probably be loosened to match the Optional[Any] of its inverse operation process_result_value.
| def process_result_value(self, value: Optional[Any], dialect: Dialect) -> Optional[_T]: ... |
(This probably applies to process_literal_param too.)
Metadata
Metadata
Assignees
Labels
No labels