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

Add sqlite_stat1(-4) tables to hidden table list #1587

Closed
simonw opened this issue Jan 8, 2022 · 2 comments
Closed

Add sqlite_stat1(-4) tables to hidden table list #1587

simonw opened this issue Jan 8, 2022 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Jan 8, 2022

Running ANALYZE creates a new visible table called sqlite_stat1: https://www.sqlite.org/fileformat.html#the_sqlite_stat1_table

This should be added to the default list of hidden tables in Datasette.

@simonw
Copy link
Owner Author

simonw commented Jan 8, 2022

Depending on the SQLite version (and compile options) that ran ANALYZE these can be called:

  • sqlite_stat1
  • sqlite_stat2
  • sqlite_stat3
  • sqlite_stat4

@simonw
Copy link
Owner Author

simonw commented Jan 8, 2022

Relevant code:

async def hidden_table_names(self):
# Mark tables 'hidden' if they relate to FTS virtual tables
hidden_tables = [
r[0]
for r in (
await self.execute(
"""
select name from sqlite_master
where rootpage = 0
and sql like '%VIRTUAL TABLE%USING FTS%'
"""
)
).rows
]
has_spatialite = await self.execute_fn(detect_spatialite)
if has_spatialite:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant