diff --git a/tools/.env.example b/tools/.env.example index 4b464c5..880b501 100644 --- a/tools/.env.example +++ b/tools/.env.example @@ -3,7 +3,7 @@ # Authors: # imacat@mail.imacat.idv.tw (imacat), 2026/7/31 -# The SQLAlchemy database URL. -SQLALCHEMY_DATABASE_URL="postgresql://user:password@host/db" +# The SQLAlchemy database URI. +SQLALCHEMY_DATABASE_URI="postgresql://user:password@host/db" # The Anthropic API key ANTHROPIC_API_KEY=sk-ant-... diff --git a/tools/src/pop_fem_audit_tools/config.py b/tools/src/pop_fem_audit_tools/config.py index 70b1cd7..69df989 100644 --- a/tools/src/pop_fem_audit_tools/config.py +++ b/tools/src/pop_fem_audit_tools/config.py @@ -14,7 +14,7 @@ class Settings(BaseSettings): """The application name.""" admin_email: str = "imacat@mail.imacat.idv.tw" """The administrator email address.""" - SQLALCHEMY_DATABASE_URL: str + SQLALCHEMY_DATABASE_URI: str """The SQLAlchemy database URL.""" ANTHROPIC_API_KEY: str """The Anthropic API key.""" diff --git a/tools/src/pop_fem_audit_tools/database.py b/tools/src/pop_fem_audit_tools/database.py index 6140cc2..94b1356 100644 --- a/tools/src/pop_fem_audit_tools/database.py +++ b/tools/src/pop_fem_audit_tools/database.py @@ -30,7 +30,7 @@ class DataSource: :return: The database engine. """ settings: Settings = get_settings() - return self.__create_engine(settings.SQLALCHEMY_DATABASE_URL) + return self.__create_engine(settings.SQLALCHEMY_DATABASE_URI) @cached_property def __session_local(self) -> sessionmaker: diff --git a/tools/tests/test_build_db.py b/tools/tests/test_build_db.py index 8c1dd8d..e5a7b65 100644 --- a/tools/tests/test_build_db.py +++ b/tools/tests/test_build_db.py @@ -278,7 +278,7 @@ class TestBuildDB(unittest.TestCase): self.__annotations: Path = self.__dir / "annotations.csv" self.__write_chart(self.CHART_CSV) config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose) diff --git a/tools/tests/test_export_llm_input.py b/tools/tests/test_export_llm_input.py index d85bd73..df1867d 100644 --- a/tools/tests/test_export_llm_input.py +++ b/tools/tests/test_export_llm_input.py @@ -36,7 +36,7 @@ class TestExportLlmInput(unittest.TestCase): self.__dir: Path = Path(tmp.name) self.__output: Path = self.__dir / "llm-input.jsonl" config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose) diff --git a/tools/tests/test_fetch_artists.py b/tools/tests/test_fetch_artists.py index 8b5e362..0882294 100644 --- a/tools/tests/test_fetch_artists.py +++ b/tools/tests/test_fetch_artists.py @@ -45,7 +45,7 @@ class TestFetchArtists(unittest.TestCase): self.__snapshot: Path = \ self.__dir / "artists_wikidata.csv" config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose) diff --git a/tools/tests/test_fetch_lyrics.py b/tools/tests/test_fetch_lyrics.py index 64f0e51..634e04c 100644 --- a/tools/tests/test_fetch_lyrics.py +++ b/tools/tests/test_fetch_lyrics.py @@ -44,7 +44,7 @@ class TestFetchLyrics(unittest.TestCase): self.__provenance: Path = \ self.__dir / "lyrics-provenance.csv" config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose) diff --git a/tools/tests/test_models.py b/tools/tests/test_models.py index c36fbb4..d9188ac 100644 --- a/tools/tests/test_models.py +++ b/tools/tests/test_models.py @@ -27,7 +27,7 @@ class TestModels(unittest.TestCase): def setUp(self) -> None: """Create the schema on an in-memory SQLite database.""" config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose) diff --git a/tools/tests/test_run_llm.py b/tools/tests/test_run_llm.py index c8f908a..4be49c0 100644 --- a/tools/tests/test_run_llm.py +++ b/tools/tests/test_run_llm.py @@ -240,7 +240,7 @@ class TestMainFlow(RunLLMTestCase): str(self.__prompt), str(self.__input), str(self.__archive_dir)] self.__settings: config.Settings = config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key") config.set_settings(self.__settings) diff --git a/tools/tests/test_tally_annotations.py b/tools/tests/test_tally_annotations.py index 9ddab7c..1072ee2 100644 --- a/tools/tests/test_tally_annotations.py +++ b/tools/tests/test_tally_annotations.py @@ -50,7 +50,7 @@ class TestTallyAnnotations(unittest.TestCase): run_dir.mkdir() self.__runs.append(run_dir) config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose) diff --git a/tools/tests/test_tally_codings.py b/tools/tests/test_tally_codings.py index 7b82ce0..722ef80 100644 --- a/tools/tests/test_tally_codings.py +++ b/tools/tests/test_tally_codings.py @@ -39,7 +39,7 @@ class TestTallyCodings(unittest.TestCase): self.__output_csv: Path \ = self.__dir / "results" / "codings.csv" config.set_settings(config.Settings( - SQLALCHEMY_DATABASE_URL="sqlite://", + SQLALCHEMY_DATABASE_URI="sqlite://", ANTHROPIC_API_KEY="test-key")) self.__ds: DataSource = DataSource() self.addCleanup(self.__ds.engine.dispose)