Commit 08297fd
authored
feat(v3)!: Remove all SQLAlchemy modules in favor of direct advanced-alchemy imports (#4340)
## Summary
This PR completes the deprecation and migration of SQLAlchemy functionality from Litestar v3.0. Following the approach from PR #4225, **both** `litestar.contrib.sqlalchemy` and `litestar.plugins.sqlalchemy` modules have been completely removed. Users must now import directly from `advanced_alchemy.extensions.litestar`.
## Related Issues/PRs
- Closes #4163 - Second removal attempt
- Related to #4225 - Previous near-perfect implementation (out of sync with master)
- Related to #4069 - Initial removal attempt by @provinzkraut
- Related to #3755 - Original deprecation PR
## Breaking Changes
**BREAKING CHANGE**: All SQLAlchemy functionality has been removed from Litestar.
### Migration Guide
- `from litestar.contrib.sqlalchemy import X` → `from advanced_alchemy.extensions.litestar import X`
- `from litestar.plugins.sqlalchemy import Y` → `from advanced_alchemy.extensions.litestar import Y`
- `from litestar.plugins.sqlalchemy.base import Z` → `from advanced_alchemy.extensions.litestar.base import Z`
## Changes Made
1. **Complete Module Removal**:
- Removed entire `litestar/contrib/sqlalchemy/` directory tree
- Removed `litestar/plugins/sqlalchemy.py` re-export file
2. **Documentation Updates**: Updated all example files to use `advanced_alchemy.extensions.litestar` imports
3. **Test Updates**:
- Updated all tests to use new import paths
- Deleted tests for deprecated functionality that no longer exists
4. **Clean Architecture**: No re-export layer in Litestar - direct imports from advanced-alchemy only
5. **Changelog**: Added breaking change entry explaining the migration
## Technical Implementation
This implementation follows the cleaner approach from PR #4225:
- **No re-export layers** - users import directly from `advanced_alchemy.extensions.litestar`
- **Complete separation of concerns** - Litestar no longer maintains SQLAlchemy code
- **Single source of truth** - advanced-alchemy is the sole provider of SQLAlchemy integration
## Benefits
1. **Cleaner separation** - Litestar doesn't maintain SQLAlchemy code
2. **Single source of truth** - advanced-alchemy is the only place for SQLAlchemy integration
3. **Easier maintenance** - No need to keep re-export layers in sync
4. **Clear dependency** - Users know they need advanced-alchemy for SQLAlchemy support
## Testing
- ✅ All tests pass
- ✅ Type checking passes (mypy and pyright)
- ✅ Linting passes
- ✅ Documentation examples work with new imports
- ✅ SQLAlchemy example tests pass
## Coordination Note
This work was coordinated after PR #4337 (removing `litestar.contrib.repository`) was merged.1 parent 510b202 commit 08297fd
116 files changed
Lines changed: 622 additions & 2162 deletions
File tree
- docs
- examples
- data_transfer_objects/factory
- pagination
- plugins
- sqlalchemy_init_plugin
- sqlalchemy
- sqla
- plugins
- tutorial
- websockets
- reference
- contrib
- sqlalchemy
- plugins
- release-notes
- tutorials
- repository-tutorial
- sqlalchemy
- usage
- databases/sqlalchemy
- plugins
- plugins
- litestar
- contrib/sqlalchemy
- plugins
- init
- config
- repository
- plugins
- tests
- e2e
- examples
- test_contrib/test_sqlalchemy
- plugins
- test_plugins
- unit
- test_contrib
- test_dto/test_factory
- test_plugins
- test_repository
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
| 157 | + | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 172 | + | |
177 | 173 | | |
178 | 174 | | |
179 | 175 | | |
| |||
208 | 204 | | |
209 | 205 | | |
210 | 206 | | |
| 207 | + | |
| 208 | + | |
211 | 209 | | |
212 | 210 | | |
213 | 211 | | |
| |||
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
223 | | - | |
224 | 221 | | |
225 | 222 | | |
226 | 223 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments