带有时间戳过滤的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
ESPECIALISTA
feita há 6 meses9 visualizações
1 Resposta
0

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

```
unload ('select * from traffic where timestamp < '''2017-01-01''' order by timestamp asc')…
```
profile picture
ESPECIALISTA
respondido há 6 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas