amoghrajesh commented on PR #58357:
URL: https://github.com/apache/airflow/pull/58357#issuecomment-3540180089

   Hello - I appreciate you trying this out, I just pulled in your branch and 
figured out the problem.
   
   This is a classic case of the secrets backend taking precedence over the 
database.
   In Docker Compose you’ve defined an environment variable for 
test_variable_key and secrets backends are read-only, so when your test calls 
Variable.set(), the value is written to the database — and when you delete it, 
Airflow correctly removes it from the DB.
   
   The API server log even explains exactly what’s happening:
   ```python
   [2025-11-17T06:12:57.057+0000] {variable.py:404} WARNING -
   The variable test_variable_key is defined in the EnvironmentVariablesBackend
   secrets backend, which takes precedence over reading from the database.
   The value in the database will be updated, but to read it you have to
   delete the conflicting variable from EnvironmentVariablesBackend.
   ```
   
   So later, when your test reads the variable to confirm the deletion, it’s 
actually reading it from the secrets backend, not the database. That makes it 
appear as if the variable wasn’t deleted but it was.
   
   Database proof:
   ```shell script
   airflow=# SELECT key FROM variable;
    key
   -----
   (0 rows)
   ```


-- 
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