Reputation: 1135
I'm trying to create an internal table in Athena, on data in S3 in parquet format:
CREATE TABLE IF NOT EXISTS `vdp_dev.owners_daily`(
`owner_id` string COMMENT 'from deserializer',
`username` string COMMENT 'from deserializer',
`billing_with` string COMMENT 'from deserializer',
`billing_contacts` string COMMENT 'from deserializer',
`error_code` string COMMENT 'from deserializer')
PARTITIONED BY (
`dt` string)
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
LOCATION
's3://xxxxx-xx-xxxx-xxxxxx/dim/daily/owners';
but getting the following error:
Only external table creation is supported. (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: 13c5325b-2217-4989-b5f3-e717462329c1)
Does someone know why it happens? Why can't I create an internal table in Athena?
Upvotes: 3
Views: 2341
Reputation: 1525
From the Athena documentation :
All Tables Are EXTERNAL If you use CREATE TABLE without the EXTERNAL keyword, Athena issues an error; only tables with the EXTERNAL keyword can be created. We recommend that you always use the EXTERNAL keyword. When you drop a table in Athena, only the table metadata is removed; the data remains in Amazon S3.
Upvotes: 5