带有时间戳过滤的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
EXPERT
asked 6 months ago9 views
1 Answer
0

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

```
unload ('select * from traffic where timestamp < '''2017-01-01''' order by timestamp asc')…
```
profile picture
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions