Rename SQLALCHEMY_DATABASE_URL to SQLALCHEMY_DATABASE_URI to follow SQLAlchemy conventions.

This commit is contained in:
2026-08-21 08:10:21 +08:00
parent 9b6450fcbb
commit 47bef84e7b
11 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
# Authors: # Authors:
# imacat@mail.imacat.idv.tw (imacat), 2026/7/31 # imacat@mail.imacat.idv.tw (imacat), 2026/7/31
# The SQLAlchemy database URL. # The SQLAlchemy database URI.
SQLALCHEMY_DATABASE_URL="postgresql://user:password@host/db" SQLALCHEMY_DATABASE_URI="postgresql://user:password@host/db"
# The Anthropic API key # The Anthropic API key
ANTHROPIC_API_KEY=sk-ant-... ANTHROPIC_API_KEY=sk-ant-...
+1 -1
View File
@@ -14,7 +14,7 @@ class Settings(BaseSettings):
"""The application name.""" """The application name."""
admin_email: str = "imacat@mail.imacat.idv.tw" admin_email: str = "imacat@mail.imacat.idv.tw"
"""The administrator email address.""" """The administrator email address."""
SQLALCHEMY_DATABASE_URL: str SQLALCHEMY_DATABASE_URI: str
"""The SQLAlchemy database URL.""" """The SQLAlchemy database URL."""
ANTHROPIC_API_KEY: str ANTHROPIC_API_KEY: str
"""The Anthropic API key.""" """The Anthropic API key."""
+1 -1
View File
@@ -30,7 +30,7 @@ class DataSource:
:return: The database engine. :return: The database engine.
""" """
settings: Settings = get_settings() settings: Settings = get_settings()
return self.__create_engine(settings.SQLALCHEMY_DATABASE_URL) return self.__create_engine(settings.SQLALCHEMY_DATABASE_URI)
@cached_property @cached_property
def __session_local(self) -> sessionmaker: def __session_local(self) -> sessionmaker:
+1 -1
View File
@@ -278,7 +278,7 @@ class TestBuildDB(unittest.TestCase):
self.__annotations: Path = self.__dir / "annotations.csv" self.__annotations: Path = self.__dir / "annotations.csv"
self.__write_chart(self.CHART_CSV) self.__write_chart(self.CHART_CSV)
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)
+1 -1
View File
@@ -36,7 +36,7 @@ class TestExportLlmInput(unittest.TestCase):
self.__dir: Path = Path(tmp.name) self.__dir: Path = Path(tmp.name)
self.__output: Path = self.__dir / "llm-input.jsonl" self.__output: Path = self.__dir / "llm-input.jsonl"
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)
+1 -1
View File
@@ -45,7 +45,7 @@ class TestFetchArtists(unittest.TestCase):
self.__snapshot: Path = \ self.__snapshot: Path = \
self.__dir / "artists_wikidata.csv" self.__dir / "artists_wikidata.csv"
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)
+1 -1
View File
@@ -44,7 +44,7 @@ class TestFetchLyrics(unittest.TestCase):
self.__provenance: Path = \ self.__provenance: Path = \
self.__dir / "lyrics-provenance.csv" self.__dir / "lyrics-provenance.csv"
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)
+1 -1
View File
@@ -27,7 +27,7 @@ class TestModels(unittest.TestCase):
def setUp(self) -> None: def setUp(self) -> None:
"""Create the schema on an in-memory SQLite database.""" """Create the schema on an in-memory SQLite database."""
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)
+1 -1
View File
@@ -240,7 +240,7 @@ class TestMainFlow(RunLLMTestCase):
str(self.__prompt), str(self.__input), str(self.__prompt), str(self.__input),
str(self.__archive_dir)] str(self.__archive_dir)]
self.__settings: config.Settings = config.Settings( self.__settings: config.Settings = config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key") ANTHROPIC_API_KEY="test-key")
config.set_settings(self.__settings) config.set_settings(self.__settings)
+1 -1
View File
@@ -50,7 +50,7 @@ class TestTallyAnnotations(unittest.TestCase):
run_dir.mkdir() run_dir.mkdir()
self.__runs.append(run_dir) self.__runs.append(run_dir)
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)
+1 -1
View File
@@ -39,7 +39,7 @@ class TestTallyCodings(unittest.TestCase):
self.__output_csv: Path \ self.__output_csv: Path \
= self.__dir / "results" / "codings.csv" = self.__dir / "results" / "codings.csv"
config.set_settings(config.Settings( config.set_settings(config.Settings(
SQLALCHEMY_DATABASE_URL="sqlite://", SQLALCHEMY_DATABASE_URI="sqlite://",
ANTHROPIC_API_KEY="test-key")) ANTHROPIC_API_KEY="test-key"))
self.__ds: DataSource = DataSource() self.__ds: DataSource = DataSource()
self.addCleanup(self.__ds.engine.dispose) self.addCleanup(self.__ds.engine.dispose)