john-bodley commented on issue #4669: [sqllab] Using app context for processing 
Jinja template in async mode
URL: 
https://github.com/apache/incubator-superset/pull/4669#issuecomment-375510939
 
 
   @mistercrunch here's the stack trace:
   ```
   This typically means that you attempted to use functionality that needed
   to interface with the current application object in a way.  To solve
   this set up an application context with app.app_context().  See the
   documentation for more information.
   Traceback (most recent call last):
     File "/home/john_bodley/incubator-superset/superset/sql_lab.py", line 199, 
in execute_sql
       executed_sql, **tp)
     File "/home/john_bodley/incubator-superset/superset/jinja_context.py", 
line 109, in process_template
       return template.render(kwargs)
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/jinja2/asyncsupport.py", 
line 76, in render
       return original_render(self, *args, **kwargs)
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/jinja2/environment.py", line 
1008, in render
       return self.environment.handle_exception(exc_info, True)
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/jinja2/environment.py", line 
780, in handle_exception
       reraise(exc_type, exc_value, tb)
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/jinja2/_compat.py", line 37, 
in reraise
       raise value.with_traceback(tb)
     File "<template>", line 1, in top-level template code
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/jinja2/sandbox.py", line 
427, in call
       return __context.call(__obj, *args, **kwargs)
     File "/home/john_bodley/incubator-superset/superset/jinja_context.py", 
line 129, in latest_partition
       table_name, schema, self.database)[1]
     File "/home/john_bodley/incubator-superset/superset/db_engine_specs.py", 
line 726, in latest_partition
       indexes = database.get_indexes(table_name, schema)
     File "/home/john_bodley/incubator-superset/superset/models/core.py", line 
813, in get_indexes
       return self.inspector.get_indexes(table_name, schema)
     File "/home/john_bodley/incubator-superset/superset/models/core.py", line 
738, in inspector
       engine = self.get_sqla_engine()
     File "/home/john_bodley/incubator-superset/superset/utils.py", line 100, 
in __call__
       value = self.func(*args, **kwargs)
     File "/home/john_bodley/incubator-superset/superset/models/core.py", line 
655, in get_sqla_engine
       effective_username = self.get_effective_user(url, user_name)
     File "/home/john_bodley/incubator-superset/superset/models/core.py", line 
643, in get_effective_user
       hasattr(g, 'user') and hasattr(g.user, 'username') and
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/werkzeug/local.py", line 
347, in __getattr__
       return getattr(self._get_current_object(), name)
     File 
"/home/john_bodley/env/lib/python3.6/site-packages/werkzeug/local.py", line 
306, in _get_current_object
       return self.__local()
     File "/home/john_bodley/env/lib/python3.6/site-packages/flask/globals.py", 
line 44, in _lookup_app_object
       raise RuntimeError(_app_ctx_err_msg)
   RuntimeError: Working outside of application context.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to