使用胶水API更新AWS胶水目录表

时间:2020-07-28 09:56:33

标签: amazon-web-services aws-lambda aws-glue aws-glue-data-catalog

我正在尝试使用create table gum api创建数据目录,因此绕过了搜寻器的需求,因为架构每次都是相同的。

我能够创建数据目录,现在只要有任何更新的csv文件出现在s3中,表就会更新(就像我在运行athena查询时显示更新的表一样)。

但是我的问题是,在某些情况下,我只会得到增量(即仅更改的数据而不是完整的数据),现在只有增量来了,而当我运行雅典娜时在表格上手动查询,它仅显示deltas,并且数据未与早期的完整数据合并。 因此,我不了解如何仅更新增量,然后将其合并到原始数据目录中。

甚至可以用aws胶吗?

下面是我当前的代码:-

import boto3
import json

client=boto3.client('glue')
def lambda_handler(event, context):

response = client.create_table(
DatabaseName = 'sample',
TableInput = {

'Name': 'lawyertable4',
'Description': 'Table created with boto3 API',
'StorageDescriptor': {
    'Columns': [{
            'Name': 'id',
            'Type': 'bigint',
        
        },
        {
            'Name': 'username',
            'Type': 'string',
            
        },
        {
            'Name': 'time_stamp',
            'Type': 'string',
        
        },
        
    ],
    'Location': 's3://location/sample/',
    'InputFormat': 'org.apache.hadoop.mapred.TextInputFormat',
    'OutputFormat': 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat',
    'Compressed': False,
    'SerdeInfo': {
        'SerializationLibrary': 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe',
        'Parameters': {
                'field.delim': ',',
                'skip.header.line.count':'1'
                
            }
    }
},
 }
 )

0 个答案:

没有答案