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

484
Visualizações
Setting up sns_publish_operator in airflow

Has anyone used the sns_publish_operator?

https://airflow.apache.org/docs/stable/_modules/airflow/contrib/operators/sns_publish_operator.html

I am quite new to airflow and am having some issues around setting up the architecture correctly.

I have set up a simple DAG with a data quality check task. Basically, if the dataset fails the data quality checks, I'd like to send an SNS notification. If it passes the data quality checks, I'd like it to reframe from sending an email.

There does not seem to be as much online help in this realm as I thought. Any resources or general tips would be much appreciated.

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

0

This question is a bit older, but maybe this helps someone still.

First addressing the SnsPublishOperator: You will need to setup an Airflow connection to AWS. There is multiple ways to do that. The easiest is probably using the Web UI. Go there to Admin->Connections->[+] (add new record). Then you set it up as 'Amazon Webservices Connection' Conn Type. Login and Password are the AWS key and key secret. Finally, you also have to provide the region, where you SNS topic is seated in the 'Extras' section:

{"region_name": "us-east-1"}

Now, you can use the Operator in you code, by providing it also the new connection's conn_id:

my_sns_task = SnsPublishOperator(
    task_id='task_name',
    target_arn='your_sns_topic_arn',
    message='your_message',
    aws_conn_id=conn_id
)

Theoretically, that operator also has a "subject" parameter, but I receive an error from the component, when I try to set it.

As for incorporating that operator into your DAG, a possible way would be to have the task, that evaluates your data, fail, if the checks to do not pass, and have the sns task be triggered on failure:

my_sns_task = SnsPublishOperator(
    task_id='task_name',
    target_arn='your_sns_topic_arn',
    message='your_message',
    aws_conn_id=conn_id,
    trigger_rule='one_failed'
)

my_sns_task.set_upstream(datacheck_task)
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