Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
Redshift Unload to S3 Location that is a Concatenated String

I'm trying to unload the results from a redshift query to a bucket folder that is yesterday's date.

So in the below example the data should be in s3://mybucket/reporting/20170321/myreport-000

unload ('select * from #my_report')
to 's3://mybucket/reporting/' || replace(trunc(current_date - 1),'-','') || '/myreport'
credentials 'aws_access_key_id=key;aws_secret_access_key=secretkey'
delimiter ','
gzip addquotes null as ''
PARALLEL off
allowoverwrite;

However I get the error

[Amazon](500310) Invalid operation: syntax error at or near "||";

Does the string concatenation not evaluate first?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It's not possible to dynamically build the UNLOAD path statement.

Two methods I can suggest:

  • Method 1: I would suggest writing a shell script/Python/Javascript where you can create variables, then pass in those variables into a connection's statement-query.
  • Method 2: Or you can use RedshiftCopyActivity in AWS Data Pipeline to copy from Redshift to S3. Input is RedshiftDataNode and output is S3DataNode where you can specify expression for directoryPath.

    If I’ve made a bad assumption please comment and I’ll refocus my answer.
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda