jroachgolf84 commented on code in PR #61596:
URL: https://github.com/apache/airflow/pull/61596#discussion_r2842085799


##########
airflow-core/docs/best-practices.rst:
##########
@@ -457,23 +457,32 @@ Bad example:
 
 
     class CustomTimetable(CronDataIntervalTimetable):
+
         def __init__(self, *args, something=Variable.get("something"), 
**kwargs):
             self._something = something
             super().__init__(*args, **kwargs)
 
+
 Good example:
 
 .. code-block:: python
 
-    from airflow.sdk import Variable
     from airflow.timetables.interval import CronDataIntervalTimetable
 
 
     class CustomTimetable(CronDataIntervalTimetable):
+
         def __init__(self, *args, something="something", **kwargs):
-            self._something = Variable.get(something)
+            self._something = something
             super().__init__(*args, **kwargs)
 
+.. note::
+
+    Timetables are evaluated during DAG parsing. Accessing Airflow Variables,
+    Connections, or the metadata database inside a timetable (including during
+    ``__init__``) can negatively impact DAG parsing performance or cause 
failures.
+    Any database or network access should be deferred until task execution 
time.

Review Comment:
   Replace `deferred until` with `handled during`. "Deferred" implies 
asynchronous execution.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to