Multi-tenant cross-reference

Description

As mentioned here
A cross-reference can be added from a multi-tenancy collection object to:

  • A non-multi-tenancy collection object,

problem Statement:
I have two class A { price, Has_Item} & B { item} .
A with multi tenancy and B with without it.
I have CrossRef from A → B
When I tried to fetch information from

jeopardy = client.collections.get(“A”).with_tenant(‘1234’)
response = jeopardy.query.fetch_objects(
return_references=wvc.query.QueryReference(link_on=“Has_Item”, return_properties=[“item”]),
return_properties=[‘price’]
)
for o in response.objects:
print(o.properties)
print(o.references[“Has_Item”].objects[0].properties[“item”])

Above query gives error such as
list class: search: resolve cross-refs: build reference cache: build request cache: fetch job list: index “B”: class B has multi-tenancy disabled, but request was with tenant.

How should i read those object as weaviate already mentioned they are supporting this type of cross-ref ?

Server Setup Information

  • Weaviate Server Version: latest version
  • Client Language and Version: V4

Hi!

This scenario is interesting to create a notebook so it gets easily reproducible.

I will be away the next couple days, but could do that when I get back.

Thanks!

I’m waiting for your response ?

Help me solve this puzzle

hi @2020ashish ! Really sorry.

I was out those days and only got back now :grimacing:

Were you able to reproduce something?

No, still on same page.

@DudaNogueira Kindly take a look at this above one.

@DudaNogueira Please take a look on this status on this.

hi @2020ashish !! Sorry here again :grimacing:

I was able to reproduce this:

from weaviate.classes import config

collection_b = client.collections.create(
    "CollectionB",
    properties=[
        config.Property(name="text", data_type=config.DataType.TEXT)
    ]
)

collection_a = client.collections.create(
    "CollectionA",
    multi_tenancy_config=config.Configure.multi_tenancy(
        enabled=True, auto_tenant_creation=True, auto_tenant_activation=True
    ),
    properties=[
        config.Property(name="price", data_type=config.DataType.TEXT)
    ],
    references=[
        config.ReferenceProperty(
            name="has_item", target_collection="CollectionB"
        )]
)

from weaviate.util import generate_uuid5
# add some content for classB, non multi tenant - Item
collection_b.data.insert({"text": "computer"}, uuid=generate_uuid5("computer"))
collection_b.data.insert({"text": "mouse"}, uuid=generate_uuid5("mouse"))

# now we get the collection with tenant 1234
collection_a_tenant = collection_a.with_tenant("1234")
#classa_tenant = class_a

# now we add an object, cross referencing a non tenant collection
collection_a_tenant.data.insert(
    properties={"price": "1"},
    references={"has_item": generate_uuid5("computer")}
)

from weaviate.classes import query
result = collection_a_tenant.query.fetch_objects(
    return_references=query.QueryReference(
       link_on="has_item", return_properties=["text"]
    )
)

the error:

WeaviateQueryError: Query call with protocol GRPC search failed with message explorer: list class: search: resolve cross-refs: build reference cache: build request cache: fetch job list: index “collectionb”: class CollectionB has multi-tenancy disabled, but request was with tenant.

Let me know if this is close to what you are after.

According to docs. it should be possible to cross reference a non multi tenant collection (on this case, ClassB):

Ps: I also tried pyv3 version:

clientv3 = weaviate.Client("http://localhost:8080")
response = (
    clientv3.query
    .get(
        "ClassA",
        ["price", "has_Item { ... on ClassB { text } }"],
    )
    .with_limit(2).with_tenant("1234").do()
)

and got a similar error ( but the check was inverted)

{‘data’: {‘Get’: {‘ClassA’: None}},
‘errors’: [{‘locations’: [{‘column’: 6, ‘line’: 1}],
‘message’: ‘explorer: list class: search: resolve cross-refs: build reference cache: build request cache: fetch job list: index “classb”: class ClassB has multi-tenancy disabled, but request was with tenant’,
‘path’: [‘Get’, ‘ClassA’]}]}

yes it is same think.
please check if it is possible to fetch data as mentioned in document.

Hey, has this issue been fixed?

hi @Paul_Hechinger !!

Welcome to our community :hugs:

We have reproduced this and have a GH issue here:

Our team will look into this as soon as they have capacity!

Thanks!