high-agent-21601
07/10/2023, 4:23 PMresource(
name="alembic_conf",
source="alembic.ini"
)
python_sources(
name="migrations",
sources=[
"alembic/**/*.py",
],
)
pex_binary(
name="migration_bin",
script="alembic",
dependencies=[
":alembic_conf",
":poetry",
":migrations"
],
args=[
"upgrade",
"head",
]
)
When I unpack pex, I can see alembic.ini in there. Could someont point me what am I doing wrong here ?refined-addition-53644
07/10/2023, 4:31 PMhigh-agent-21601
07/10/2023, 4:35 PMenough-analyst-54434
07/10/2023, 4:41 PMenough-analyst-54434
07/10/2023, 4:52 PM__file__
location and deriving a good -c ...
from that info that it uses to re-exec with.better-van-82973
07/10/2023, 5:21 PMalembic
executable. Here is my script:
import os
from alembic.config import Config
from alembic import command
def run_alembic_migrations():
# Get a string path to the file alembic.ini in the same directory as this file
alembic_cfg = Config(os.path.join(os.path.dirname(__file__), "alembic.ini"))
# Override script_location with environment variable if it's set
alembic_script_location = os.getenv("ALEMBIC_EXECUTABLE_LOCATION")
if alembic_script_location:
alembic_cfg.set_main_option("script_location", alembic_script_location)
command.upgrade(alembic_cfg, "head")
high-agent-21601
07/10/2023, 9:42 PMbetter-van-82973
07/10/2023, 9:43 PM