-
-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Description
If your internal.db is persistent and it has records in catalog_databases for databases that are no longer attached you get a 500 KeyError on the index page thanks to this code:
datasette/datasette/views/index.py
Lines 31 to 50 in 68f1179
| db_page = await self.ds.allowed_resources( | |
| "view-database", request.actor, include_is_private=True | |
| ) | |
| allowed_databases = [r async for r in db_page.all()] | |
| allowed_db_dict = {r.parent: r for r in allowed_databases} | |
| # Group tables by database | |
| tables_by_db = {} | |
| table_page = await self.ds.allowed_resources( | |
| "view-table", request.actor, include_is_private=True | |
| ) | |
| async for t in table_page.all(): | |
| if t.parent not in tables_by_db: | |
| tables_by_db[t.parent] = {} | |
| tables_by_db[t.parent][t.child] = t | |
| databases = [] | |
| # Iterate over allowed databases instead of all databases | |
| for name in allowed_db_dict.keys(): | |
| db = self.ds.databases[name] |
Solution: make sure to wipe catalog_database first at startup.
Reactions are currently unavailable