Skip to content

feat(weaviate): add tenant support in write_documents with tests (syn…#3056

Open
Akash504-ai wants to merge 13 commits into
deepset-ai:mainfrom
Akash504-ai:feat/weaviate-multitenancy
Open

feat(weaviate): add tenant support in write_documents with tests (syn…#3056
Akash504-ai wants to merge 13 commits into
deepset-ai:mainfrom
Akash504-ai:feat/weaviate-multitenancy

Conversation

@Akash504-ai

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes

  • Added tenant support to write_documents and write_documents_async
  • Updated internal batch write logic to pass tenant parameter correctly
  • Enables basic multi-tenancy support for Weaviate document store
  • Added tests for tenant support in:
    • sync document store
    • async document store

How did you test it?

  • Added integration tests for:
    • test_write_documents_with_tenant
    • test_write_documents_with_tenant_async
  • Verified no regression in default (non-tenant) behavior
  • Did not run full Weaviate integration locally, relying on CI for validation

Notes for the reviewer

  • Changes are minimal and focused on tenant support in write operations
  • Both sync and async flows are covered
  • Backward compatible (no tenant → existing behavior unchanged)

Checklist

  • I have read the contributors guidelines and code of conduct
  • I have updated the related issue
  • I added tests
  • I used a conventional commit message

@Akash504-ai Akash504-ai requested a review from a team as a code owner March 26, 2026 09:30
@Akash504-ai Akash504-ai requested review from julian-risch and removed request for a team March 26, 2026 09:31
@CLAassistant

CLAassistant commented Mar 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added integration:weaviate type:documentation Improvements or additions to documentation labels Mar 26, 2026
@Akash504-ai Akash504-ai force-pushed the feat/weaviate-multitenancy branch from 1fe6aeb to 73e97f2 Compare March 26, 2026 17:53

@julian-risch julian-risch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Akash504-ai Thank you for opening this pull request. I have a couple of smaller change requests, which I explain in more detail below. Please keep comments that are not related to tenant_support unchanged in this pull request. Other than that the code changes look quite good to me already.

Comment thread integrations/weaviate/tests/test_document_store.py Outdated
Comment thread integrations/weaviate/tests/test_document_store.py Outdated
async def test_write_documents_with_tenant_async(self, document_store):
doc = Document(content="tenant test doc")

written = await document_store.write_documents_async([doc], tenant="tenant1")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test could check if _write_async get's called with the expected tenant parameter value.

@Akash504-ai

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestion! Initially I implemented the test using _write_async mocking, but it was not aligned with the current implementation and caused CI failures.
I updated the test to validate the actual behavior instead. Let me know if you'd prefer keeping the internal call assertion happy to adjust accordingly.

@julian-risch

Copy link
Copy Markdown
Member

@Akash504-ai Thank you for iterating on this PR. Could you please also address my other change requests and restore comments that this PR removes in its current state? #3056 (review)
Comments that are not related to tenant_support should remain unchanged in this pull request please.

@Akash504-ai Akash504-ai force-pushed the feat/weaviate-multitenancy branch from 7306942 to f8a5978 Compare June 8, 2026 13:52
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (weaviate)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/weaviate/src/haystack_integrations/document_stores/weaviate
  document_store.py 953-975, 985-1008, 1018-1033, 1045-1046, 1063, 1123-1126, 1159, 1297-1305, 1322-1341, 1365, 1381, 1389, 1402-1408, 1411-1412, 1476-1480
Project Total  

This report was generated by python-coverage-comment-action

@Akash504-ai

Copy link
Copy Markdown
Contributor Author

I've restored the unrelated comments/docstrings that were modified and addressed the remaining issues from the conflict resolution. All checks are now passing. Please let me know if there's anything else that should be adjusted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:weaviate type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weaviate: Consider Adding support for multi tenancy

3 participants