Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

481
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda