From 2dec1e33c2994dc8751161e03fefa519da92ee31 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Thu, 3 Jul 2025 11:18:35 +0300 Subject: [PATCH] [+] improve alembic --- deps/test-task-2025-06-30-v1/Makefile | 3 ++- deps/test-task-2025-06-30-v1/pyproject.toml | 1 + .../pr34/test_task_2025_06_30_v1/tickers/alembic/env.py | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deps/test-task-2025-06-30-v1/Makefile b/deps/test-task-2025-06-30-v1/Makefile index 102d940..87dade2 100644 --- a/deps/test-task-2025-06-30-v1/Makefile +++ b/deps/test-task-2025-06-30-v1/Makefile @@ -1,4 +1,5 @@ ENV_PATH ?= .venv +PYTHON_PATH = $(ENV_PATH)/bin/python3 PYTHON_VERSION ?= 3.10 UV_ARGS ?= --offline DOCKER ?= podman @@ -33,7 +34,7 @@ venv: pyright: $(ENV_PATH)/bin/python3 -m pyright \ -p pyproject.toml \ - -v $(ENV_PATH) + --pythonpath $(PYTHON_PATH) compose_env: diff --git a/deps/test-task-2025-06-30-v1/pyproject.toml b/deps/test-task-2025-06-30-v1/pyproject.toml index cf2081a..6b94c5a 100644 --- a/deps/test-task-2025-06-30-v1/pyproject.toml +++ b/deps/test-task-2025-06-30-v1/pyproject.toml @@ -33,6 +33,7 @@ build-backend = 'setuptools.build_meta' [tool.alembic] script_location = 'python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic' +prepend_sys_path = ['python'] [tool.ruff] line-length = 160 diff --git a/deps/test-task-2025-06-30-v1/python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic/env.py b/deps/test-task-2025-06-30-v1/python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic/env.py index 36112a3..85b8cd8 100644 --- a/deps/test-task-2025-06-30-v1/python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic/env.py +++ b/deps/test-task-2025-06-30-v1/python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic/env.py @@ -27,6 +27,8 @@ target_metadata = None def run_migrations_offline() -> None: + from online.fxreader.pr34.test_task_2025_06_30_v1.tickers.settings import Settings + """Run migrations in 'offline' mode. This configures the context with just a URL @@ -38,7 +40,9 @@ def run_migrations_offline() -> None: script output. """ - url = config.get_main_option("sqlalchemy.url") + # url = config.get_main_option("sqlalchemy.url") + url = Settings.singleton().db_url + context.configure( url=url, target_metadata=target_metadata,