簡體   English   中英

如何在 AWS Athena 中編寫多個 SQL 語句,如 CREATE 表(使用 CLI 命令 - aws athena start-query-execution --query-string {value})?

[英]How to write multiple SQL statements like CREATE table in AWS Athena ( using CLI command - aws athena start-query-execution --query-string {value} )?

如何通過ATHENA CLI命令編寫多個CREATE TABLE語句來執行多個 SQL 語句- aws athena start-query-execution

我試過這個,但只使用單個 SQL 語句,它工作正常。 但是我需要運行多個SQL語句

( select count(*) from elb_logs; create external table tbl_nm; )通過 CLI Athena 命令。

aws athena start-query-execution \
   --query-string "select count(*) from elb_logs;" \
   --query-execution-context Database=default \
   --result-configuration OutputLocation=s3://aws-athena-query-results-xxxxxxxxxx-us-east-1/ \
   --region us-east-1 \
   --output text

應該能夠通過 CLI 命令在 AWS Athena 上執行多個 SQL 語句。

我認為您不能在一個 CLI 命令中運行多個查詢,我剛剛嘗試並收到此錯誤:

    An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: 
    Only one sql statement is allowed.

一個一個地跑。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM