Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 如何更改AWS Glue crawler使用boto3创建的表的名称_Amazon Web Services_Amazon S3_Aws Sdk_Boto3_Aws Glue Data Catalog - Fatal编程技术网

Amazon web services 如何更改AWS Glue crawler使用boto3创建的表的名称

Amazon web services 如何更改AWS Glue crawler使用boto3创建的表的名称,amazon-web-services,amazon-s3,aws-sdk,boto3,aws-glue-data-catalog,Amazon Web Services,Amazon S3,Aws Sdk,Boto3,Aws Glue Data Catalog,我正在尝试更改AWS爬虫使用boto3创建的表名。代码如下: 导入boto3 数据库\u name=“eventbus” 表\u name=“注册\u用户\u注册\u取消\u 1\u 0\u 0” 新建\u表\u name=“注册\u用户\u注册\u取消” client=bot3.client(“glue”,region_name='us-west-1') response=client.get\u table(DatabaseName=database\u name,name=table\u

我正在尝试更改AWS爬虫使用boto3创建的表名。代码如下:

导入boto3
数据库\u name=“eventbus”
表\u name=“注册\u用户\u注册\u取消\u 1\u 0\u 0”
新建\u表\u name=“注册\u用户\u注册\u取消”
client=bot3.client(“glue”,region_name='us-west-1')
response=client.get\u table(DatabaseName=database\u name,name=table\u name)
表输入=响应[“表”]
表格输入[“名称”]=新表格名称
打印(表格输入)
打印(表格输入[“名称”])
表_input.pop(“CreatedBy”)
表_input.pop(“CreateTime”)
表\u input.pop(“更新时间”)
client.create_table(DatabaseName=database_name,TableInput=table_input)
获取以下错误:

botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in TableInput: "DatabaseName", must be one of: Name, Description, Owner, LastAccessTime, LastAnalyzedTime, Retention, StorageDescriptor, PartitionKeys, ViewOriginalText, ViewExpandedText, TableType, Parameters
Unknown parameter in TableInput: "IsRegisteredWithLakeFormation", must be one of: Name, Description, Owner, LastAccessTime, LastAnalyzedTime, Retention, StorageDescriptor, PartitionKeys, ViewOriginalText, ViewExpandedText, TableType, Parameters

你能告诉我这个问题的解决方案吗?谢谢

要摆脱
client.create\u table
抛出的
botocore.exceptions.ParamValidationError
,需要以与
CreatedBy
类似的方式从
table\u input
中删除相应的项

。。。
表_input.pop(“数据库名称”)
表_input.pop(“IsRegisteredWithLakFormation”)
client.create_table(DatabaseName=database_name,TableInput=table_input)
若您的原始表中有要添加到新表中的分区,则需要使用类似的方法。首先,您需要检索有关这些分区的元信息,其中包括:

注意:根据您选择的参数,您需要传递不同的参数。在单个请求中可以检索的分区数量有限制。如果我没记错的话,大概是200左右。除此之外,您可能需要使用列出所有可用分区。当您的表有超过400个分区时就是这种情况

总的来说,我建议:

paginator=client.get\u paginator('get\u partitions'))
响应=paginator.paginate(
DatabaseName=数据库名称,
TableName=表名称
)
分区=列表()
对于响应页面:
对于第[‘分区’]页中的p:
partitions.append(p.copy())
#这里您需要从中删除“DatabaseName”、“TableName”、“CreationTime”
#每个分区
现在,您可以使用以下任一方法将检索到的分区添加到新表中:


我建议使用
batch\u create\u partition()
,但是,它限制了一次请求可以创建多少个分区。

我能够解决这些参数问题,并更改了爬网程序名称。但现有的爬虫程序中有AWS爬虫附加的分区。新更改的爬网程序名称未附加到分区。如何在已更改的爬网程序中附加分区?谢谢