You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/23 09:52:10 UTC

[GitHub] [airflow] leonarduschen edited a comment on issue #18457: Running `airflow db init` raises OperationalError on SQL: ALTER TABLE xcom DROP COLUMN id

leonarduschen edited a comment on issue #18457:
URL: https://github.com/apache/airflow/issues/18457#issuecomment-925652133


   It works, thanks!
   
   But here's the thing, I was using a managed database from DigitalOcean where the only way to change the config `sql_require_primary_key` **_permanently_** is to reach out their customer support and ask them to change it
   
   If I change it on my own like so:
   ```SQL
   SET sql_require_primary_key=OFF
   ```
   It will reset back to ON for new connections - so there is no way to set the variable to OFF when running `airflow db init`
   
   ---
   
   So what I ended up doing is:
   - Run `airflow db init` and let it fail
   - Login and run
   ```sql
   SET sql_require_primary_key=OFF;
   ALTER TABLE xcom DROP COLUMN id;
   ```
   - Run `airflow db init` again
   
   It works but it feels hacky to me
   
   ---
   
   Maybe on the Airflow side, we can check if the setting is ON, and then if it is ON just set it to OFF right before we run `ALTER TABLE xcom DROP COLUMN id` - and then set it to ON again? I'd be happy to make a PR


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org