bito-code-review[bot] commented on code in PR #40671:
URL: https://github.com/apache/superset/pull/40671#discussion_r3350455572


##########
superset/key_value/shared_entries.py:
##########
@@ -86,6 +86,19 @@ def set_shared_value(key: SharedKey, value: Any) -> None:
     KeyValueDAO.create_entry(RESOURCE, value, CODEC, uuid_key)
 
 
+@transaction()
+def upsert_shared_value(key: SharedKey, value: Any) -> None:
+    """
+    Create or update a shared value by key, using the current hash algorithm.
+
+    Unlike :func:`set_shared_value`, this is idempotent and may be called
+    repeatedly to overwrite an existing entry.
+    """
+    namespace = get_uuid_namespace("")
+    uuid_key = uuid3(namespace, key)
+    KeyValueDAO.upsert_entry(RESOURCE, value, CODEC, uuid_key)

Review Comment:
   <!-- Bito Reply -->
   The addition of dedicated unit tests for `upsert_shared_value` in 
`tests/unit_tests/key_value/test_shared_entries_migration.py` effectively 
addresses the requirement for comprehensive testing of the new function. This 
ensures that both the create/update delegation path and the idempotent behavior 
are verified.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to