issues: 780767542

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association pull_request body repo type active_lock_reason performed_via_github_app
780767542 MDU6SXNzdWU3ODA3Njc1NDI= 1180 Lazily evaluated arguments for call_with_supported_arguments 9599 open 0     2 2021-01-06T18:43:34Z 2021-01-07T18:56:24Z   OWNER  

While building https://github.com/simonw/datasette-export-notebook I thought it would be nice to be able to show a count of exported records on the page "This will stream 10,422 records to your notebook".

None of the documented arguments on https://docs.datasette.io/en/0.53/plugin_hooks.html#register-output-renderer-datasette expose the count. The closest is sql which could be executed as select count(*) from ({sql}) but that's a bit inelegant.

So, idea: if your defined render function takes a total argument, the caller runs a count(*) query and passes you that total.

To implement this I would need to teach the call_with_supported_arguments that some arguments are lazy - they should execute a function (or an async function) but only if they are needed.

107914493 issue    

Links from other tables