Dear community, perhaps somebody is
# spicedb
a
Dear community, perhaps somebody is using python and SpiceDB. Trying to send optional_transaction_metadata
Copy code
python
metadata = struct_pb2.Struct()
metadata.update({"some": "metadata"})
write_relationships_request = WriteRelationshipsRequest(updates=relationship_update_requests, optional_transaction_metadata=metadata)
and always having an error
details = "client doesn't support type map[string]interface {}"
. Maybe somebody can share their experience?
y
what version of the client are you using?
a
authzed==0.14.2 because of protobuf 4
y
ah
did you try explicitly typing the value?
lemme see if i can find an example
Copy code
python
foo = struct_pb2.Value(string_value="foo")
metadata.update({ "some": foo })
you don't have to do this in other dynamic languages, which makes me wonder if that's something that changed in recent versions of protobuf
a
lemme try now
y
err wait
updated
a
backend | foo = struct_pb2.Value(string_value="foo") backend | ^^^^^^^^^^^^^^^^^^^^^^^ backend | TypeError: No positional arguments allowed
y
is there a
StringValue
exported by the version of struct_pb2 that you have?
a
nope the only mention of string_value is like in the code above
I'm trying something else but probably it will be the same
y
my sense is that you need to give it a
Value
explicitly
or explicitly construct the
Struct
using the methods that it provides
a
don't know what can be more explicit than this...
Copy code
metadata = struct_pb2.Struct()
        foo_value = struct_pb2.Value(string_value="foo")
        metadata.fields["some"] = foo_value
it's kinda a feeling of version of protobuf something is not good
y
yeah i think you're right
that's very odd 🤔
lemme see about adding a test and making sure that it's not present in the current version
a
yeap meantime I'm updating protobuf to 4.25.6 (still v4, but the most recent). Will see what's there
y
it looks like it works on the current version: https://github.com/authzed/authzed-py/pull/242
a
and I updated to the most recent v4 and it is still failing, but with different error now well, looks like we were right protobuf v4 it is
y
yeah :/
2 Views