From: Michael Bayer Date: Tue, 6 Feb 2024 00:27:50 +0000 (+0000) Subject: Merge "add additional IMV UUID tests, fix pymssql case" into main X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a3639a5eb3cd9838f0c527dd5171d616d131da7;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Merge "add additional IMV UUID tests, fix pymssql case" into main --- 3a3639a5eb3cd9838f0c527dd5171d616d131da7 diff --cc lib/sqlalchemy/sql/sqltypes.py index 42bce99a82,57032ed275..5a8c86b166 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@@ -3680,8 -3724,34 +3680,33 @@@ class Uuid(Emulated, TypeEngine[_UUID_R return process + def _sentinel_value_resolver(self, dialect): + """For the "insertmanyvalues" feature only, return a callable that + will receive the uuid object or string + as it is normally passed to the DB in the parameter set, after + bind_processor() is called. Convert this value to match + what it would be as coming back from a RETURNING or similar + statement for the given backend. + + Individual dialects and drivers may need their own implementations + based on how their UUID types send data and how the drivers behave + (e.g. pyodbc) + + """ + if not self.native_uuid or not dialect.supports_native_uuid: + # dealing entirely with strings going in and out of + # CHAR(32) + return None + + elif self.as_uuid: + # we sent UUID objects and we are getting UUID objects back + return None + else: + # we sent strings and we are getting UUID objects back + return _python_UUID + class UUID(Uuid[_UUID_RETURN], type_api.NativeForEmulated): - """Represent the SQL UUID type. This is the SQL-native form of the :class:`_types.Uuid` database agnostic