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 2022/10/20 09:37:35 UTC

[GitHub] [airflow] tirkarthi commented on issue #27138: Airflow 2.4.1 ab_permission_view_role database error

tirkarthi commented on issue #27138:
URL: https://github.com/apache/airflow/issues/27138#issuecomment-1285232342

   In future it will be helpful to have properly formatted traceback posted. As per traceback you have custom auth_backend class at `/etc/airflow/config/token_auth.py` where you are importing `User` from `flask_appbuilder.security.sqla.models` that causes `Role` from flask_appbuilder to get registered meanwhile there is already Role defined at `airflow/www/fab_security/sqla/models.py` . Please import from airflow related model files to avoid this issue. This can be closed as there is no issue with Airflow.
   
   ```python
   Traceback (most recent call last):
   File "/usr/local/bin/airflow", line 8, in <module>
   sys.exit(main())
   File "/usr/local/lib/python3.10/site-packages/airflow/__main__.py", line 39, in main
   args.func(args)
   File "/usr/local/lib/python3.10/site-packages/airflow/cli/cli_parser.py", line 52, in command
   return func(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/airflow/utils/cli.py", line 99,
   in wrapper return f(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/airflow/cli/commands/sync_perm_command.py", line 28,
   in sync_perm appbuilder = cached_app().appbuilder
   File "/usr/local/lib/python3.10/site-packages/airflow/www/app.py", line 161, in cached_app
   app = create_app(config=config, testing=testing)
   File "/usr/local/lib/python3.10/site-packages/airflow/www/app.py", line 124, in create_app
   init_api_experimental_auth(flask_app)
   File "/usr/local/lib/python3.10/site-packages/airflow/www/extensions/init_security.py", line 57, in init_api_experimental_auth
   auth = import_module(backend.strip())
   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
   File "/etc/airflow/config/token_auth.py", line 8, in <module>
   from flask_appbuilder.security.sqla.models import User  # <---- Causes error 
   File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/sqla/models.py", line 48, in <module>
   assoc_permissionview_role = Table( File "<string>", line 2, in __new__
   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
   return fn(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/schema.py", line 594, in __new__
   raise exc.InvalidRequestError( sqlalchemy.exc.InvalidRequestError: Table 'ab_permission_view_role' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.
   ```


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