You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让Great Expectations支持含空格的文件夹名称?

解决Great Expectations支持含空格文件夹名称的问题

问题场景

使用Great Expectations验证路径含空格的JSON文件时,出现文件未找到错误:

java.io.FileNotFoundException: File file:/databricks/great_expectations/uncommitted/data_docs/local_site/validations/folder%20name%20with%20problem/20230901-212503-my-run-name-template/20231017T212503.475820Z/8137d3b18ba77347392992ed75eef9a1.html does not exist

核心原因是Great Expectations生成数据文档时,自动将路径中的空格URL编码为%20,但实际文件系统中文件夹名称保留原始空格,导致路径不匹配。

可行解决方案

1. 修改配置禁用URL编码

编辑Great Expectations的great_expectations.yml配置文件,找到data_docs_sites下的本地站点配置,添加url_encode: false参数:

data_docs_sites:
  local_site:
    class_name: SiteBuilder
    show_how_to_buttons: true
    store_backend:
      class_name: TupleFilesystemStoreBackend
      base_directory: uncommitted/data_docs/local_site/
      url_encode: false  # 新增此参数,禁止对路径空格进行URL编码
    site_index_builder:
      class_name: DefaultSiteIndexBuilder

保存配置后重新执行验证,数据文档生成时会保留路径中的原始空格,避免编码导致的路径不匹配。

2. 创建符号链接绕过空格问题

如果暂时无法修改配置,可通过创建符号链接替代原含空格的路径:

# 为目标文件夹创建无空格的符号链接
ln -s "/mnt/folder1/folder2/folder3/folder name with problem" /mnt/folder1/folder2/folder3/folder_no_space

之后在Great Expectations的数据源配置中使用符号链接的路径,无需修改原文件夹名称即可正常执行验证。

3. 升级Great Expectations版本

部分旧版本存在路径空格编码的bug,升级到最新稳定版(如v0.17及以上)可能已修复该问题,执行升级命令:

pip install --upgrade great-expectations

升级后重新测试验证流程。


内容的提问来源于stack exchange,提问作者Pysparker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 13:02:05