如何在 Amazon Athena 中从其他 table 创建分区的 table?
How to create partitioned table from other tables in Amazon Athena?
我想从 Amazon Athena 中现有的 table 创建一个 table。现有的 table 在 partition_0、partition_1 和 partition_2(所有字符串)上进行了分区,我希望这个分区能够继续下去。这是我的代码:
CREATE TABLE IF NOT EXISTS newTable
AS
Select x, partition_0, partition_1, partition_2
FROM existingTable T
PARTITIONED BY (partition_0 string, partition_1 string, partition_2 string)
尝试 运行 这让我在 FROM 行出现错误,说 "mismatched input 'by'. expecting: '(', ',',"
... Status code: 400; error code:invalidrequestexception
不确定我在这里缺少什么语法。
这是创建新表的语法:
CREATE TABLE new_table
WITH (
format = 'parquet',
external_location = 's3://example-bucket/output/',
partitioned_by = ARRAY['partition_0', 'partition_1', 'partition_2'])
AS SELECT * FROM existing_table
有关更多示例,请参阅文档:https://docs.aws.amazon.com/athena/latest/ug/ctas-examples.html#ctas-example-partitioned
我想从 Amazon Athena 中现有的 table 创建一个 table。现有的 table 在 partition_0、partition_1 和 partition_2(所有字符串)上进行了分区,我希望这个分区能够继续下去。这是我的代码:
CREATE TABLE IF NOT EXISTS newTable
AS
Select x, partition_0, partition_1, partition_2
FROM existingTable T
PARTITIONED BY (partition_0 string, partition_1 string, partition_2 string)
尝试 运行 这让我在 FROM 行出现错误,说 "mismatched input 'by'. expecting: '(', ',',"
... Status code: 400; error code:invalidrequestexception
不确定我在这里缺少什么语法。
这是创建新表的语法:
CREATE TABLE new_table
WITH (
format = 'parquet',
external_location = 's3://example-bucket/output/',
partitioned_by = ARRAY['partition_0', 'partition_1', 'partition_2'])
AS SELECT * FROM existing_table
有关更多示例,请参阅文档:https://docs.aws.amazon.com/athena/latest/ug/ctas-examples.html#ctas-example-partitioned