gpt4 book ai didi

glob - 在 AWS Glue Crawler 中编写 glob 排除字符串

转载 作者:行者123 更新时间:2023-12-05 06:35:38 26 4
gpt4 key购买 nike

我正在尝试在 AWS Glue 中创建爬虫。我的分析程序以 5 分钟的批处理在 S3 中删除一堆文件,其中包含几个不同的分区。它实质上创建了一个像这样的文件夹结构:

  1. 分析
    • 2018-03-27T00:00:00.000Z
      • session
      • 搜索
      • DirectURL
      • 页面数据
    • 2018-03-27T00:00:05.000Z
      • session
      • 搜索
      • DirectURL
      • 页面数据

我真的很想创建一个包含字符串,但您似乎只能在 AWS Glue Crawler 界面中创建一个排除字符串。我真的只想抓取 Session 文件夹中的文件。

如果我想获取除 Session 文件夹之外的所有内容,我可以这样做:

{ session }/**

我本来想做相反的事情,我只需要这样做,但它不起作用:

{! session }/**

任何想法/帮助?

谢谢!

最佳答案

具有排除行为可能根本不是最佳选择,因为您失去了对爬虫将拾取的内容的控制。使用包含语句可能会更好。唯一的排除支持是使用!在 [] 内,如文档中所述,但这只会处理单个字符:

Brackets [ ] create a bracket expression that matches a single character of a name component out of a set of characters. For example, [abc] matches a, b, or c. The hyphen (-) can be used to specify a range, so [a-z] specifies a range that matches from a through z (inclusive). These forms can be mixed, so [abce-g] matches a, b, c, e, f, or g. If the character after the bracket ([) is an exclamation point (!), the bracket expression is negated. For example, [!a-c] matches any character except a, b, or c.

查看文档:https://docs.aws.amazon.com/glue/latest/dg/add-crawler.html

关于glob - 在 AWS Glue Crawler 中编写 glob 排除字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49661788/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com