Skip to content

Update the weaviate v4 migration docs and script - #616

Merged
RiskeyL merged 2 commits into
mainfrom
updated-weaviate-v4-docs
Dec 16, 2025
Merged

RiskeyL merged 2 commits into
mainfrom
updated-weaviate-v4-docs

Conversation

@RiskeyL

@RiskeyL RiskeyL commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 16, 2025 05:33
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Dec 16, 2025
@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Dec 16, 2025
github-actions Bot added a commit that referenced this pull request Dec 16, 2025
Auto-generated translations for documentation changes in PR #616.

Last-Processed-Commit: dca5a24
Original-PR: #616
Languages: Chinese (zh), Japanese (ja)

🤖 Generated with GitHub Actions
@github-actions

Copy link
Copy Markdown
Contributor

🌐 Multi-language Sync

✅ Created sync PR #617

Synced 2 files to cn + jp

Both PRs can merge independently. Future commits here will auto-update the sync PR.

@RiskeyL
RiskeyL merged commit 212e616 into main Dec 16, 2025
RiskeyL added a commit that referenced this pull request Dec 16, 2025
…d script (#617)

* 🌐 Initial translations for PR #616

Auto-generated translations for documentation changes in PR #616.

Last-Processed-Commit: dca5a24
Original-PR: #616
Languages: Chinese (zh), Japanese (ja)

🤖 Generated with GitHub Actions

* Update weaviate-v4-migration.mdx

* Update migration instructions in weaviate-v4 document

Clarified instructions for running schema migration.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Riskey <36894937+RiskeyL@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the Weaviate v4 migration documentation and the accompanying Python migration script to improve clarity, fix bugs, and add support for running the migration inside Docker containers.

Key changes:

  • Enhanced migration documentation with additional options for running scripts inside containers and fixing orphaned LSM data
  • Updated Python migration script to use environment variables for configuration, enabling execution within Docker containers
  • Switched from offset-based to cursor-based pagination to handle large collections more reliably
  • Improved formatting consistency throughout the documentation (standardized colon placement in bold labels)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
en/self-host/troubleshooting/weaviate-v4-migration.mdx Comprehensive documentation updates including new container-based migration options, formatting standardization (colons after bold text), additional troubleshooting section for Dify 1.11.0+ permission issues, and improved step-by-step instructions with both host and container execution options
assets/migrate_weaviate_collections.py Refactored to use environment variables for Weaviate connection configuration, implemented cursor-based pagination for large collection handling, increased batch size from 100 to 1000, added detailed attribution and change notes in docstring, and fixed empty collection migration handling
Comments suppressed due to low confidence (1)

assets/migrate_weaviate_collections.py:373

  • Variable migrated_count is not used.
                migrated_count = migrate_collection_data(

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if success and migrated_count > 0:

if success:

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The condition on line 380 was changed from checking "success and migrated_count > 0" to just "success". While the commit message mentions fixing an issue with empty collections, this change means the replace_old_collection function will now be called even for empty collections. However, the replace_old_collection function doesn't handle the edge case where there are zero objects to migrate, which could lead to unnecessary operations and confusing output messages claiming "0 objects" were successfully migrated.

Copilot uses AI. Check for mistakes.
WEAVIATE_ENDPOINT = os.getenv("WEAVIATE_ENDPOINT", "http://weaviate:8080")
WEAVIATE_GRPC_ENDPOINT = os.getenv("WEAVIATE_GRPC_ENDPOINT", "grpc://weaviate:50051")
WEAVIATE_API_KEY = os.getenv("WEAVIATE_API_KEY", "WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih")
BATCH_SIZE = 1000

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The BATCH_SIZE has been increased from 100 to 1000, which is a 10x increase. While this can improve performance for large datasets, it may cause memory issues or timeout problems for systems with limited resources or slow network connections. Consider documenting this change in the script's docstring or adding it as a configurable environment variable so users can adjust it based on their system capabilities.

Copilot uses AI. Check for mistakes.
WEAVIATE_API_KEY = "WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih"
BATCH_SIZE = 100
WEAVIATE_ENDPOINT = os.getenv("WEAVIATE_ENDPOINT", "http://weaviate:8080")
WEAVIATE_GRPC_ENDPOINT = os.getenv("WEAVIATE_GRPC_ENDPOINT", "grpc://weaviate:50051")

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The default value for WEAVIATE_GRPC_ENDPOINT includes the protocol prefix "grpc://" which contradicts the documentation. According to the migration guide (lines 495-522 in the .mdx file), the WEAVIATE_GRPC_ENDPOINT should NOT include protocol prefixes and should only use the format "hostname:port". This default should be "weaviate:50051" instead of "grpc://weaviate:50051".

Suggested change
WEAVIATE_GRPC_ENDPOINT = os.getenv("WEAVIATE_GRPC_ENDPOINT", "grpc://weaviate:50051")
WEAVIATE_GRPC_ENDPOINT = os.getenv("WEAVIATE_GRPC_ENDPOINT", "weaviate:50051")

Copilot uses AI. Check for mistakes.
BATCH_SIZE = 1000
WEAVIATE_HOST = WEAVIATE_ENDPOINT.split("//")[-1].split(":")[0]
WEAVIATE_PORT = int(WEAVIATE_ENDPOINT.split(":")[-1])
WEAVIATE_GRPC_PORT = int(WEAVIATE_GRPC_ENDPOINT.split(":")[-1])

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The parsing logic on line 33 will fail when WEAVIATE_GRPC_ENDPOINT contains the "grpc://" protocol prefix. Since the code splits by ":" and takes the last element, it would try to parse "//weaviate:50051" as an integer, causing a ValueError. The parsing should handle the potential protocol prefix, or the default value should be corrected to not include it.

Copilot uses AI. Check for mistakes.
WEAVIATE_GRPC_ENDPOINT = os.getenv("WEAVIATE_GRPC_ENDPOINT", "grpc://weaviate:50051")
WEAVIATE_API_KEY = os.getenv("WEAVIATE_API_KEY", "WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih")
BATCH_SIZE = 1000
WEAVIATE_HOST = WEAVIATE_ENDPOINT.split("//")[-1].split(":")[0]

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The protocol prefix parsing on line 31 assumes the format will always be "protocol://host:port", but if no protocol is provided (as recommended in the documentation), splitting by "//" and taking index -1 will just return the original string. This works correctly for the documented format, but the variable name suggests it should only contain the host. Consider renaming to WEAVIATE_HOST_WITH_PORT or parsing more explicitly to handle both cases.

Copilot uses AI. Check for mistakes.
```

2. **Run the [migration script](https://github.com/langgenius/dify-docs/blob/main/assets/migrate_weaviate_collections.py):**
2. **Run the [migration script](https://github.com/langgenius/dify-docs/blob/main/assets/migrate_weaviate_collections.py)** either locally or inside the Worker container.\

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The backslash at the end of this line creates an unintended line continuation in Markdown. This will cause the two options to render incorrectly. Remove the trailing backslash to properly separate the option descriptions.

Suggested change
2. **Run the [migration script](https://github.com/langgenius/dify-docs/blob/main/assets/migrate_weaviate_collections.py)** either locally or inside the Worker container.\
2. **Run the [migration script](https://github.com/langgenius/dify-docs/blob/main/assets/migrate_weaviate_collections.py)** either locally or inside the Worker container.

Copilot uses AI. Check for mistakes.
#### Step B2: Run the Schema Migration

Follow the same commands as [Step A5](#step-a5:-migrate-the-schema). Create the virtualenv if needed, install `weaviate-client` 4.x, run `migrate_weaviate_collections.py`, then restart `api`, `worker`, and `worker_beat`.
Follow the same commands as [Step A5](#step-a5%3A-migrate-the-schema). You can run the script locally or inside the Worker container:

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The anchor link format should use lowercase and hyphens for URL encoding. The correct format should be "#step-a5-migrate-the-schema" instead of "#step-a5%3A-migrate-the-schema". While the percent-encoded colon (%3A) may work, using the standard hyphen format is more consistent with common Markdown conventions.

Suggested change
Follow the same commands as [Step A5](#step-a5%3A-migrate-the-schema). You can run the script locally or inside the Worker container:
Follow the same commands as [Step A5](#step-a5-migrate-the-schema). You can run the script locally or inside the Worker container:

Copilot uses AI. Check for mistakes.

This branch was successfully deployed

1 active deployment
staging — dca5a24b Deployed Dec 16, 2025 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants