Skip to content

Commit b38350c

Browse files
committed
Centralize Dolt operational eligibility
1 parent cab47e9 commit b38350c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/openstatspec/sql/capabilities.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ def _dolt_driver_eligible(database_url: str) -> bool:
6363
return make_url(database_url).drivername.lower() == "mysql+pymysql"
6464

6565

66+
def dolt_operational_write_enabled(
67+
active: Mapping[str, Any], *, declaration_matched: bool,
68+
) -> bool:
69+
"""Require both exact declaration and claimed active driver for writes."""
70+
return declaration_matched and bool(active.get("driver_eligible", False))
71+
72+
6673
def _dolt_write_enabled(
6774
source: DoltConformanceSource | None = None,
6875
*,
@@ -496,7 +503,9 @@ def _profile(
496503
}
497504
),
498505
"operational_write_enabled": (
499-
dolt_declaration is not None and bool(active["driver_eligible"])
506+
dolt_operational_write_enabled(
507+
active, declaration_matched=dolt_declaration is not None,
508+
)
500509
if dolt_envelope and active and active["profile"] == name
501510
else bool((dolt_status or {}).get("write_enabled"))
502511
if dolt_envelope else True

0 commit comments

Comments
 (0)