Skip to content

Commit 795d8de

Browse files
committed
Include driver eligibility in Dolt write capability
1 parent 5d4e46c commit 795d8de

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/openstatspec/sql/capabilities.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ def _bound_specification_commit() -> str:
5959
return SPECIFICATION_COMMIT
6060

6161

62+
def _dolt_driver_eligible(database_url: str) -> bool:
63+
return make_url(database_url).drivername.lower() == "mysql+pymysql"
64+
65+
6266
def _dolt_write_enabled(
6367
source: DoltConformanceSource | None = None,
6468
*,
@@ -235,6 +239,10 @@ def active_connection(
235239
if profile_name == "dolt" else None
236240
),
237241
"observed": observed,
242+
"driver_eligible": (
243+
_dolt_driver_eligible(database_url)
244+
if profile_name == "dolt" else True
245+
),
238246
}
239247

240248

@@ -270,7 +278,7 @@ def effective_profile(
270278
raise UnsupportedOperationError("The active SQL server is not a claimed MySQL-wire product.")
271279
if (
272280
active["profile"] == "dolt"
273-
and make_url(database_url).drivername.lower() != "mysql+pymysql"
281+
and not active["driver_eligible"]
274282
):
275283
raise UnsupportedOperationError(
276284
"Dolt requires an explicit mysql+pymysql URL."
@@ -488,7 +496,7 @@ def _profile(
488496
}
489497
),
490498
"operational_write_enabled": (
491-
dolt_declaration is not None
499+
dolt_declaration is not None and bool(active["driver_eligible"])
492500
if dolt_envelope and active and active["profile"] == name
493501
else bool((dolt_status or {}).get("write_enabled"))
494502
if dolt_envelope else True

0 commit comments

Comments
 (0)