mirror of
https://github.com/simonw/datasette.git
synced 2026-06-15 13:36:58 +02:00
Add pks parameter to render_cell() plugin hook
The render_cell() hook now receives a pks parameter containing the list of primary key column names for the table being rendered. This avoids plugins needing to make redundant async calls to look up primary keys. For tables without an explicit primary key, pks is ["rowid"]. For custom SQL queries and views, pks is an empty list []. https://claude.ai/code/session_01HFYfevAziq4fSYTNRD9ZCh
This commit is contained in:
parent
8a315f3d7d
commit
170f9de774
8 changed files with 62 additions and 5 deletions
|
|
@ -104,7 +104,7 @@ def extra_body_script(
|
|||
|
||||
|
||||
@hookimpl
|
||||
def render_cell(row, value, column, table, database, datasette, request):
|
||||
def render_cell(row, value, column, table, pks, database, datasette, request):
|
||||
async def inner():
|
||||
# Render some debug output in cell with value RENDER_CELL_DEMO
|
||||
if value == "RENDER_CELL_DEMO":
|
||||
|
|
@ -113,6 +113,7 @@ def render_cell(row, value, column, table, database, datasette, request):
|
|||
"column": column,
|
||||
"table": table,
|
||||
"database": database,
|
||||
"pks": pks,
|
||||
"config": datasette.plugin_config(
|
||||
"name-of-plugin",
|
||||
database=database,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue