alembic icon indicating copy to clipboard operation
alembic copied to clipboard

Add colon (:) to invalid char for revision name

Open PatilHrushikesh opened this issue 1 year ago • 7 comments

FIXES #1540

Description

As colon is used in revision range, it shouldn't be used in revision name.

Checklist

This pull request is:

  • [ ] A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • [x] A short code fix
    • please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • [ ] A new feature implementation
    • please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

PatilHrushikesh avatar Sep 22 '24 18:09 PatilHrushikesh

it's too bad because the colon isn't any problem for the revision API, it's just used by the command interface. colon could be supported if the command interface had a function that parsed for quoted revision names. but then we'd probably want quotes added to the illegal chars also

zzzeek avatar Sep 22 '24 18:09 zzzeek

Can you explain

it's just used by the command interface.

Yeah, and it's causing issue mentioned in ticket, is there better way to fix it?

quoted revision

How does quoted revision comes into the picture?

PatilHrushikesh avatar Sep 23 '24 04:09 PatilHrushikesh

the colon is only parsed inside of command.py, it's not used in revision.py

we could also say that we would support this syntax:

alembic upgrade --sql "some:rev":ae5c

however, there's no compelling reason for that ...

zzzeek avatar Sep 23 '24 12:09 zzzeek

I think the solution proposed in this PR is likely easier to implement. What do you think mike?

CaselIT avatar Sep 23 '24 17:09 CaselIT

it is. can you add a changelog and do we have illegal char tests set up? we should

zzzeek avatar Sep 23 '24 17:09 zzzeek

@PatilHrushikesh

  • could you add an additional case (or edit an existing one) here https://github.com/sqlalchemy/alembic/blob/9cc68f5e89183e3c5634ac892bf7819dfc90a8d5/tests/test_script_production.py#L347-L390 to have a :?
  • could you add a changelog entry here? examples are here https://github.com/sqlalchemy/alembic/tree/3db374f19760320507a96443e29d19835654b2ec/docs/build/unreleased the number is the issue id

Thanks!

CaselIT avatar Sep 23 '24 17:09 CaselIT

is this PR stalled ? it needs the additional change as well as a unit test

zzzeek avatar Nov 06 '24 20:11 zzzeek

superseded by #1741 ; i gave both authors credit

zzzeek avatar Oct 28 '25 13:10 zzzeek