This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 834e03323b6 [v3-0-test] Add FAQ entry about testing connections and 
"Canary" Dag (#54110) (#54151)
834e03323b6 is described below

commit 834e03323b693ab123ed05e946bf810760a7344a
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Aug 10 23:23:18 2025 +0200

    [v3-0-test] Add FAQ entry about testing connections and "Canary" Dag 
(#54110) (#54151)
    
    * feat: add FAQ about testing connections and canary dag
    
    * fix: static checks
    
    * fix: Static checks
    (cherry picked from commit 85de1fe9b80e82db3f7b668bc23f56c66b1f75fc)
    
    Co-authored-by: fritz-astronomer 
<[email protected]>
---
 airflow-core/docs/faq.rst | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/airflow-core/docs/faq.rst b/airflow-core/docs/faq.rst
index a37dcba6eb5..f74c4194928 100644
--- a/airflow-core/docs/faq.rst
+++ b/airflow-core/docs/faq.rst
@@ -540,3 +540,38 @@ This means ``explicit_defaults_for_timestamp`` is disabled 
in your mysql server
 
 #. Set ``explicit_defaults_for_timestamp = 1`` under the ``mysqld`` section in 
your ``my.cnf`` file.
 #. Restart the Mysql server.
+
+Connections
+^^^^^^^^^^^
+
+How can I test a connection or use a Canary Dag?
+------------------------------------------------
+
+For security reasons, the test connection functionality is disabled by default 
across the Airflow UI,
+API and CLI. This can be modified by setting 
ref:`config:core__test_connection`.
+
+You can utilize a Dag to regularly test connections. This is referred to as a 
"Canary Dag" and can detect and
+alert on failures in external systems that your Dags depend on. You can create 
a simple Dag that tests connections
+such as the following Airflow 3 example:
+
+.. code-block:: python
+
+  from airflow import DAG
+  from airflow.sdk import task
+
+  with DAG(dag_id="canary", schedule="@daily", doc_md="Canary DAG to regularly 
test connections to systems."):
+
+      @task(doc_md="Test a connection by its Connection ID.")
+      def test_connection(conn_id):
+          from airflow.hooks.base import BaseHook
+
+          ok, status = BaseHook.get_hook(conn_id=conn_id).test_connection()
+          if ok:
+              return status
+          raise RuntimeError(status)
+
+      for conn_id in [
+          # Add more connections here to create tasks to test them.
+          "aws_default",
+      ]:
+          test_connection.override(task_id="test_" + conn_id)(conn_id)

Reply via email to