potiuk opened a new issue #18449:
URL: https://github.com/apache/airflow/issues/18449


   ### Discussed in https://github.com/apache/airflow/discussions/18408
   
   <div type='discussions-op-text'>
   
   <sup>Originally posted by **ziplokk1** September 21, 2021</sup>
   Hey folks,
   
   I've come across an issue where when attempting to run migrations against a 
clean database, but with existing dags defined in my dags folder, there's a 
silent failure and the migration exits with the `airflow` command usage prompt 
saying "invalid command 'db'". 
   
   I got to digging and the culprit was the [following 
line](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py#L73).
   
   I'm almost positive that this has to do with an erroneous `.py` file in my 
dags folder (I have yet to dig deeper into the issue), but this begged the 
question of why is the migration is reading the dags to migrate existing data 
in the database in the first place? Shouldn't the migration simply migrate the 
data regardless of the state of the dag files themselves?
   
   I was able to fix the issue by changing the line in the link above to 
`dagbag = DagBag(read_dags_from_db=True)` but I'd like to see if there was any 
context behind reading the dag file instead of the database before opening a 
PR.</div>


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