sqlalchemy / sqlalchemy/alembic

Allow overriding of script.py.mako path in generate_revision

Open
#581 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature migration environment
Dominant language
Python
Stars
4.4k
Forks
375
PR merge metrics
No merged PRs in 30d

Description

We have a use case where our script.py.mako is stored in a central location to be shared by multiple sets of alembic revisions. We currently just copy it into each project's scripts directory but that's not ideal.

It looks like this could be allowed by adding an optional kw arg to generate_revision which is then passed into _generate_template, using the existing value as a default.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in alembic/script/base.py at generate_revision and follow its call to _generate_template. Add the optional template-path input while preserving the existing script.py.mako default; done means revisions can use a shared template location without copying the file into each scripts directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
database
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.