带有时间戳过滤的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ヶ月前9ビュー
1回答
0

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

```
unload ('select * from traffic where timestamp < '''2017-01-01''' order by timestamp asc')…
```
profile picture
エキスパート
回答済み 6ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