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/04/13 19:53:05 UTC

[GitHub] [airflow] harvetech opened a new issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

harvetech opened a new issue #15354:
URL: https://github.com/apache/airflow/issues/15354


   Whenever I try to delete a dag I get the following error. It seems like a version mismatch in flask-sqlalchemy
   
   
   Python version: 3.7.10
   Airflow version: 2.0.1
   Node: jupyter-gpuaccel.zolitron.com
   -------------------------------------------------------------------------------
   Traceback (most recent call last):
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
       response = self.full_dispatch_request()
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
       raise value
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
       rv = self.dispatch_request()
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/airflow/www/auth.py", line 34, in decorated
       return func(*args, **kwargs)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/airflow/www/decorators.py", line 60, in wrapper
       return f(*args, **kwargs)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/airflow/www/views.py", line 1393, in delete
       delete_dag.delete_dag(dag_id)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/airflow/utils/session.py", line 65, in wrapper
       return func(*args, session=session, **kwargs)
     File "/root/anaconda3/envs/airflow_env/lib/python3.7/site-packages/airflow/api/common/experimental/delete_dag.py", line 54, in delete_dag
       for model in models.base.Base._decl_class_registry.values():  # noqa pylint: disable=protected-access
   AttributeError: type object 'Base' has no attribute '_decl_class_registry'
   
   
   


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

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



[GitHub] [airflow] potiuk commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-987834360


   Also just to let youknow @harvetech - the *RIGHT* way of installing Airlfow is via constraints mechanism: https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html - and in the "golden" set of constraints - even for the main version, sqlalchemy is still 1.3.24 https://github.com/apache/airflow/blob/6c91224f6c2e4f24d669c59d4e8e8006c9235db0/constraints-3.9.txt#L42 , so using 1.4 is pretty much your own risk.


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



[GitHub] [airflow] boring-cyborg[bot] commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-819010618


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


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

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



[GitHub] [airflow] potiuk edited a comment on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-987834360


   Also just to let youknow @harvetech @joshanza - the *RIGHT* way of installing Airlfow is via constraints mechanism: https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html - and in the "golden" set of constraints - even for the main version, sqlalchemy is still 1.3.24 https://github.com/apache/airflow/blob/6c91224f6c2e4f24d669c59d4e8e8006c9235db0/constraints-3.9.txt#L42 , so using 1.4 is pretty much your own risk.


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



[GitHub] [airflow] uranusjr commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-822895632


   Downgrade SQLAlchemy to under 1.4.


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

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



[GitHub] [airflow] LsYueh commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
LsYueh commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-822902064


   Problem solved after downgrade SQLAlchemy from 1.4.8 to 1.3.24.
   And with SQLAlchemy 1.4.9, airflow db init goes fail.


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

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



[GitHub] [airflow] uranusjr commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-987616369


   We happen to have a good oppertunity to fix this, see linked PR referenced above.


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



[GitHub] [airflow] harvetech closed issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
harvetech closed issue #15354:
URL: https://github.com/apache/airflow/issues/15354


   


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

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



[GitHub] [airflow] LsYueh commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
LsYueh commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-822890280


   Same issue while use the CLI.
   
   **Apache Airflow version**: 2.0.1
   
   
   **Environment**:
   
   - **OS**: CentOS 7.9.2009
   - **Kernel**: Linux 3.10.0-1160.24.1.el7.x86_64
   - **Install tools**: pip 21.0.1
   - **Others**: PostgreSQL-12、Python 3.6.8
   
   **What happened**:
   ```console
   Traceback (most recent call last):
     File "/home/devel/env-airflow/bin/airflow", line 8, in <module>
       sys.exit(main())
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/__main__.py", line 40, in main
       args.func(args)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/cli/cli_parser.py", line 48, in command
       return func(*args, **kwargs)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/utils/cli.py", line 89, in wrapper
       return f(*args, **kwargs)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/cli/commands/dag_command.py", line 143, in dag_delete
       message = api_client.delete_dag(dag_id=args.dag_id)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/api/client/local_client.py", line 35, in delete_dag
       count = delete_dag.delete_dag(dag_id)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/utils/session.py", line 65, in wrapper
       return func(*args, session=session, **kwargs)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/api/common/experimental/delete_dag.py", line 54, in delete_dag
       for model in models.base.Base._decl_class_registry.values():  # noqa pylint: disable=protected-access
   AttributeError: type object 'Base' has no attribute '_decl_class_registry'
   ```


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

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



[GitHub] [airflow] harvetech commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
harvetech commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-823011553


   Downgrading SQLAlchemy worked for me as well. Thanks all :) 


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

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



[GitHub] [airflow] uranusjr commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-823494533


   (For contributors) The next Airflow release will pin SQLAlchemy <1.4.0 so no further action is needed here.


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

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



