Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: correctly detect json1 in versions.json #2327

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
async_call_with_supported_arguments,
await_me_maybe,
call_with_supported_arguments,
detect_json1,
display_actor,
escape_css_string,
escape_sqlite,
Expand Down Expand Up @@ -1102,9 +1103,8 @@ def _versions(self):
conn = sqlite3.connect(":memory:")
self._prepare_connection(conn, "_memory")
sqlite_version = conn.execute("select sqlite_version()").fetchone()[0]
sqlite_extensions = {}
sqlite_extensions = {"json1": detect_json1(conn)}
for extension, testsql, hasversion in (
("json1", "SELECT json('{}')", False),
("spatialite", "SELECT spatialite_version()", True),
):
try:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,10 @@ async def test_versions_json(ds_client):
assert "version" in data["sqlite"]
assert "fts_versions" in data["sqlite"]
assert "compile_options" in data["sqlite"]
# By default, the json1 extension is enabled in the SQLite
# provided by the `ubuntu-latest` github actions runner, and
# all versions of SQLite from 3.38.0 onwards
assert data["sqlite"]["extensions"]["json1"]


@pytest.mark.asyncio
Expand Down
Loading