Skip to content

Conversation

@wangype
Copy link

@wangype wangype commented Sep 18, 2025

Description

AlibabaCloud RDS MySQL recently released native vector capabilities, See the release notes here. enabling efficient storage and similarity search of high-dimensional vectors directly within MySQL databases. This commit integrates this new vector feature into the mem0 project to provide seamless support for AlibabaCloud MySQL Vector stores.

The implementation includes:

  • MySQLVector class: A complete vector store implementation for AlibabaCloud MySQL with support for vector operations (insert, search, update, delete, etc.)
  • MySQLVectorConfig: Configuration class with comprehensive validation for connection parameters, SSL settings, and vector-specific options
  • Factory integration: Updated VectorStoreFactory and configs to support the new "aliyun_mysql" provider
  • Comprehensive test suite: Added extensive unit tests with mocked MySQL connections to ensure reliability
  • Dependency management: Added mysql-connector-python>=9.3.0 to project dependencies

The implementation leverages AlibabaCloud RDS MySQL's native vector capabilities including HNSW vector indexing, VEC_FromText functions, and VEC_DISTANCE operations. It supports advanced features like SSL connections, connection string parsing, and both euclidean and cosine distance functions, making it a robust choice for production vector storage needs.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • Unit Test
  • Test Script (please provide)

Test Details:

  • Created comprehensive unit tests in tests/vector_stores/test_aliyun_mysql.py (244 lines)
  • Tests cover all major functionality: initialization, CRUD operations, search with filters, collection management
  • Uses mocked MySQL connections to ensure tests run without requiring actual database setup
  • Tests validate both individual connection parameters and connection string parsing
  • Includes error handling tests for import failures and connection issues

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

- Adds the MariaDBConfig configuration class and MariaDB vector store implementation
- Updates factory.py and configs.py to support MariaDB
- Adds MariaDB-related test cases
- Adds the mysql-connector-python dependency to pyproject.toml
- Adds the MariaDBConfig configuration class and MariaDB vector store implementation
- Updates factory.py and configs.py to support MariaDB
- Adds MariaDB-related test cases
- Adds the mysql-connector-python dependency to pyproject.toml
- Adds the MySQLVectorConfig configuration class and MySQL vector store implementation
- Updates factory.py and configs.py to support MariaDB
- Adds MySQLVector-related test cases
- Adds the mysql-connector-python dependency to pyproject.toml
@wangype
Copy link
Author

wangype commented Sep 21, 2025

@parshvadaftari Could you please review this PR? We rely on this feature to publish our own product capability description.

@parshvadaftari
Copy link
Contributor

parshvadaftari commented Sep 21, 2025

@wangype Hey this is on the roadmap but this will be integrated in the future releases of 1.0.0.

- Changed the file and class names related to aliyun_mysql to alibabacloud_mysql
- Updated related import paths and configuration names
- Retained the original functionality and logic
@wangype wangype changed the title Feature integrate aliyun mysql vector Feature integrate alibabacloud mysql vector Sep 22, 2025
@wangype
Copy link
Author

wangype commented Oct 18, 2025

@parshvadaftari Hi,I noticed that your version 1.0.0 has been released, which adds the integration of Azure MySQL.I would like to integrate Alibaba Cloud MySQL in this PR to implement vector storage. And some of our customers plan to use mem0 to use Alibaba Cloud's MySQL

…ter application. - Removed unused imports of struct

- Adjusted the search method call to remove the variable that receives the result
- Retained the assertion check in mock_cursor.execute to verify that the filter is applied in the SQL query
…ter application. - Removed unused imports of struct

- Adjusted the search method call to remove the variable that receives the result
- Retained the assertion check in mock_cursor.execute to verify that the filter is applied in the SQL query
…abase

- Adds a guide to installing and using the AlibabaCloud MySQL database
- Provides sample code for various connection methods, including standard connections, SSL connections, and connection string methods
- Provides a detailed list of configuration parameters and their default values
- Introduces database features, such as native vector support, HNSW indexes, and various distance functions
- Explains prerequisites and connection string formats
- Explains distance functions and performance tuning parameters
- Describes error handling mechanisms
…abase

- Adds a guide to installing and using the AlibabaCloud MySQL database
- Provides sample code for various connection methods, including standard connections, SSL connections, and connection string methods
- Provides a detailed list of configuration parameters and their default values
- Introduces database features, such as native vector support, HNSW indexes, and various distance functions
- Explains prerequisites and connection string formats
- Explains distance functions and performance tuning parameters
- Describes error handling mechanisms
@wangype
Copy link
Author

wangype commented Oct 21, 2025

@parshvadaftari Could you please review the code? our customers are waiting to use mem0 to access RDS MySQL.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants