Skip to content

Expose SQL and parameters to page plugins - #3039

Open
Aschenbath wants to merge 1 commit into
simonw:mainfrom
Aschenbath:feat/plugin-query-context-1817
Open

Aschenbath wants to merge 1 commit into
simonw:mainfrom
Aschenbath:feat/plugin-query-context-1817

Conversation

@Aschenbath

Copy link
Copy Markdown

Fixes #1817.

Page plugins can now receive the SQL and parameters used for table, row and query pages through the four page-extra hooks. Output renderers also receive params, and render_template() accepts an explicit plugin_context dictionary. Stored-query parameters include the values actually bound by SQLite, so plugins can replay the query without resolving magic parameters again; template variables and JSON extras retain their existing contents.

Validation on Linux with Python 3.12:

  • Added 102 cases covering query replay, pagination, fragments, missing and magic parameters, explicit context overrides, async callbacks and JSON compatibility. Against unchanged main: 99 fail and 3 compatibility controls pass.
  • Full suite: pytest -n 4 -m "not serial" — 2917 passed, 86 skipped, 6 xfailed, 15 xpassed; pytest -m serial — 40 passed.
  • Black, Ruff, Cog, blacken-docs, Sphinx with warnings as errors, and the HTTPS and plugin-loading shell tests passed.

AI assistance: implemented and validated using Codex.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose sql and params arguments to various plugin hooks

1 participant