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

datasette-template-sql causes <function ...> in textarea #6

Closed
cldellow opened this issue Nov 26, 2022 · 2 comments
Closed

datasette-template-sql causes <function ...> in textarea #6

cldellow opened this issue Nov 26, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@cldellow
Copy link

If I install this plugin by itself and navigate to /-/write, I get an empty textarea for typing in SQL.

If I then add the datasette-template-sql plugin, the textarea now has:

<function extra_template_vars.<locals>.execute_sql at 0x7fcaa98ea290>

Not a big deal, but it adds an extra step to delete it when running a query. (I also begin to wonder... is this from https://github.com/simonw/datasette-write/blob/main/datasette_write/templates/datasette_write.html#L13 ? Am I supposed to see some other SQL there some times, for example when I type in something with syntax errors?)

@simonw
Copy link
Owner

simonw commented Jan 11, 2023

"sql": request.args.get("sql") or "",

That's supposed to allow ?sql= in the URL to pre-populate the form with a query ready to be executed, see also #7.

I hadn't run into an issue with plugins like datasette-template-sql interfering with the existing context for other features before! Definitely not a good thing.

@simonw
Copy link
Owner

simonw commented Feb 27, 2024

CleanShot 2024-02-27 at 10 52 50@2x

@simonw simonw closed this as completed in d24bc97 Feb 27, 2024
simonw added a commit that referenced this issue Feb 27, 2024
Refs #1, #6, #7, #8, #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants