带有时间戳过滤的Unload

0

【以下的问题经过翻译处理】 我尝试从数据库unload 2017年之前的所有数据,并遇到了似乎是一个bug的问题...

我的查询语句是:

unload('select * from traffic where timestamp < '2017-01-01' order by timestamp asc') to 's3://xxx/export/unload/2019-01-22-3/' iam_role 'arn:aws:iam::xxx:role/xxx' delimiter as ',' addquotes escape manifest;

然而查询结果只包含2015年及之前的数据,我认为这可能是由于日期被视为减法运算的结果,查看检查器中的查询语句如下:

unload('select * from traffic where timestamp < 2017-01-01') to 's3://xxx/export/unload/2019-01-22/' iam_role '' delimiter as ',' addquotes escape allowoverwrite manifest

profile picture
专家
已提问 5 个月前5 查看次数
1 回答
0

【以下的回答经过翻译处理】 很可能在查询文本到达Redshift之前,处理查询文本的某个东西已经去除了反斜杠转义。 尝试将引号加倍,这也有效。

```
unload ('select * from traffic where timestamp < '''2017-01-01''' order by timestamp asc')…
```
profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则