我一直在尝试执行此sql查询:
CREATE EXTERNAL TABLE IF NOT EXISTS appReporting.reports (
`instanceid` string,
`userid` string,
`hasheduserid` string
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
"separatorChar" = ",",
"escapeChar" = "\\",
"quoteChar" = '"'
)
LOCATION 's3://bucket-reporting/history/'
TBLPROPERTIES ('has_encrypted_data'='false', 'skip.header.line.count'='1');
我可以直接在AWS控制台中创建它,但是通过AWS CLI命令,我会遇到各种排序或错误,例如:
"quoteChar" = '"'
)请对此提供帮助。它使我发疯,因为它在控制台中正常工作。
这是我执行的命令(Ansible剧本中的AWS CLI)
- name: Start Query Execution
sudo: yes
command: >
aws athena start-query-execution
--query-string "{{ lookup('file', '/tmp/create_table_1.sql') }}"
删除所有不需要的字符后,我有:Only external table creation is supported
如何正确地将查询作为字符串传递给命令?