]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Merge "add additional IMV UUID tests, fix pymssql case" into main
authorMichael Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Feb 2024 00:27:50 +0000 (00:27 +0000)
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>
Tue, 6 Feb 2024 00:27:50 +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 42bce99a82988f6b68b4ce1eb0d6ba04599a3ecc,57032ed275e40d13fce24aee8a9778beb57d42bb..5a8c86b16655d24b1df38fe0c8a3d65258e797e9
@@@ -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
Simple merge