dosubot[bot] commented on issue #29908:
URL: https://github.com/apache/superset/issues/29908#issuecomment-2281116512

   <!-- Answer -->
   To address the warning `WARNING:root:Class 'werkzeug.local.LocalProxy' is 
not mapped`, you need to ensure that `LocalProxy` objects are properly handled 
in your Superset configuration. This warning typically occurs when `LocalProxy` 
objects are passed to SQLAlchemy or other ORMs that expect a mapped class.
   
   Here are steps to resolve this:
   
   1. **Access the underlying object behind the `LocalProxy`**: Ensure that you 
are accessing the actual object behind the `LocalProxy` before passing it to 
any ORM operations.
   
   2. **Update your configuration**: Modify your `superset_config.py` to handle 
`LocalProxy` objects correctly.
   
   Here is an example of how you can handle `LocalProxy` objects in your 
configuration:
   
   ```python
   from flask import Flask
   from werkzeug.local import LocalProxy
   from superset.extensions import cache_manager, results_backend_manager
   
   def create_app():
       app = Flask(__name__)
       
       # Initialize your app and extensions here
       # ...
   
       # Explicitly map or handle LocalProxy objects
       app.config['CACHE'] = cache_manager.cache
       app.config['CONF'] = LocalProxy(lambda: app.config)
       app.config['RESULTS_BACKEND'] = LocalProxy(lambda: 
results_backend_manager.results_backend)
       app.config['RESULTS_BACKEND_USE_MSGPACK'] = LocalProxy(lambda: 
results_backend_manager.should_use_msgpack)
       app.config['DATA_CACHE'] = LocalProxy(lambda: cache_manager.data_cache)
       app.config['THUMBNAIL_CACHE'] = LocalProxy(lambda: 
cache_manager.thumbnail_cache)
       app.config['ASYNC_QUERY_MANAGER'] = LocalProxy(lambda: 
async_query_manager_factory.instance)
       app.config['EVENT_LOGGER'] = LocalProxy(lambda: 
_event_logger.get("event_logger"))
       app.config['SECURITY_MANAGER'] = LocalProxy(lambda: appbuilder.sm)
   
       return app
   ```
   
   By explicitly mapping these proxies in your application configuration, you 
can help ensure that they are properly recognized and handled, which should 
address the warning 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/extensions/__init__.py)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


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

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