sqlalchemy / sqlalchemy/alembic
Is it possible to print SQL of the last revision in one command?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 375
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to print SQL of the last revision in one command.
I can do it like this:
alembic upgrade --sql 5fb648aeb2e7:head
But it's necessary to do alembic history first to get the second last id.
There are relative migration identifies. I've tried:
alembic upgrade --sql +1
alembic upgrade --sql +0
, but it doesn't print the last only migration.
How to do it in one command?
Contributor 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.
Research direction
Start with the alembic upgrade --sql and alembic history command paths described in the issue, including how relative migration identifiers are handled. Determine how one command could select only the last migration and verify that it prints SQL for that migration without requiring a separate history lookup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sql, sqlalchemy
- Domain
- cli, database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100