Describe the bug
This is not necessarily a bug, but rather undocumented behavior. When using the update_user() method, instead of updating the user_raw_meta_data when supplying the data key, it is replaced wholesale. This is manageable by merging the dicts and changing the one required, which is how I'm handling it now. However this seems non-intuitive as a replacement, not an update.
I propose simply documenting that this is a replacement action in the supabase-py docs and that for an actual update, that needs to be self-managed. I'd suggest also providing a code snippet for 'Update the user's metadata' showing both patterns.
Alternately, adding an option that specifies an update or replace in the method would also make sense. Since this could be enacted at the library level by simply adding an additional option in addition to the 'email_redirect_to' option. This is based on the function signature here:
and the current documentation here:
https://supabase.com/docs/reference/python/auth-updateuser
Reproduction
response = supabase.auth.update_user(
{
"data": {"hello": "world"},
}
)
# log user metadata
response = supabase.auth.update_user(
{
"data": {"one": "two"},
}
)
Steps to reproduce
- with an active user, pull the metadata
- update the metadata
- verify the metadata
- update the metadata with different keys
Library affected
supabase-auth
Library version
supabase 2.31.0
Python version
python 3.14.7
Describe the bug
This is not necessarily a bug, but rather undocumented behavior. When using the update_user() method, instead of updating the user_raw_meta_data when supplying the
datakey, it is replaced wholesale. This is manageable by merging the dicts and changing the one required, which is how I'm handling it now. However this seems non-intuitive as a replacement, not an update.I propose simply documenting that this is a replacement action in the supabase-py docs and that for an actual update, that needs to be self-managed. I'd suggest also providing a code snippet for 'Update the user's metadata' showing both patterns.
Alternately, adding an option that specifies an update or replace in the method would also make sense. Since this could be enacted at the library level by simply adding an additional option in addition to the 'email_redirect_to' option. This is based on the function signature here:
supabase-py/src/auth/src/supabase_auth/_sync/gotrue_client.py
Line 691 in bb7ecc5
Reproduction
Steps to reproduce
Library affected
supabase-auth
Library version
supabase 2.31.0
Python version
python 3.14.7