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

为何BatchRequest无法识别数据源中定义的group_names?

问题原因与解决方案

核心差异:两者的过滤逻辑完全不同

  • BatchDefinition的batch_identifiers:直接对接Great Expectations从S3路径中提取的元数据(即你在default_regex里定义的group_names)。这些字段是连接器解析路径后生成的内部元数据,BatchDefinition会基于这些已提取的批次信息做过滤,所以能直接识别group_names里的字段。
  • BatchRequest的data_connector_query:本质是向S3发起的原生查询请求,它只支持S3本身能识别的查询参数(比如prefix、bucket),完全不知道你在default_regex里定义的group_names是什么。直接用group_names里的字段写查询,S3无法解析,自然会触发BatchFilterError。

正确使用方式

场景1:用BatchRequest过滤(针对S3原生路径)

如果一定要用BatchRequest,需要把group_names对应的条件转换成S3能识别的路径前缀。假设你的default_regex配置如下:

"default_regex": {
    "pattern": "s3://my-bucket/raw_data/(?P<year>\\d{4})/(?P<month>\\d{2})/.*\\.parquet",
    "group_names": ["year", "month"]
}

要筛选year=2024、month=06的批次,BatchRequest应写成:

batch_request = BatchRequest(
    datasource_name="s3_datasource",
    data_asset_name="raw_data_asset",
    data_connector_query={"prefix": "raw_data/2024/06/"}
)

场景2:用BatchDefinition过滤(针对提取的元数据)

如果想直接用group_names里的字段过滤,继续用BatchDefinition的batch_identifiers即可,这是它的设计初衷:

batch_definition = BatchDefinition(
    batch_identifiers={"year": "2024", "month": "06"}
)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 18:31:02