kopia lustrzana https://github.com/simonw/datasette
Hidden tables sqlite1/2/3/4, closes #1587
rodzic
cb29119db9
commit
58652dd925
|
|
@ -345,7 +345,9 @@ class Database:
|
||||||
"""
|
"""
|
||||||
select name from sqlite_master
|
select name from sqlite_master
|
||||||
where rootpage = 0
|
where rootpage = 0
|
||||||
and sql like '%VIRTUAL TABLE%USING FTS%'
|
and (
|
||||||
|
sql like '%VIRTUAL TABLE%USING FTS%'
|
||||||
|
) or name in ('sqlite_stat1', 'sqlite_stat2', 'sqlite_stat3', 'sqlite_stat4')
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
).rows
|
).rows
|
||||||
|
|
|
||||||
|
|
@ -1030,3 +1030,15 @@ async def test_db_path(app_client):
|
||||||
|
|
||||||
# Previously this broke if path was a pathlib.Path:
|
# Previously this broke if path was a pathlib.Path:
|
||||||
await datasette.refresh_schemas()
|
await datasette.refresh_schemas()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_hidden_sqlite_stat1_table():
|
||||||
|
ds = Datasette()
|
||||||
|
db = ds.add_memory_database("db")
|
||||||
|
await db.execute_write("create table normal (id integer primary key, name text)")
|
||||||
|
await db.execute_write("create index idx on normal (name)")
|
||||||
|
await db.execute_write("analyze")
|
||||||
|
data = (await ds.client.get("/db.json?_show_hidden=1")).json()
|
||||||
|
tables = [(t["name"], t["hidden"]) for t in data["tables"]]
|
||||||
|
assert tables == [("normal", False), ("sqlite_stat1", True)]
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue