VMois opened a new issue #12809:
URL: https://github.com/apache/superset/issues/12809


   After enabling "Alerts" and configuring one, I cannot see any triggers and 
email notifications being sent to me. I am sure that SQL query should return 
rows to trigger alert and, also, `Alert Log` is not showing any triggers. 
   
   Using Celery for email notifications. Maybe, I am missing some Celery 
configs in `superset_config.py`?
   
   ### Expected results
   
   I want to be able to trigger alerts.
   
   ### Actual results
   
   Email notifications are working, it means something wrong with alerts. After 
checking the Docker logs, I found a possible issue, there is an error in 
`models/alerts.py` while importing `security_manager`. Not sure what causes 
this error. In addition, within the above error there is another error:
   
   ```
   sqlalchemy.exc.InvalidRequestError: Table 'alert_owner' is already defined 
for this MetaData instance.  Specify 'extend_existing=True' to redefine options 
and columns on an existing Table object.
   ```
   More logs below.
   
   #### Screenshots (logs)
   
   Docker logs:
   
   ```
   class Alert(Model):
     File "/usr/local/lib/python3.6/site-packages/superset/models/alerts.py", 
line 60, in Alert
       owners = relationship(security_manager.user_model, secondary=alert_owner)
     File "/usr/local/lib/python3.6/site-packages/werkzeug/local.py", line 347, 
in __getattr__
       return getattr(self._get_current_object(), name)
   AttributeError: 'NoneType' object has no attribute 'user_model'
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/usr/local/bin/celery", line 8, in <module>
       sys.exit(main())
     File "/usr/local/lib/python3.6/site-packages/celery/__main__.py", line 16, 
in main
       _main()
   Loaded your LOCAL configuration at [/opt/superset/superset_config.py]
     File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 
322, in main
       cmd.execute_from_commandline(argv)
     File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 
499, in execute_from_commandline
       super(CeleryCommand, self).execute_from_commandline(argv)))
     File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 
289, in execute_from_commandline
       argv = self.setup_app_from_commandline(argv)
     File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 
509, in setup_app_from_commandline
       self.app = self.find_app(app)
     File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 
531, in find_app
       return find_app(app, symbol_by_name=self.symbol_by_name)
     File "/usr/local/lib/python3.6/site-packages/celery/app/utils.py", line 
376, in find_app
       sym = imp(app)
     File "/usr/local/lib/python3.6/site-packages/celery/utils/imports.py", 
line 111, in import_from_cwd
       return imp(module, package=package)
     File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in 
import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 994, in _gcd_import
     File "<frozen importlib._bootstrap>", line 971, in _find_and_load
     File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
     File "<frozen importlib._bootstrap>", line 994, in _gcd_import
     File "<frozen importlib._bootstrap>", line 971, in _find_and_load
     File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 678, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
     File "/usr/local/lib/python3.6/site-packages/superset/sql_lab.py", line 
44, in <module>
       from superset.db_engine_specs import BaseEngineSpec
     File 
"/usr/local/lib/python3.6/site-packages/superset/db_engine_specs/__init__.py", 
line 36, in <module>
       from superset.db_engine_specs.base import BaseEngineSpec
     File 
"/usr/local/lib/python3.6/site-packages/superset/db_engine_specs/base.py", line 
54, in <module>
       from superset.models.sql_lab import Query
     File "/usr/local/lib/python3.6/site-packages/superset/models/__init__.py", 
line 17, in <module>
       from . import (
     File "/usr/local/lib/python3.6/site-packages/superset/models/alerts.py", 
line 43, in <module>
       Column("alert_id", Integer, ForeignKey("alerts.id")),
     File "<string>", line 2, in __new__
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/util/deprecations.py", line 
139, in warned
       return fn(*args, **kwargs)
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/schema.py", 
line 542, in __new__
       "existing Table object." % key
   sqlalchemy.exc.InvalidRequestError: Table 'alert_owner' is already defined 
for this MetaData instance.  Specify 'extend_existing=True' to redefine options 
and columns on an existing Table object.
   ```
   
   #### How to reproduce the bug
   
   No idea.
   
   ### Environment
   
   Docker image: python:3.6-jessie
   
   - superset version: `0.37.2`
   - python version: `3.6.9`
   - node.js version: `not installed`
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [ ] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [ ] I have reproduced the issue with at least the latest released version 
of superset.
   - [ ] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   No additional context
   


----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to