feat(datasource): 支持单实例多 Schema 管理,及使用 schema.table 实现跨域查询与向量外键存储#479
Open
goodfylink wants to merge 1 commit intospring-ai-alibaba:mainfrom
Open
feat(datasource): 支持单实例多 Schema 管理,及使用 schema.table 实现跨域查询与向量外键存储#479goodfylink wants to merge 1 commit intospring-ai-alibaba:mainfrom
goodfylink wants to merge 1 commit intospring-ai-alibaba:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe what this PR does / why we need it
支持在同一物理实例下为一个智能体激活并配置多个 Schema(或 Database),并实现了跨 Schema 的查询与关联。统一使用 schema.table 作为逻辑外键与向量存储的唯一标识。
Does this pull request fix one issue?
Describe how you did it
1.后端新增 /{id}/all-tables 接口返回已激活数据源的合规表库;前端外键配置在目标表下拉列表中调用该全集接口,实现跨 Schema 的表选项加载。
2.在 SchemaService 的二次补全流程中增加对跨库虚拟外键实体的提取和解析;全局统一使用 schema.table 作为表和特征向量的主键认知标准。
3.将 AgentDatasourceMapper.selectActiveDatasourceIdByAgentId 接口重构为返回 List。将 SchemaRecallNode
的处理逻辑改为循环遍历并合并(addAll)所有活跃数据源的文档信息。
4. AgentDatasourceServiceImpl.toggleDatasourceForAgent 中校验,若检测到 Host/Port/Type 与已有活跃数据源不一致的连接,则抛出异常阻断,避免 JDBC 本地跨网段报错。
5. datasource表中新增schemas字段,对于mysql来讲database==schema,但pg和oracle中一个database中含有多个schema,我们将多个schema合并成schema1,schema2形式存入数据库中,后续按照,进行分割
Describe how to verify it
Special notes for reviews
由于当前单机 JDBC 暂不支持诸如数据湖级别的跨主机异构下推,通过比对 Host/Port 实施前置阻断是防止执行器崩溃的必要规避方案。同时需注意 schema.table 格式在所有历史存量数据访问中的兼容性。