diegoscarabelli opened a new issue, #36549:
URL: https://github.com/apache/superset/issues/36549
### Bug description
## TL;DR
Superset 6.0.0rc4 has **incomplete Flask-AppBuilder 5.0.0 compatibility**.
While FAB 5.0.0 is included in requirements, critical API incompatibilities
prevent successful deployment.
**Verified against commit**: `6a1c30e5e7` (6.0.0rc4 release)
---
## Critical Issues
### Issue #1: Flask-SQLAlchemy 2.5.1 Incompatibility
**Error**:
```
SignallingSession.get_bind() got an unexpected keyword argument 'bind'
```
**Location**: Runtime, during database operations
**Root Cause**:
- Flask-AppBuilder 5.0.0 requires Flask-SQLAlchemy 3.x for proper SQLAlchemy
1.4 compatibility
- Superset 6.0.0rc4 pins Flask-SQLAlchemy==2.5.1 in
`requirements/base.txt:137`
- This creates a `get_bind()` API incompatibility between Flask-SQLAlchemy
2.x and SQLAlchemy 1.4
**Solution**:
Update `pyproject.toml` to require Flask-SQLAlchemy 3.x:
```toml
[project]
dependencies = [
# ... other deps ...
"flask-sqlalchemy>=3.0.0,<4.0",
]
```
Then regenerate requirements:
```bash
pip-compile pyproject.toml requirements/base.in -o requirements/base.txt
pip-compile requirements/development.in -c requirements/base.txt -o
requirements/development.txt
```
**Impact**: 🔴 CRITICAL - Prevents application from starting
---
### Issue #2: Removed FAB 5.0 API - `sync_role_definitions()`
**Error**:
```python
AttributeError: 'SupersetSecurityManager' object has no attribute
'sync_role_definitions'
```
**Location**: `superset/cli/main.py:85`
**Root Cause**:
Flask-AppBuilder 5.0.0 removed the `SecurityManager.sync_role_definitions()`
method. The 6.0.0rc4 code still calls this removed method during initialization.
**Verification**:
```bash
$ grep -n "sync_role_definitions" /path/to/6.0.0rc4/superset/cli/main.py
85: security_manager.sync_role_definitions()
```
**Solution**:
Add compatibility shim in `superset/cli/main.py`:
```python
def init() -> None:
"""Inits the Superset application"""
appbuilder.add_permissions(update_perms=True)
# FAB 5.0.0 removed sync_role_definitions()
# Permissions are already synced by add_permissions(update_perms=True)
if hasattr(security_manager, 'sync_role_definitions'):
# FAB < 5.0.0
security_manager.sync_role_definitions()
# FAB >= 5.0.0: No action needed, permissions already synced
```
**Alternative Solution**: Remove the call entirely, as
`add_permissions(update_perms=True)` already handles role definition syncing in
FAB 5.0.0.
**Impact**: 🔴 CRITICAL - Prevents `superset init` from completing
---
## Reproduction Steps
### Using Docker (Recommended)
1. Clone Superset and checkout 6.0.0rc4:
```bash
git clone https://github.com/apache/superset.git
cd superset
git checkout 6a1c30e5e7 # 6.0.0rc4
```
2. Attempt to initialize:
```bash
docker compose up superset-init
```
3. Observe failures:
- Issue #1: `get_bind()` errors during database operations
- Issue #2: `AttributeError` on `sync_role_definitions()`
### Using Local Installation
1. Install Superset 6.0.0rc4:
```bash
pip install apache-superset==6.0.0rc4
```
2. Initialize database:
```bash
superset db upgrade
superset init
```
3. Observe `AttributeError: 'SupersetSecurityManager' object has no
attribute 'sync_role_definitions'`
---
## Environment Details
**Working Configuration** (what 6.0.0rc4 needs):
- Flask-AppBuilder: 5.0.0
- Flask-SQLAlchemy: 3.0.5+ (or any 3.x)
- SQLAlchemy: 1.4.54
**Current 6.0.0rc4 Configuration** (broken):
- Flask-AppBuilder: 5.0.0 ✅
- Flask-SQLAlchemy: 2.5.1 ❌ (should be 3.x)
- SQLAlchemy: 1.4.54 ✅
---
## Recommended Upstream Fixes
### Priority 1: Update Flask-SQLAlchemy Requirement
**File**: `pyproject.toml`
```diff
[project]
dependencies = [
# ... other dependencies ...
+ "flask-sqlalchemy>=3.0.0,<4.0",
# ... other dependencies ...
]
```
**File**: `requirements/base.txt` (regenerated from pyproject.toml)
```diff
- flask-sqlalchemy==2.5.1
+ flask-sqlalchemy==3.0.5 # (or latest 3.x)
```
### Priority 2: Fix sync_role_definitions() Call
**File**: `superset/cli/main.py`
**Option A** (Backward compatible):
```python
def init() -> None:
"""Inits the Superset application"""
appbuilder.add_permissions(update_perms=True)
# Handle FAB 4.x and 5.x compatibility
if hasattr(security_manager, 'sync_role_definitions'):
security_manager.sync_role_definitions()
```
**Option B** (Clean, FAB 5.0+ only):
```python
def init() -> None:
"""Inits the Superset application"""
# FAB 5.0.0+ handles role definitions in add_permissions()
appbuilder.add_permissions(update_perms=True)
```
---
## Related Issues & PRs
- **FAB 5.0 Upgrade PR**: https://github.com/apache/superset/pull/33055
- **FAB 5.0.0 Release Notes**:
https://github.com/dpgaspar/Flask-AppBuilder/releases/tag/v5.0.0
- **FAB Migration Guide**:
https://flask-appbuilder.readthedocs.io/en/latest/versionmigration.html#migrating-to-5-0-0
- **Flask-SQLAlchemy 3.x Changes**:
https://flask-sqlalchemy.palletsprojects.com/en/3.1.x/changes/#version-3-0-0
---
## Testing Checklist
After applying fixes, verify:
- [ ] `docker compose up superset-init` completes without errors
- [ ] Database migrations run successfully
- [ ] Admin user is created
- [ ] Roles and permissions are initialized
- [ ] Example data loads (if using examples)
- [ ] Application starts and is accessible at http://localhost:8088
- [ ] Login works with created admin credentials
---
## Additional Notes
### Why Flask-SQLAlchemy 3.x is Required
FAB 5.0.0 was updated to use SQLAlchemy 1.4+ features that require
Flask-SQLAlchemy 3.x for proper integration. The main issue is the `get_bind()`
method signature change:
- **Flask-SQLAlchemy 2.x**: `get_bind(mapper=None, clause=None, bind=None)`
- **Flask-SQLAlchemy 3.x**: `get_bind(mapper=None, clause=None)` (removed
`bind` parameter)
SQLAlchemy 1.4 calls `get_bind()` without the `bind` parameter, which
Flask-SQLAlchemy 2.x doesn't support.
### Why sync_role_definitions() Was Removed
In FAB 5.0.0, the role definition syncing logic was consolidated into the
`add_permissions()` method when called with `update_perms=True`. The separate
`sync_role_definitions()` method became redundant and was removed.
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [x] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
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]