简体   繁体   English

AWS Athena 查询将结果附加到表中?

[英]AWS Athena query appending results to table?

I have an Amazon Athena table that I created with the following syntax:我有一个使用以下语法创建的 Amazon Athena 表:

CREATE TABLE IF NOT EXISTS table1 ( string1 string, string2 string)
LOCATION 's3://xyz/abc'

I then populated the table via然后我通过填充表格

INSERT INTO table1 (string1, string2)
values ('1','2'),('3','4')...

This all worked just fine.这一切都很好。 However, when I query the table via但是,当我通过查询表时

select count(*)
from table1

I get a number.我得到一个号码。 If I run this query again, the count has gone up.如果我再次运行此查询,则计数已增加。 Running it again, and the count goes up again.再次运行它,计数再次上升。 I think what is happening is that the results of the query (and maybe the query itself) are somehow being saved to the table.我认为正在发生的事情是查询的结果(可能还有查询本身)以某种方式保存到表中。 Where is the setting for this and how do I stop it from happening?这个设置在哪里,我该如何阻止它发生? I don't mind if a table stores the query and result information, just so long as it is not table1.我不介意表是否存储查询和结果信息,只要它不是 table1。

It would appear that the location you specified for the table storage is the same as the configured query result location .您为表存储指定的location似乎与配置的查询结果位置相同。

This would cause the results of every SELECT to be stored in the same location, therefore 'appending' data to the table.这将导致每个SELECT的结果存储在同一位置,因此将数据“附加”到表中。

You should keep those two locations separate.您应该将这两个位置分开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM