Skip to content

FAB migration is missing if_not_exists=True #55856

@plutaniano

Description

@plutaniano

Apache Airflow Provider(s)

fab

Versions of Apache Airflow Providers

apache-airflow-providers-fab==2.4.2

Apache Airflow version

3.0.6

Operating System

Debian GNU/Linux 12 (bookworm)

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

What happened

I'm upgrading an Airflow instance from 2.11.0 to 3.0.6 while setting auth_manager = airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager as detailed in the migration guide.

During the deployment, the airflow-run-airflow-migrations container is erroring with the following:

 sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateTable) relation "ab_view_menu" already exists                                                    │
│                                                                                                                                                             │
│ [SQL:                                                                                                                                                       │
│ CREATE TABLE ab_view_menu (                                                                                                                                 │
│     id SERIAL NOT NULL,                                                                                                                                     │
│     name VARCHAR(250) NOT NULL,                                                                                                                             │
│     CONSTRAINT ab_view_menu_pkey PRIMARY KEY (id),                                                                                                          │
│     CONSTRAINT ab_view_menu_name_uq UNIQUE (name)                                                                                                           │
│ )                                                                                                                                                           │
│                                                                                                                                                             │
│ ]                                                                                                                                                           │
│ (Background on this error at: https://sqlalche.me/e/14/f405) 

I did some investigation and I noticed that in the migration file the only table that does not have if_not_exists=True is ab_view_menu, the one that is giving me an error. Is this intended?

What you think should happen instead

The migration should complete when ab_view_menu already exists.

How to reproduce

Upgrade an already existing airflow instance with FabAuthManager from 2.11.0 to 3.0.6. Running FAB migrations should fail.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions