我已经在SO和官方文档here上查看了类似的问题。
我想将此查询卸载到s3
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'table_temp'
ORDER BY ordinal_position;
与
UNLOAD ('SELECT column_name
FROM information_schema.columns
WHERE table_name = 'table_temp'
ORDER BY ordinal_position')
to 's3://bucket/folder/'
CREDENTIALS 'aws_access_key_id=KEY;aws_secret_access_key=SECRET'
DELIMITER AS ',';
尽管我尝试了几种方法来逃避单引号\,\\,$,"
,但似乎我无法实现它。有什么想法吗?
答案 0 :(得分:0)
为什么我们不能使用相同的方法:
UNLOAD ('SELECT column_name [or *]
FROM table_name [where clause]'
)
to 's3://bucket/folder/'
CREDENTIALS 'aws_access_key_id=KEY;aws_secret_access_key=SECRET'
DELIMITER AS ',';
答案 1 :(得分:0)
如果您的查询包含引号(例如将文字值括起来),请将文字放在两组单引号之间——您还必须将查询括在单引号之间:
('select * from venue where venuestate=''NV''')