AWSGlue爬虫仅爬取列名而不是数据的方法?
创始人
2024-09-25 16:01:21
0

AWS Glue爬虫默认情况下只爬取列名而不是数据。要使爬虫爬取数据,需要在爬虫的配置中添加“--update-all-ux”参数。例如,如果你使用Python编写的AWS Glue爬虫,可以在您的脚本中添加以下代码片段:

import sys
from awsglue.utils import getResolvedOptions

args = getResolvedOptions(sys.argv, ['JOB_NAME'])

glueContext = GlueContext(SparkContext.getOrCreate())

crawler = glueContext.create_dynamic_frame_from_options(
    connection_options={
        'path': 's3://example-bucket/path/to/data'
    },
    format='csv',
    transformation_ctx='crawler'
)

crawler.toDF().show()

# Add the following line to enable crawling of data
crawler_options = crawler.toDF().options

crawler_options['updateSchemaInCatalog'] = 'true'
crawler_options['optionFiles'] = '/tmp/options.json'
crawler.toDF(**crawler_options).show()

在此示例中,爬虫从S3存储桶中加载CSV格式的数据,并使用show()方法显示数据。添加crawler_options变量并将'updateSchemaInCatalog'选项设置为'true'来启用数据爬虫。原理是在AWS Glue数仓中更新爬取到的数据结构,以便进一步使用。

相关内容

热门资讯

第十分钟辅助!wejoker辅... 第十分钟辅助!wejoker辅助器怎么卖,wepoker免费透视脚本,窍门教程(有挂方式)1、进入游...
十分钟辅助!wepoker-h... 十分钟辅助!wepoker-h5下载,pokernow辅助控制,绝活教程(有挂实锤)1、点击下载安装...
5分钟辅助!aapoker辅助... 5分钟辅助!aapoker辅助器怎么用,wepoker模拟器哪个好用,模板教程(有挂辅助)wepok...
八分钟辅助!wpk官网下载链接... 八分钟辅助!wpk官网下载链接,wpk透视怎么安装,教程书教程(有挂分享)该软件可以轻松地帮助玩家将...
9分钟辅助!wepoker怎么... 9分钟辅助!wepoker怎么买辅助,wepoker安装教程,课程教程(有挂方略)1、wepoker...
第七分钟辅助!hh poker... 第七分钟辅助!hh poker插件下载,wepoker科技辅助器,教程书教程(有挂教程)wepoke...
三分钟辅助!hhpoker脚本... 三分钟辅助!hhpoker脚本下载,hhpoker辅助器,举措教程(有挂教程)三分钟辅助!hhpok...
第8分钟辅助!hhpoker的... 第8分钟辅助!hhpoker的辅助是真的吗,wepoker祈福有用吗,讲义教程(有挂解密)1、第8分...
6分钟辅助!hhpoker是真... 6分钟辅助!hhpoker是真的假的,hhpoker真的有透视吗,演示教程(真是有挂)1、每一步都需...
第七分钟辅助!we poker... 第七分钟辅助!we poker插件,we poker免费辅助器,手筋教程(有挂方式)暗藏猫腻,小编详...