I am trying to enable Alembic migrations as part of the python package distribution. Since this distribution will be installed, the Alembic script directory (which contains the migrations) will eventually be copied to the python package folders. In this case, how can I tell Alembic where to find this directory?
The Alembic documentation says that the migration directory can be specified in the config.ini file as a package reference:
- script_location is the location of the Alembic environment. This is usually indicated as the location of the file system, either relative or absolute. If the location is a relative path, it is interpreted as relative to the current directory.
(notch)
To support applications that pack themselves into .egg files, the value can also be specified as a package resource, in which case resource_filename () is used to search for a file (new in 0.2.2). Any non-absolute URI that contains colons is interpreted here as the name of the resource, not the direct name of the file.
The documentation does not provide additional information or examples.
Has anyone successfully implemented this? How exactly do you turn your migration scripting_folder into a "package resource"? How then do you say alembic where to find it?
source share