[GitHub] [airflow] Woit removed a comment on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
Woit removed a comment on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-950439709


   for SQLAlchemy 1.4.0
   ```py
   def _get_class_by_tablename(tablename):
       for mapper in Base.mro()[0].registry.mappers:
           if mapper.mapped_table.fullname == tablename:
               return mapper.entity()
       return None
   ```


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



[GitHub] [airflow] potiuk commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-1040651797


   > I got this error just now when attempting to delete a DAG via the web UI, using Airflow 2.2.3 from the official Docker image (apache/airflow:2.2.3).
   
   @charmon79  Could you please open a new issue stating the circumstances, reproduction steps and all the details of your deployment (how you installed configured and run airflow ? Including what else you installed etc ? 
   
   It might be a different issue, even if error message is similar or the same, but cirucmstances of how you get there matter. 
   


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



[GitHub] [airflow] LsYueh edited a comment on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
LsYueh edited a comment on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-822890280


   Same issue while use the CLI.
   
   **Apache Airflow version**: 2.0.1
   
   
   **Environment**:
   
   - **OS**: CentOS 7.9.2009
   - **Kernel**: Linux 3.10.0-1160.24.1.el7.x86_64
   - **Install tools**: pip 21.0.1
   - **Others**: PostgreSQL-12、Python 3.6.8
   
   - **Installed Packages in Python**: [requirements.txt](https://github.com/apache/airflow/files/6339859/requirements.txt)
   
   **What happened**:
   ```console
   Traceback (most recent call last):
     File "/home/devel/env-airflow/bin/airflow", line 8, in <module>
       sys.exit(main())
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/__main__.py", line 40, in main
       args.func(args)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/cli/cli_parser.py", line 48, in command
       return func(*args, **kwargs)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/utils/cli.py", line 89, in wrapper
       return f(*args, **kwargs)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/cli/commands/dag_command.py", line 143, in dag_delete
       message = api_client.delete_dag(dag_id=args.dag_id)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/api/client/local_client.py", line 35, in delete_dag
       count = delete_dag.delete_dag(dag_id)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/utils/session.py", line 65, in wrapper
       return func(*args, session=session, **kwargs)
     File "/home/devel/env-airflow/lib64/python3.6/site-packages/airflow/api/common/experimental/delete_dag.py", line 54, in delete_dag
       for model in models.base.Base._decl_class_registry.values():  # noqa pylint: disable=protected-access
   AttributeError: type object 'Base' has no attribute '_decl_class_registry'
   ```
   


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

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



[GitHub] [airflow] LsYueh edited a comment on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
LsYueh edited a comment on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-822902064


   Problem solved after downgrade SQLAlchemy from 1.4.8 to 1.3.24.
   And with SQLAlchemy 1.4.9, 'airflow db init' goes fail.


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

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



[GitHub] [airflow] charmon79 commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
charmon79 commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-1035543726


   I got this error just now when attempting to delete a DAG via the web UI, using Airflow 2.2.3 from the official Docker image (apache/airflow:2.2.3).


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



[GitHub] [airflow] potiuk edited a comment on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-987834360


   Also just to let youknow @harvetech @joshzana - the *RIGHT* way of installing Airlfow is via constraints mechanism: https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html - and in the "golden" set of constraints - even for the main version, sqlalchemy is still 1.3.24 https://github.com/apache/airflow/blob/6c91224f6c2e4f24d669c59d4e8e8006c9235db0/constraints-3.9.txt#L42 , so using 1.4 is pretty much your own risk.


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



[GitHub] [airflow] Woit commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
Woit commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-950439709


   for SQLAlchemy 1.4.0
   ```py
   def _get_class_by_tablename(tablename):
       for mapper in Base.mro()[0].registry.mappers:
           if mapper.mapped_table.fullname == tablename:
               return mapper.entity()
       return None
   ```


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



[GitHub] [airflow] joshzana commented on issue #15354: Error on DAG deletion : AttributeError: type object 'Base' has no attribute '_decl_class_registry'

Posted by GitBox <gi...@apache.org>.
joshzana commented on issue #15354:
URL: https://github.com/apache/airflow/issues/15354#issuecomment-987388275


   @harvetech  - As of #16630 from @uranusjr , which is in Airflow 2.2.0 and higher, the Sqlalchemy dependency has been loosened to allow 1.4 again:
   
   ```
    sqlalchemy>=1.3.18
   ```
   
   Can this issue be reopened and get addressed?  We are trying to update some code that runs in workers to SqlAlchemy 1.4 and this is blocking us, since we use a common docker image for both webserver and workers.  Airflow should either require < 1.4 or fix this issue.
   
   It looks like the root cause here is Airflow using an internal Sqlalchemy field that has been removed.  See https://github.com/sqlalchemy/sqlalchemy/issues/6080 for context and workarounds.
   
   


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