You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
version_locations doesn't support directories with spaces (e.g. C:\Program Files\MyApp) #842
Space is used a path separator in version_locations. As a result, it's not possible to set custom version_locations to a directory that contains spaces (e.g. C:\Program Files\MyApp)
introduce new config variable "version_path_separator". This config value may have the following values:
# colon
version_path_separator = :
# semicolon
version_path_separator = ;
# use the value of os.pathsep; colon for unix, semicolon for windows
version_path_separator = os
# use a space character
version_path_separator = space
if the value is outside of those, raise an error, rather than silently failing / ignoring
within each alembic.ini.mako, add version_path_separator = os , so that new installations will default to using the os.path separator
update the sample version location doc:
# version location specification; this defaults
# to ${script_location}/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# the path separator used here should be the separator specified by "version_path_separator"
# version_locations = %(here)s/bar:%(here)s/bat:${script_location}/versions
for a config where version_path_separator is totally absent from the config, the default value is the space character for backwards compat concerns
tests added in tests/test_script_production.py -> NormPathTest, likely allowing _multi_dir_testing_config to accept additional pathseps
OK so yes we can have set_main_option accept a list, if it doesn't already. i guess the poster didn't indicate "how do i put this in my alembic.ini file", but I think we should address that also. hows that?
IMO I don't think json is the most traditional approach for .ini file values, particularly paths as that's what os.pathsep is for. I think sticking with os.pathsep with options to customize for backwards compatibility will be a simpler approach with better backwards compatibility and easier to understand.
Activity
zzzeek commentedon May 12, 2021
resolution proposal
if the value is outside of those, raise an error, rather than silently failing / ignoring
within each alembic.ini.mako, add
version_path_separator = os, so that new installations will default to using the os.path separatorupdate the sample version location doc:
for a config where version_path_separator is totally absent from the config, the default value is the space character for backwards compat concerns
tests added in tests/test_script_production.py -> NormPathTest, likely allowing _multi_dir_testing_config to accept additional pathseps
CaselIT commentedon May 12, 2021
If instead we use a
\as the escape for the space, like the linux shell?CaselIT commentedon May 12, 2021
I guess the issue is that it's a bit strange to express for windows like paths:
zzzeek commentedon May 12, 2021
yeah it's not going to work with straight up windows paths and neither is colon as a pathsep
gordthompson commentedon Jun 12, 2021
If the user wants to pass a
version_locationspath that includes spaces, why not just pass it/them as a list?zzzeek commentedon Jun 12, 2021
what does one put in the alembic.ini file for those? i thought that was the issue here.
gordthompson commentedon Jun 12, 2021
The repro code in the issue report uses
so I was suggesting that it be
with the corresponding changes in the code that parses it, of course.
zzzeek commentedon Jun 12, 2021
OK so yes we can have set_main_option accept a list, if it doesn't already. i guess the poster didn't indicate "how do i put this in my alembic.ini file", but I think we should address that also. hows that?
gordthompson commentedon Jun 12, 2021
Sure. A list in the .ini file would just be the string JSON representation:
sqla-tester commentedon Jun 12, 2021
Gord Thompson has proposed a fix for this issue in the master branch:
Support version_locations paths with spaces https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/2869
zzzeek commentedon Jun 14, 2021
IMO I don't think json is the most traditional approach for .ini file values, particularly paths as that's what os.pathsep is for. I think sticking with os.pathsep with options to customize for backwards compatibility will be a simpler approach with better backwards compatibility and easier to understand.
Support version_locations paths with spaces