Description
When I just specify multi-tenancy, all my insert / updates work.
However, when I just add properties to the schema declaration, I start to get this error:
weaviate.exceptions.UnexpectedStatusCodeError: Object was not updated.! Unexpected status code: 422, with response body: {‘error’: [{‘message’: ‘msg:repo.object code:422 err:search index nodes: class Nodes has multi-tenancy disabled, but request was with tenant’}]}.
This is the code:
nodes_collection = client.collections.create(
name="Nodes",
vectorizer_config=wvc.config.Configure.Vectorizer.none(),
vector_index_config=Configure.VectorIndex.hnsw(
distance_metric=VectorDistances.COSINE
),
# Multi tenancy to separate each user's data
multi_tenancy_config=Configure.multi_tenancy(enabled=True, auto_tenant_creation=True, auto_tenant_activation=True),
# Specify some properties beforehand to set right data type (i.e. obj[] instead of string[])
properties=[
Property(name="tags", data_type=DataType.OBJECT_ARRAY),
]
)
If I remove the properties field, then it will work again.
This is an example insert code:
def get_tenant_collection(name):
try:
return nodes_collection.with_tenant(name)
except:
nodes_collection.tenants.create(name)
return nodes_collection.with_tenant(name)
tenant_collection = get_tenant_collection(tenant_name)
tenant_collection.data.insert(
vector=record.vector,
properties=record.properties,
uuid=record.uniqueid
)
Even update / delete, all operations trigger the multi-tenancy error. I can confirm the rest of the code is working including getting the tenant collection because just commenting out properties, will make everything start working
nodes_collection = client.collections.create(
name="Nodes",
vectorizer_config=wvc.config.Configure.Vectorizer.none(),
vector_index_config=Configure.VectorIndex.hnsw(
distance_metric=VectorDistances.COSINE
),
# Multi tenancy to separate each user's data
multi_tenancy_config=Configure.multi_tenancy(enabled=True, auto_tenant_creation=True, auto_tenant_activation=True),
# Commenting this out makes all operations work again
# properties=[
# Property(name="tags", data_type=DataType.OBJECT_ARRAY),
# ]
)
Server Setup Information
- Weaviate Server Version: Cloud
- Multi Node? Number of Running Nodes: No
- Client Language and Version: Python v4
- Multitenancy?: Yes