Fix SQLite server_default AttributeError and pool_size errors (#35)
CI / lint (push) Failing after 6s
CI / typecheck (push) Failing after 30s
CI / test (push) Failing after 1m34s
CI / build-and-push (push) Has been skipped

Fix SQLite server_default AttributeError and pool_size errors

Co-authored-by: Barcode Betty <32+cs_betty@noreply.git.farh.net>
Co-committed-by: Barcode Betty <32+cs_betty@noreply.git.farh.net>
This commit was merged in pull request #35.
This commit is contained in:
2026-06-01 12:38:21 +00:00
committed by Savannah Savings
parent 84c143c4e7
commit ebf69976d4
3 changed files with 25 additions and 9 deletions
+7 -1
View File
@@ -53,7 +53,7 @@ def disable_rate_limiting():
def engine():
"""Sync in-memory SQLite engine for model unit tests.
Strips PostgreSQL-specific server_default expressions so SQLite can
Strips ALL PostgreSQL-specific server_default expressions so SQLite can
handle all column inserts without missing-function errors.
"""
eng = create_engine("sqlite:///:memory:")
@@ -62,6 +62,9 @@ def engine():
for col in table.columns.values():
sd = col.server_default
if sd is not None:
if not hasattr(sd, "expression"):
col.server_default = None
continue
expr_str = str(sd.expression).lower()
if "gen_random_uuid" in expr_str or "gen_random_bytes" in expr_str:
col.server_default = None
@@ -93,6 +96,9 @@ async def db_engine():
for col in table.columns.values():
sd = col.server_default
if sd is not None:
if not hasattr(sd, "expression"):
col.server_default = None
continue
expr_str = str(sd.expression).lower()
if "gen_random_uuid" in expr_str or "gen_random_bytes" in expr_str:
col.server_default = None
+3
View File
@@ -22,6 +22,9 @@ def engine():
for col in table.columns.values():
sd = col.server_default
if sd is not None:
if not hasattr(sd, "expression"):
col.server_default = None
continue
expr_str = str(sd.expression).lower()
if "gen_random_uuid" in expr_str or "gen_random_bytes" in expr_str:
col.server_default = None