Generated migrations carry an unused import sqlmodel
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read alembic/script.py.mako and alembic/env.py, then check the generated migrations to see which ones use SQLModel types. Remove the unconditional import and add a render_item hook that imports SQLModel only when rendering its types; done when autogenerate includes the import only for migrations that need it.
Written by the indexing model from the issue text.
Description
Every migration that alembic revision --autogenerate writes starts with import sqlmodel, because alembic/script.py.mako includes it unconditionally. Alembic writes a SQLModel type such as AutoString as sqlmodel.sql.sqltypes.AutoString() without importing the module, so the migrations that use one need the import. Most migrations use none and carry it unused (8 of the current 13), and since generated migrations are never edited, it stays.
Fix: drop the line from the template, and add a render_item hook in alembic/env.py that adds import sqlmodel to autogen_context.imports when it renders a type from the sqlmodel package, returning False so Alembic still renders the type itself. Existing migrations stay as they are.
- Dominant language
- Python
- Stars
- 0
- Forks
- 3
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 57
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ukaea/fds
-
api metadata
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Use registered media types for HDF5 and NetCDF, and stop claiming media_type must be IANA-registeredOpendocumentation metadata
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
Media typeOpen
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
auth
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
fair-compliance metadata
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Treat corrupt-shape state files as missing in `load_state`Possibly taken @Qrytics claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
OvertureMaps/overturemaps-py#175 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
awslabs/visual-asset-management-system#1278 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws-samples/sample-per-model-bedrock#835 ·
Maintainers usually reply within 1 day