Comments (3)
Hey there, @dmarkey! I'm here to help you with any bugs, questions, or contributions you have for Apache Superset. Let's tackle this issue together!
The issue you're encountering with flask_login.current_user
being None
during the execution of SQL_QUERY_MUTATOR
in SQLLab sessions is due to differences in the execution context between SQLLab and navigating graphs. In SQLLab sessions, the user ID is explicitly retrieved and stored in the SqlJsonExecutionContext
class using the get_user_id()
function, rather than relying on flask_login.current_user
directly [1].
To work around this, you can modify your SQL_QUERY_MUTATOR
to use the get_user_id()
function to retrieve the user ID. Hereβs an example:
from superset.utils.core import get_user_id
def SQL_QUERY_MUTATOR(sql: str, **kwargs) -> str:
user_id = get_user_id()
print(user_id) # This should print the correct user ID during a SQLLab session
return sql
This approach ensures that you get the correct user information even in the SQLLab context.
To continue talking to Dosu, mention @dosu.
from superset.
That actually works.. first time I've been impressed by AI.
from superset.
closing
from superset.
Related Issues (20)
- Add Support for SQL Server Analysis Services (SSAS) Connection with MDX Query Execution, Dimension Management, Pivot Tables, and Domain User Login HOT 3
- Environment variable SUPERSET_DATABASE_URI HOT 6
- Superset 4.1.0RC2 - Dashboard embedding - now includes editor and last modified timestamp HOT 2
- Docker build it failing - Docker compose up is not working HOT 2
- `show summary` does not correctly apply all filters HOT 2
- Exports are brittle HOT 1
- Superset-4.1.0rc2: Download to CSV option is not showing up in SQL LAB page. HOT 6
- Superset 4.1.0RC2 - New Sankey charts cannot be embedded = "Guest user cannot modify chart payload" HOT 1
- zstd not found by superset_node during docker compose up dev mode HOT 4
- Failed to resolve entry for package "@superset-ui/switchboard". The package may have incorrect main/module/exports specified in its package.json. HOT 2
- SuperSet Database connection is successfully established but not able to get the tables under a specific schema HOT 6
- Annotation formula on chart does not work for values above 1*10^15 (peta) HOT 1
- I'm getting ERROR:flask_migrate:Error while upgrading. HOT 6
- [4.1.0rc2] sqlalchemy InvalidRequestError: This nested transaction is inactive when trying to activate embedding on a dashboard HOT 1
- Superset 4.1 with Pinot not aggregating epoch_ms timestamps correctly HOT 1
- Bangladesh is missing in country map dropdown selection for Country Map Chart HOT 2
- Server Pagination Sort Only Sorts Loaded Rows - Table HOT 1
- Drill-by alert "Failed to load dimensions for drill by" using Gamma role HOT 2
- The end date on the filter panel of the dashboard is failing to capture the current data. HOT 1
- Data Zoom should be fixed scrolling on the dashboard HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.