本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
创建受管表
受管控的表格在中提供了多种高级功能Amazon Lake Formation,包括对 ACID(原子、一致、隔离和持久)事务的支持、自动数据压缩和时间旅行查询。受管表仅支持存储在 Amazon S3 中的数据。
您可以使用创建受管控的表Amazon Lake Formation控制台Amazon GlueAPI,或Amazon Command Line Interface(Amazon CLI)。
有关受管表的更多信息Lake Formation 中的受管桌子.
- Console
-
-
确保满足创建受管表的所有先决条件。有关更多信息,请参阅 受管表的先决条件。
-
通过 https://console.aws.amazon.com/lakeformation/
中打开 Lake Formation 控制台。 以数据湖管理员或拥有 Lake Formation 的用户身份登录
CREATE_TABLE目标数据库的权限以及谁拥有glue:CreateTableAmazon Identity and Access Management(IAM) 权限。 -
在导航窗格的 Data catalog (数据目录) 中,请选择 Tables (表)。然后选择 。创建表.
-
填写创建表表单,并指定以下内容:
-
UNDER数据管理和安全,启用启用受管控的数据访问和管理.
-
UNDER数据存储,指定一个向 Lake Formation 注册的 Amazon S3 位置。
-
-
- Amazon Glue CLI/SDK
-
-
确保满足创建受管表的所有先决条件。有关更多信息,请参阅 受管表的先决条件。
-
在
TableInput你提供给的结构CreateTable操作TableType=GOVERNED,然后指定一个向 Lake Formation 注册的 Amazon S3 位置。有关更多信息,请参阅TableInput 结构中的Amazon Glue开发人员指南.
以下是 Python 中的一个示例:
aws glue create-table --database-name default --table-input '{ "Name":"product_table", "Description":"product table for manual entries.", "StorageDescriptor":{ "Columns":[ { "Name":"product_id", "Type":"string" }, { "Name":"product_name", "Type":"string" } ], "Location":"s3://my_bucket_name/dbs/product_table/", "InputFormat":"org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat", "OutputFormat":"org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat", "Compressed":false, "NumberOfBuckets":0, "SerdeInfo":{ "SerializationLibrary":"org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe", "Parameters":{ } }, "SortColumns":[ ], "StoredAsSubDirectories":false }, "TableType":"GOVERNED", "Parameters":{ "classification":"parquet", "lakeformation.aso.status":"true" } }' -
- Athena
-
有关使用 Athena 创建受管表的说明,请参阅开始使用中的Amazon Athena 用户指南.
Following is an example:
CREATE TABLE productsdb.product_table( product_id string, product_name string) STORED AS PARQUET LOCATION 's3://DOC-EXAMPLE-BUCKET/governed-folder' TBLPROPERTIES ( 'table_type'='LAKEFORMATION_GOVERNED', 'classification'='parquet' )