【发布时间】:2018-09-13 17:25:35
【问题描述】:
我一直在尝试使用 python API 在我们的数据目录中创建一个表。按照为 API 发布的文档 here 和 here。我能理解这是怎么回事。不过,我需要在创建表时不明白如何声明字段结构,因为当我查看表here 的存储定义时,有任何关于我应该如何为我的表定义这种类型的列的解释。此外。我没有看到被覆盖的表格的分类属性。也许在属性上?我在这个示例中使用了 boto3 documentation
代码:
import boto3
client = boto3.client(service_name='glue', region_name='us-east-1')
response = client.create_table(
DatabaseName='dbname',
TableInput={
'Name': 'tbname',
'Description': 'tb description',
'Owner': 'I'm',
'StorageDescriptor': {
'Columns': [
{ 'Name': 'agents', 'Type': 'struct','Comment': 'from deserializer' },
{ 'Name': 'conference_sid', 'Type': 'string','Comment': 'from deserializer' },
{ 'Name': 'call_sid', 'Type': 'string','Comment': 'from deserializer' }
] ,
'Location': 's3://bucket/location/',
'InputFormat': 'org.apache.hadoop.mapred.TextInputFormat',
'OutputFormat': 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat',
'Compressed': False,
'SerdeInfo': { 'SerializationLibrary': 'org.openx.data.jsonserde.JsonSerDe'}
},
'TableType' : "EXTERNAL_TABLE"} )
【问题讨论】:
标签: amazon-web-services aws-sdk boto3 aws-glue