# Multi-tenant cross-reference

**URL:** <https://forum.weaviate.io/t/multi-tenant-cross-reference/1784>\
**Category:** Support\
**Created:** [March 21, 2024, 11:41am UTC](https://forum.weaviate.io/t/multi-tenant-cross-reference/1784 "2024-03-21T11:41:20Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [July 23, 2024, 12:42pm UTC](https://forum.weaviate.io/t/multi-tenant-cross-reference/1784/13 "2024-07-23T12:42:06Z")

</div>

hi @Paul_Hechinger !!

Welcome to our community 🤗

We have reproduced this and have a GH issue here:

> <https://github.com/weaviate/weaviate/issues/5269>
>
> \### How to reproduce this bug?
> 
> As per the weaviate documentation one should be …able to cross reference from a multi tenant to a non multi tenant.
> 
> Run the below script
> \`\`\`
> import random
> import string
> from weaviate.classes.config import Property, DataType, ReferenceProperty
> import weaviate
> import weaviate.classes.config as wvc
> from weaviate.classes.tenants import Tenant
> from weaviate.classes.query import QueryReference
> 
> client = weaviate.connect\_to\_local()
> 
> \# Create collection
> if (client.collections.exists("JeopardyCategory")):
> # delete collection "Article" - THIS WILL DELETE THE COLLECTION AND ALL ITS DATA
> client.collections.delete("JeopardyCategory") # Replace with your collection name
> 
> \# Create collection
> if (client.collections.exists("JeopardyQuestion")):
> # delete collection "Article" - THIS WILL DELETE THE COLLECTION AND ALL ITS DATA
> client.collections.delete("JeopardyQuestion") # Replace with your collection name
> 
> 
> category = client.collections.create(
> name="JeopardyCategory",
> description="A Jeopardy! category",
> properties=\[
> Property(name="title", data\_type=DataType.TEXT)
> \],
> replication\_config=wvc.Configure.replication(factor=1),
>     
> )
> 
> 
> jeopardy\_question= client.collections.create(
> name="JeopardyQuestion",
> description="A Jeopardy! question",
> properties=\[
> Property(name="question", data\_type=DataType.TEXT),
> Property(name="answer", data\_type=DataType.TEXT),
> \],
> references=\[
> ReferenceProperty(
> name="hasCategory",
> target\_collection="JeopardyCategory"
> )
> \],
> replication\_config=wvc.Configure.replication(factor=1),
> multi\_tenancy\_config=wvc.Configure.multi\_tenancy(enabled=True, auto\_tenant\_creation=True, auto\_tenant\_activation=True)
> 
> )
> 
> \# Create tenant on JeopardyQuestion
> jeopardy\_question.tenants.create(
> tenants=\[
> Tenant(name="tenantA"),
> Tenant(name="tenantB"),
> \]
> )
> 
> \# Insert objects to the collection
> def get\_random\_string(length):
> # choose from all lowercase letter
> letters = string.ascii\_lowercase
> result\_str = ''.join(random.choice(letters) for i in range(length))
> return result\_str
> # print("Random string of length", length, "is:", result\_str)
> 
> \# Add category to JeopardyCategory
> 
> jeopardy = client.collections.get("JeopardyCategory")
> 
> category\_uuid = jeopardy.data.insert({
> "title": get\_random\_string(10)
> })
> 
> questions= jeopardy\_question.with\_tenant(tenant="tenantA")
> 
> questions.data.insert({
> "question": "question" + get\_random\_string(10),
> "answer" : "answer"+ get\_random\_string(10)
> },
> references={"hasCategory": category\_uuid}, # e.g. {"hasCategory": "583876f3-e293-5b5b-9839-03f455f14575"}
> )
> 
> response = questions.query.fetch\_objects(return\_references=QueryReference(link\_on="hasCategory", return\_properties=\["question", "answer"\]))
> 
> for o in response.objects:
> print(o.properties)
> 
> client.close()
> 
> \`\`\`
> 
> \### What is the expected behavior?
> 
> No error should be displayed and user should be able to query the reference property in a multitenant collection.
> 
> \### What is the actual behavior?
> 
> \`\`\`
> weaviate.exceptions.WeaviateQueryError: Query call with protocol GRPC search failed with message \<AioRpcError of RPC that terminated with:
> status = StatusCode.UNKNOWN
> details = "explorer: list class: search: resolve cross-refs: build reference cache: build request cache: fetch job list: index "jeopardycategory": class JeopardyCategory has multi-tenancy disabled, but request was with tenant"
> debug\_error\_string = "UNKNOWN:Error received from peer {created\_time:"2024-07-01T19:38:14.318273+01:00", grpc\_status:2, grpc\_message:"explorer: list class: search: resolve cross-refs: build reference cache: build request cache: fetch job list: index \\"jeopardycategory\\": class JeopardyCategory has multi-tenancy disabled, but request was with tenant"}"
> \>.
> 
> \`\`\`
> 
> \### Supporting information
> 
> https://weaviate.io/developers/weaviate/manage-data/multi-tenancy#cross-references
> 
> \### Server Version
> 
> 1.25.6
> 
> \### Code of Conduct
> 
> \- \[X\] I have read and agree to the Weaviate's \[Contributor Guide\](https://weaviate.io/developers/contributor-guide) and \[Code of Conduct\](https://weaviate.io/service/code-of-conduct)

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

Thanks!

---

_[View the full topic](https://forum.weaviate.io/t/multi-tenant-cross-reference/1784)._
