-
-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Labels
Description
Describe the bug
Adding truncate_slug_length
to pyproject.toml
causes "FAILED: unsupported TOML value type for key: 'truncate_slug_length'" when running `alembic revision -m "message"``
Expected behavior
- For it to work
- For it to truncate the slug
To Reproduce
- initialize alembic with
alembic init --template pyproject alembic --package
- Uncomment/add
truncate_slug_length
- Run
alembic revision -m "message"
pyproject.toml
[tool.alembic]
# path to migration scripts.
# this is typically a path given in POSIX (e.g. forward slashes)
# format, relative to the token %(here)s which refers to the location of this
# ini file
script_location = "%(here)s/alembic"
truncate_slug_length = 5
#...
Error
PS XXX> alembic --raiseerr revision -m "Increase some columns length"
Traceback (most recent call last):
File "XXX\AppData\Roaming\uv\python\cpython-3.10.18-windows-x86_64-none\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "XXX\AppData\Roaming\uv\python\cpython-3.10.18-windows-x86_64-none\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "XXX\.venv\Scripts\alembic.exe\__main__.py", line 10, in <module>
File "XXX\.venv\lib\site-packages\alembic\config.py", line 1016, in main
CommandLine(prog=prog).main(argv=argv)
File "XXX\.venv\lib\site-packages\alembic\config.py", line 1006, in main
self.run_cmd(cfg, options)
File "XXX\.venv\lib\site-packages\alembic\config.py", line 940, in run_cmd
fn(
File "XXX\.venv\lib\site-packages\alembic\command.py", line 252, in revision
script_directory = ScriptDirectory.from_config(config)
File "XXX\.venv\lib\site-packages\alembic\script\base.py", line 179, in from_config
tsl = config.get_alembic_option("truncate_slug_length")
File "XXX\.venv\lib\site-packages\alembic\config.py", line 456, in get_alembic_option
return self._get_toml_config_value(name, default=default)
File "XXX\.venv\lib\site-packages\alembic\config.py", line 499, in _get_toml_config_value
raise util.CommandError(
alembic.util.exc.CommandError: unsupported TOML value type for key: 'truncate_slug_length'
Versions.
- OS: Windows 11 Business 24H2
- Python: 3.10.18
- Alembic: 1.16.4
- SQLAlchemy: 1.4.54
- Database: PostgreSQL
- DBAPI: psycopg2==2.9.9
Have a nice day!