Redash 连接中国区 Azure Data Explorer

       目前 Redash 源代码中 Azure Data Explorer 链接器中采用的是 Python 编写,使用的是 azure-kusto-data==0.0.35 SDK 包,该 SDK 包默认只支持 Azure Global 的连接。该问题已经在 0.0.37 版本中进行了修正,可参见修正说明。可以通过设置 AadAuthorityUri 环境变量来指定 Azure Cloud 环境。用户可以在 Redash 中进行如下修改来构建自己的 Redash Image 来支持 Azure China Azure Data Explorer:

1. 在 Redash 源代码目录下修正 requirements_all_ds.txt 依赖包定义,将 azure-kusto-data==0.0.35 更改为 azure-kusto-data==0.0.37

2. 修改 Redash 源代码目录下 docker-compose.yml 文件,将 skip_frontend_build: "true" 更改为 skip_frontend_build: ""

3. 修改 ./redash/query_runner/azure_kusto.py 中如下部分代码

try:
    from azure.kusto.data.request import KustoClient, KustoConnectionStringBuilder, ClientRequestProperties
    from azure.kusto.data.exceptions import KustoServiceError
    import os

    os.environ["AadAuthorityUri"] = "https://login.partner.microsoftonline.cn/"
    enabled = True

4. 参考 Redash 启动脚本进行部署

posted @ 2021-02-07 16:04  wekang  阅读(143)  评论(0编辑  收藏  举报