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

Implement new /content.json?sql=... #2111

Closed
simonw opened this issue Jul 26, 2023 · 4 comments
Closed

Implement new /content.json?sql=... #2111

simonw opened this issue Jul 26, 2023 · 4 comments

Comments

@simonw
Copy link
Owner

simonw commented Jul 26, 2023

This will be the base that the remaining work builds on top of. Refs:

@simonw
Copy link
Owner Author

simonw commented Jul 26, 2023

To avoid confusion I'll start by having /content return a HTML "TODO: implement this" message.

@simonw
Copy link
Owner Author

simonw commented Jul 26, 2023

I just noticed that this URL: https://latest.datasette.io/fixtures.csv

Returns a 500 error right now!

image

It's fine with a ?sql= query: https://latest.datasette.io/fixtures.csv?sql=select+*+from+facetable

simonw added a commit that referenced this issue Jul 26, 2023
But it breaks when it dispatches ?sql= to the new query_view function.

Refs #2111, closes #2110
@simonw
Copy link
Owner Author

simonw commented Jul 26, 2023

I implemented /content and /content.json but I left /content?sql=... as this:

async def query_view(request, datasette, sql):
return Response.html("Not yet implemented")

simonw added a commit that referenced this issue Aug 8, 2023
* Refs #2111, closes #2110
* New Context dataclass/subclass mechanism, refs #2127
* Define QueryContext and extract get_tables() method, refs #2127
* Fix OPTIONS bug by porting DaatbaseView to be a View subclass
* Expose async_view_for_class.view_class for test_routes test
* Error/truncated aruments for renderers, closes #2130
@simonw
Copy link
Owner Author

simonw commented Aug 8, 2023

Shipped: https://latest.datasette.io/_memory.json?sql=select+sqlite_version()

{
  "rows": [
    {
      "sqlite_version()": "3.34.1"
    }
  ],
  "columns": [
    "sqlite_version()"
  ],
  "ok": true,
  "truncated": false
}

@simonw simonw closed this as completed Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant