fix: remove SQLite fallback code from db_engine.py (#70) #89
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#89
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/70-remove-sqlite-fallback-code-from-db-engine-py"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #70
Summary
Removes the
DATABASE_TYPEconditional that allowed falling back to SQLite. PostgreSQL is now the only supported backend, consistent with project policy.Changes
DATABASE_TYPE = os.environ.get('DATABASE_TYPE', 'sqlite')and the entire if/else branchfrom playhouse.pool import PooledPostgresqlDatabaseto top-level imports_postgres_passwordcheck: raisesRuntimeError('POSTGRES_PASSWORD environment variable is required')at startup if the env var is unset — prevents silent misconnection with misleading errors'sba_dev_password_2024'fallback password (same credential removed by PR #84 — included here since #84 is not yet merged; one of these will need a rebase)Files Changed
app/db_engine.py— 27 lines removed, 17 lines added (net -10)Other observations
timeout=0andautoconnect=Trueremain as-is (PR #87 addresses these — out of scope here).Review: APPROVED
Clean, correct removal of dead SQLite fallback code. PostgreSQL-only is consistent with project policy and all existing deployments.
What the PR does
DATABASE_TYPEenv var and the entireif/elsebranch — SQLite path was never used in productionfrom playhouse.pool import PooledPostgresqlDatabaseto top-level imports (correct per CLAUDE.md: no lazy imports in middle of file)_postgres_password is None→RuntimeErrorat startup — matches PR #84's approach exactlyChecks
Correctness:
PooledPostgresqlDatabaseconstructor call is identical to the old PostgreSQL branch — no behavioural change for existing deployments.Import ordering:
from playhouse.pool import PooledPostgresqlDatabaseis correctly placed betweenfrom peewee import ModelSelectandfrom playhouse.shortcuts import model_to_dict— alphabetically consistent.Password guard:
_postgres_password is Nonecheck is correct. Same edge case as PR #84:POSTGRES_PASSWORD=""passes theis Nonecheck and forwards an empty string to PostgreSQL → connection-time failure. Acceptable in practice (empty password is not a valid config).SqliteDatabasesymbol: Still available viafrom peewee import *but now unused. Not a problem — wildcard import, no action needed.Rebase notes
This PR overlaps with two already-approved PRs:
_postgres_password/RuntimeErrorpattern. Whichever merges second will have a trivial conflict at lines 14–21 ofdb_engine.py. One-line rebase.timeout=0→timeout=5andautoconnect=True→autoconnect=Falseinside the samePooledPostgresqlDatabase(...)block. If #87 merges first, this PR will need those two parameter values updated before merge.Merge order recommendation: #84 → #89 → #87 (or #89 → #84 → #87). Either way, #87 should go last since it modifies the constructor parameters that now live in the unconditional block introduced here.
No issues found
LGTM. ✓
Checkout
From your project repository, check out a new branch and test the changes.