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

Use internal database catatalog tables any time we need to list all tables #2396

Open
simonw opened this issue Aug 15, 2024 · 0 comments
Open

Comments

@simonw
Copy link
Owner

simonw commented Aug 15, 2024

This came up just now here:

This would be a bit easier if I moved all code in Datasette that loops through a list of tables to consult the internal database catalog tables for those, then I could include these unreadable tables in that but have a "unreadable = 1" column which could be used to filter them out.

Originally posted by @simonw in #2388 (comment)

The purpose of those catalog tables is to support things like efficently searching and paginating through all available tables. Having internal methods that use them to list tables would also help with this challenge of knowing when to skip tables that depend on not-installed extensions.

datasette/docs/internals.rst

Lines 1370 to 1383 in 05dfd34

CREATE TABLE catalog_databases (
database_name TEXT PRIMARY KEY,
path TEXT,
is_memory INTEGER,
schema_version INTEGER
);
CREATE TABLE catalog_tables (
database_name TEXT,
table_name TEXT,
rootpage INTEGER,
sql TEXT,
PRIMARY KEY (database_name, table_name),
FOREIGN KEY (database_name) REFERENCES databases(database_name)
);

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