GitHub user dosubot[bot] added a comment to the discussion: Upgrade to Superset Version 5 to 6 (Issues Faced)
<!-- Answer --> This error happens because Superset 6.x removed the get_session method from the security manager. The new pattern is to use the session attribute instead. So, anywhere you had self.get_session, you should now use self.session. For your example, just change: ```python self.get_session.commit() ``` to ```python self.session.commit() ``` This applies to queries as well (e.g., self.session.query(...)). This change was made in Superset 6.x and is reflected in recent updates to the security manager codebase—see [PR #35290](https://github.com/apache/superset/pull/35290) for details. If you need to access the session outside the security manager, you can also use db.session from superset.extensions, but within your CustomSsoSecurityManager, self.session is the recommended approach. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/48a1d67c-b689-4473-8605-8611fcac4d83?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20error%20happens%20because%20Superset%206.x%20removed%20the%20get_session%20method%20from%20the%20security%20manager.%20The%20new%20pattern%20is%20to%20use%20the%20session%20attribute%20instead.%20So%2C%20anywhere%20you%20had%20self.get_session%2C%20you%20should%20now%20use%20self.session.%20For%20your%20example%2C%20just%20change%3A%0A%0A%60%60%60python%0Aself.get_session.commit%28%29%0A%60%60%60%0A%0Ato%0A%0A%60%60%60python%0Aself.session.commit%28%29%0A%60%60%60%0A%0AThis%20applies%20to%20queries%20as%20well%20%28e.g.%2C%20self.session.query%28...%29%29.%20This%20change%20was%20made%20in%20Superset%206.x%20and%20is%20reflected%20in%20recent%20updates%20to%20the%20security%20manager%20codebase%E2%80%94see%20%5BPR%20%2335290%5D%28https%3A//gith ub.com/apache/superset/pull/35290%29%20for%20details.%0A%0AIf%20you%20need%20to%20access%20the%20session%20outside%20the%20security%20manager%2C%20you%20can%20also%20use%20db.session%20from%20superset.extensions%2C%20but%20within%20your%20CustomSsoSecurityManager%2C%20self.session%20is%20the%20recommended%20approach.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36869) GitHub link: https://github.com/apache/superset/discussions/36869#discussioncomment-15379236 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
