mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Databse.primary_keys(table) / fts_table(table) refactor, closes #488
Also cleaned up some unused imports spotted by the linter.
This commit is contained in:
parent
3fe21b91bb
commit
20f98c3e20
4 changed files with 24 additions and 43 deletions
|
|
@ -3,15 +3,10 @@ import json
|
|||
|
||||
from sanic import response
|
||||
|
||||
from datasette.utils import (
|
||||
CustomJSONEncoder,
|
||||
InterruptedError,
|
||||
detect_primary_keys,
|
||||
detect_fts,
|
||||
)
|
||||
from datasette.utils import CustomJSONEncoder
|
||||
from datasette.version import __version__
|
||||
|
||||
from .base import HASH_LENGTH, RenderMixin
|
||||
from .base import RenderMixin
|
||||
|
||||
|
||||
# Truncate table list on homepage at:
|
||||
|
|
@ -46,14 +41,10 @@ class IndexView(RenderMixin):
|
|||
tables[table] = {
|
||||
"name": table,
|
||||
"columns": table_columns,
|
||||
"primary_keys": await self.ds.execute_against_connection_in_thread(
|
||||
name, lambda conn: detect_primary_keys(conn, table)
|
||||
),
|
||||
"primary_keys": await db.primary_keys(table),
|
||||
"count": table_counts.get(table),
|
||||
"hidden": table in hidden_table_names,
|
||||
"fts_table": await self.ds.execute_against_connection_in_thread(
|
||||
name, lambda conn: detect_fts(conn, table)
|
||||
),
|
||||
"fts_table": await db.fts_table(table),
|
||||
"num_relationships_for_sorting": 0,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue