feat(datasource): 支持从扩展配置中读取数据库 schema 参数

This commit is contained in:
tanwei
2025-07-09 11:25:54 +08:00
parent 732d6c854d
commit 903a159fa7

View File

@@ -200,8 +200,18 @@ class ConnectorManager(BaseComponent):
db_port = db_config.get("db_port")
db_user = db_config.get("db_user")
db_pwd = db_config.get("db_pwd")
try:
ext_config = db_config.get("ext_config")
db_json = json.loads(ext_config)
schema = db_json.get("schema", None)
except json.JSONDecodeError:
# 处理解码失败的情况
db_json = {}
schema = None
return connect_instance.from_uri_db( # type: ignore
host=db_host, port=db_port, user=db_user, pwd=db_pwd, db_name=db_name
host=db_host, port=db_port, user=db_user, pwd=db_pwd, db_name=db_name,
schema=schema,
)
def _create_parameters(