带有时间戳过滤的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
전문가
질문됨 6달 전7회 조회
1개 답변
0

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

```
unload ('select * from traffic where timestamp < '''2017-01-01''' order by timestamp asc')…
```
profile picture
전문가
답변함 6달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인