]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Merge "add additional IMV UUID tests, fix pymssql case" into rel_2_0
authorMichael Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Feb 2024 00:27:53 +0000 (00:27 +0000)
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>
Tue, 6 Feb 2024 00:27:53 +0000 (00:27 +0000)
1  2 
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/testing/suite/test_insert.py
test/sql/test_insert_exec.py

Simple merge
Simple merge
index 2ba63cdbbf1c9af5df06ebe681432598aa8c8048,b359fe97bd9d84d0683d3e96ce3295442841e2e4..764f9a382eae46307f7998cd9e877aa60950d2b9
@@@ -3679,8 -3723,34 +3679,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
Simple merge