issue_comments

14 rows where issue = 314506669 sorted by updated_at descending

View and edit SQL

Suggested facets: created_at (date), updated_at (date)

user

author_association

issue

  • Allow plugins to define additional URL routes and views · 14
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue
641002504 https://github.com/simonw/datasette/issues/215#issuecomment-641002504 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MTAwMjUwNA== simonw 9599 2020-06-09T03:14:32Z 2020-06-09T03:14:32Z OWNER

Documentation: https://datasette.readthedocs.io/en/latest/plugins.html#register-routes

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640972952 https://github.com/simonw/datasette/issues/215#issuecomment-640972952 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDk3Mjk1Mg== simonw 9599 2020-06-09T01:24:52Z 2020-06-09T01:25:33Z OWNER

WIP documentation: https://github.com/simonw/datasette/blob/770dedb21adfc706592e6b5cdf5e751a8720fdf9/docs/plugins.rst#register_routes

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640971470 https://github.com/simonw/datasette/issues/215#issuecomment-640971470 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDk3MTQ3MA== simonw 9599 2020-06-09T01:19:44Z 2020-06-09T01:19:44Z OWNER

I'll need to add documentation of the Response object (and Response.html() and Response.text() class methods - I should add Response.json() too) to the internals page https://datasette.readthedocs.io/en/stable/internals.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640960667 https://github.com/simonw/datasette/issues/215#issuecomment-640960667 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDk2MDY2Nw== simonw 9599 2020-06-09T00:41:35Z 2020-06-09T00:41:35Z OWNER

I'm going to implement this one documentation-first in a pull request.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640960553 https://github.com/simonw/datasette/issues/215#issuecomment-640960553 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDk2MDU1Mw== simonw 9599 2020-06-09T00:41:09Z 2020-06-09T00:41:09Z OWNER

I'm going to imitate register_output_renderer and register_facet_classes - both return a list of things to register.

So I'll do this:

@hookspec
def register_routes():
    "Register URL routes. Return a list of (regex, view_function) pairs"
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640121917 https://github.com/simonw/datasette/issues/215#issuecomment-640121917 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDEyMTkxNw== simonw 9599 2020-06-06T21:42:58Z 2020-06-07T05:58:36Z OWNER

I might use some dependency injection here, with call_with_supported_arguments() from https://github.com/simonw/datasette/commit/41a0cd7b6afe0397efbbf27ad822679fc574811a#diff-942305c83055fdc0ff5f4e7d6ab06b29

Maybe a view function can take request and optionally also take datasette? Or scope or receive or send.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
504881900 https://github.com/simonw/datasette/issues/215#issuecomment-504881900 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDUwNDg4MTkwMA== simonw 9599 2019-06-24T06:51:29Z 2020-06-06T21:47:11Z OWNER

See also #520 - asgi_wrapper plugin hook.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
398826108 https://github.com/simonw/datasette/issues/215#issuecomment-398826108 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDM5ODgyNjEwOA== simonw 9599 2018-06-20T17:09:18Z 2020-06-06T21:46:51Z OWNER

This depends on #272 - Datasette ported to ASGI.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640122120 https://github.com/simonw/datasette/issues/215#issuecomment-640122120 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDEyMjEyMA== simonw 9599 2020-06-06T21:45:13Z 2020-06-06T21:45:52Z OWNER

Stretch goal: make it easy for plugin views to implement formats, so they can produce HTML by default and .json or .csv etc as alternative outputs.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640121036 https://github.com/simonw/datasette/issues/215#issuecomment-640121036 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDEyMTAzNg== simonw 9599 2020-06-06T21:34:03Z 2020-06-06T21:34:03Z OWNER

I'll refactor existing code to register views using the same mechanism that plugins will have access to.

Maybe plugins get to register their routes first? That would allow plugins to do things like entirely take over the / page.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640119259 https://github.com/simonw/datasette/issues/215#issuecomment-640119259 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDExOTI1OQ== simonw 9599 2020-06-06T21:16:46Z 2020-06-06T21:16:46Z OWNER

I deprioritised this a while ago because the asgi_wrapper hook allowed me to set up new URL routes: https://datasette.readthedocs.io/en/0.43/plugins.html#asgi-wrapper-datasette

But... those were pretty low level, for example this code here: https://github.com/simonw/datasette-auth-github/blob/6c971064f6f4e6857bade5c6b88842f9cdeca9d9/datasette_auth_github/github_auth.py#L104-L113

Now that Datasette has a documented request object #706 and that object is used by things like the flash messages system (#790) - https://datasette.readthedocs.io/en/latest/internals.html#add-message-request-message-message-type-datasette-info - I find myself wanting to add views which get a request, as opposed to an ASGI scope.

So I'm re-prioritising this, with the main need being a way for plugins to hook up their own view functions that can accept a request and return a response.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
640118802 https://github.com/simonw/datasette/issues/215#issuecomment-640118802 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDY0MDExODgwMg== simonw 9599 2020-06-06T21:12:41Z 2020-06-06T21:12:41Z OWNER

@clausjuhl your use-case there is now covered by custom pages from Datasette 0.41 https://datasette.readthedocs.io/en/stable/changelog.html#v0-41

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
540548765 https://github.com/simonw/datasette/issues/215#issuecomment-540548765 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDU0MDU0ODc2NQ== clausjuhl 2181410 2019-10-10T12:27:56Z 2019-10-10T12:27:56Z NONE

Hi Simon. Any news on the ability to add routes (with static content) to datasette? As a public institution I'm required to have at least privacy, cookie and availability policies in place, and it really would be nice to have these under the same url. Thank you for some great work!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669
507929913 https://github.com/simonw/datasette/issues/215#issuecomment-507929913 https://api.github.com/repos/simonw/datasette/issues/215 MDEyOklzc3VlQ29tbWVudDUwNzkyOTkxMw== simonw 9599 2019-07-03T04:08:28Z 2019-07-03T04:08:28Z OWNER

I just closed #520 which means this is now technically possible.

But... doing it using the new asgi_wrapper hook https://datasette.readthedocs.io/en/latest/plugins.html#asgi-wrapper-datasette isn't particularly obvious.

I'm going to leave this ticket open for the moment. I think I need at least one example plugin to show that this approach is good enough - and it's still quite possible that I'll add an extra, easier hook for this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow plugins to define additional URL routes and views 314506669

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Query took 28.679ms · About: github-to-sqlite