我们试图在现有的雅典娜表上运行ALTER DDL语句,这些表以前是通过常规Java StartQueryExecutionRequest创建的,而没有保存版本,因此我们不会遇到TABLE_VERSION Glue限制(请参阅下面的Glue限制链接)。我们已经运行了一段时间的应用程序,不知道以前的版本都被存储了,而且我们在AWS帐户中遇到了一个严格的限制。具体来说,我们正在使用AWS版本2(如果这很重要的话,2.10.66)以编程方式添加分区和更新avro模式。
看起来,我们需要启用一个名为SkipArchive的选项,使用Glue UpdateTable请求禁用以前版本的功能。然而,AWS文档虽然很广泛,但并没有明确的示例,我无法理解如何简单地运行一个基本的UpdateTableRequest。
任何人都有我们可以查看的示例/链接,详细信息是如何通过Java运行这个命令的?
列出Glue - https://docs.aws.amazon.com/general/latest/gr/glue.html中每个表和每个帐户表版本的限制
https://docs.aws.amazon.com/glue/latest/webapi/API_UpdateTable.html#API_UpdateTable_RequestSyntax
发布于 2022-10-11 12:40:52
答案可能有点晚,但这里有一个update_table请求示例供参考:
import boto3
glue=boto3.client('glue')
#List A Specific Table from Glue Catalog
""" 
paginator = glue.get_paginator('get_table_versions')
response_iterator  = paginator.paginate(DatabaseName='etl_framework',TableName='etl_master_withskiparchive')
for page in response_iterator:
    print(page)
"""
#Sample glue.create_table method
#glue.create_table(DatabaseName='etl_framework',TableInput={'Name':'etl_master_20221013','StorageDescriptor':{'Columns':[{'Name':'id','Type':'bigint','Comment':''},{'Name':'groupid','Type':'bigint','Comment':''},{'Name':'tableName','Type':'string','Comment':''},{'Name':'schemaName','Type':'string','Comment':''},{'Name':'source','Type':'string','Comment':''},{'Name':'loadType','Type':'string','Comment':''},{'Name':'incrementalcolumn','Type':'string','Comment':''},{'Name':'active','Type':'bigint','Comment':''},{'Name':'createdate','Type':'date','Comment':''},{'Name':'startdatetime','Type':'timestamp','Comment':''},{'Name':'enddatetime','Type':'timestamp','Comment':''},{'Name':'sql_query','Type':'string','Comment':''},{'Name':'partition_column','Type':'string','Comment':''},{'Name':'priority','Type':'bigint','Comment':''},{'Name':'pk_columns','Type':'string','Comment':''},{'Name':'merge_query','Type':'string','Comment':''},{'Name':'bucket_Name','Type':'string','Comment':''},{'Name':'offset_value','Type':'bigint','Comment':''},{'Name':'audit','Type':'bigint','Comment':''}],'Location':'s3://pb-4-0-datalake-raw-layer/iceberg/etl_master_20221013','InputFormat':'','OutputFormat':'','Compressed':False,'NumberOfBuckets':0,'SerdeInfo':{},'BucketColumns':[],'SortColumns':[],'SkewedInfo':{},'StoredAsSubDirectories':False},'Parameters':{'metadata_location':'s3://pb-4-0-datalake-raw-layer/iceberg/etl_master_20221013/metadata/','table_type':'ICEBERG'},'TableType': 'EXTERNAL_TABLE'})
#Sample glue.update_table method
glue.update_table(DatabaseName='etl_framework',TableInput={'Name':'etl_master_20221011','StorageDescriptor':{'Columns':[{'Name': 'id', 'Type': 'bigint', 'Parameters': {'iceberg.field.current': 'true', 'iceberg.field.id': '1', 'iceberg.field.optional': 'true'}}],'Location':'s3://pb-4-0-datalake-raw-layer/iceberg/etl_master_20221010','InputFormat':'','OutputFormat':'','Compressed':False,'NumberOfBuckets':0,'SerdeInfo':{},'BucketColumns':[],'SortColumns':[],'SkewedInfo':{},'StoredAsSubDirectories':False},'Parameters':{'metadata_location':'s3://pb-4-0-datalake-raw-layer/iceberg/etl_master_20221012/metadata/','table_type':'ICEBERG'},'TableType': 'EXTERNAL_TABLE'},SkipArchive=True)https://stackoverflow.com/questions/60310593
复制相似问题