Skip to main content

How to Turn Off the Example Dags in Apache Airflow®

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A new Apache Airflow® installation fills its Dags page with examples: 119 of them in Airflow 3.4.0. They're handy for looking around, but they bury your own Dags. One setting, load_examples, turns them off. This guide turns it off on an installation that already loaded them, and shows where they go.

Syntax​

airflow.cfg
[core]
load_examples = False
Syntax
export AIRFLOW__CORE__LOAD_EXAMPLES=False
PartWhat it means
[core]The section of airflow.cfg that load_examples belongs to
load_examplesTrue loads the example Dags that ship with Airflow; False doesn't. The default is True
AIRFLOW__CORE__LOAD_EXAMPLESThe same setting as an environment variable, which wins over the file

The setting's own description in airflow.cfg says the examples are "good to get started, but you probably want to set this to False in a production environment".

Prerequisites​

  • Apache Airflow® installed, with AIRFLOW_HOME set to the folder that holds your airflow.cfg.

Step 1: Check the Setting​

Terminal
airflow config get-value core load_examples
Output
True

It's on, which is the default. This is what the Dags page looks like with it:

The Apache Airflow® Dags page with 119 Dags: example Dags such as Params Trigger UI, Params UI tutorial, Sample DAG with Display Name and aggregate_regional_sales, all tagged example.

119 Dags, and none of them is mine. They come from Airflow itself and from two of the providers it installs, the standard and common SQL providers.

Step 2: Change It in airflow.cfg​

Stop Airflow with Ctrl+C. Open airflow.cfg from your AIRFLOW_HOME folder, find load_examples in the [core] section, and change True to False:

airflow.cfg (in the [core] section)
# Whether to load the Dag examples that ship with Airflow. It's good to
# get started, but you probably want to set this to ``False`` in a production
# environment
#
# .. note::
#
# If you are using the Official Airflow Docker Image, this value is set to ``False`` by default
# via the environment variable ``AIRFLOW__CORE__LOAD_EXAMPLES``. To enable example Dags when
# using the official image, you must explicitly set ``AIRFLOW__CORE__LOAD_EXAMPLES=True`` in your
# environment.
#
# Variable: AIRFLOW__CORE__LOAD_EXAMPLES
#
load_examples = False

The load_examples setting in airflow.cfg, under its description and the note about the official Docker image, changed to load_examples = False.

Check it:

Terminal
airflow config get-value core load_examples
Output
False

Step 3: Start Airflow Again​

Terminal
airflow standalone

Sign in and open Dags:

The Apache Airflow® Dags page after the restart: 0 Dags and the message No Dags found.

0 Dags, No Dags found. The examples are gone from the page, even though they had been loaded before.

Where the Example Dags Went​

They weren't deleted. I looked in Airflow's database afterwards: all 119 were still there, marked as deactivated. Airflow's documentation on Dags explains it: when the Dag processor no longer finds a Dag it had stored, it deactivates it, keeps its history, and the UI doesn't show it. With load_examples = False, Airflow stops reading the example files, so their Dags are deactivated.

Set it back to True and they're read again, which the same page says reactivates them with their history.

Common Mistakes​

MistakeWhat happensDo this instead
Expecting the examples to be deletedThey're only deactivated and hiddenNothing to fix: that's how Airflow keeps their history
Setting it in a second terminal's environment onlyThe other terminal's Airflow still loads themChange airflow.cfg, which every terminal reads

Troubleshooting​

SymptomLikely causeFix
The examples are still listedAirflow wasn't restarted, or an environment variable sets TrueRestart; check env | grep LOAD_EXAMPLES
get-value prints True after the editYou edited another folder's airflow.cfgecho $AIRFLOW_HOME

FAQ​

Should I turn them off before the first start?​

That's the cleanest way: set load_examples = False before you start Airflow for the first time, and the examples are never loaded.

Do my own Dags get deactivated too?​

No. Only Dags whose files Airflow stops reading. Your dags folder is read as before.

Can I bring them back?​

Set load_examples = True and restart. Airflow's documentation says a deactivated Dag becomes active again, with its history, when its file is read again. I didn't switch mine back for this guide.

Conclusion​

load_examples was True, and the Dags page listed 119 example Dags. After changing it to False in airflow.cfg and restarting, the page showed No Dags found; the examples were deactivated, not deleted, so their history stays in the database.

Additional Resources​

Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.