home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

8 rows where issue = 626078521 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • simonw 8

issue 1

  • Consolidate request.raw_args and request.args · 8 ✖

author_association 1

  • OWNER 8
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
636234759 https://github.com/simonw/datasette/issues/774#issuecomment-636234759 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNjIzNDc1OQ== simonw 9599 2020-05-29T23:27:35Z 2020-05-29T23:27:35Z OWNER

Oh dear... it looks like .raw_args is used in my TIL script, which has been copied by a few people!

https://github.com/search?q=request+raw_args+datasette&type=Code

I'll fix it in mine and file pull requests against other pieces before this code gets released.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
636234067 https://github.com/simonw/datasette/issues/774#issuecomment-636234067 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNjIzNDA2Nw== simonw 9599 2020-05-29T23:24:34Z 2020-05-29T23:24:34Z OWNER

Updated documentation for RequestParameters: https://datasette.readthedocs.io/en/latest/internals.html#the-requestparameters-class

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
636229764 https://github.com/simonw/datasette/issues/774#issuecomment-636229764 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNjIyOTc2NA== simonw 9599 2020-05-29T23:05:48Z 2020-05-29T23:05:48Z OWNER

I'm going to rebuild RequestParameters to no longer subclass dict. I'll keep the following methods:

  • __contains__()
  • __getitem__() (with the new behaviour)
  • keys()
  • iterating iterates keys
  • __len__
  • get
  • getlist

It won't support writing, so it will effectively be immutable after you have constructed it.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
636228656 https://github.com/simonw/datasette/issues/774#issuecomment-636228656 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNjIyODY1Ng== simonw 9599 2020-05-29T23:01:22Z 2020-05-29T23:01:22Z OWNER

As far as I can tell the only code I've ever written that would break if I made this change is in russian-ira-facebook-ads:

https://github.com/simonw/russian-ira-facebook-ads-datasette/blob/e7106710abdd7bdcae035bedd8bdaba75ae56a12/plugins/target.py#L22

https://github.com/simonw/russian-ira-facebook-ads-datasette/blob/b8a22348c6b315ab94ddba69e8117dfdfd9573dc/plugins/regexp.py#L17

That doesn't work against latest Datasette anyway, so I think I can safely make this change.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
636227927 https://github.com/simonw/datasette/issues/774#issuecomment-636227927 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNjIyNzkyNw== simonw 9599 2020-05-29T22:58:32Z 2020-05-29T22:58:32Z OWNER

I think I want request.args["key"] to return the FIRST item for that key or raise a KeyError if none are found.

Right now it returns the full list.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
635702385 https://github.com/simonw/datasette/issues/774#issuecomment-635702385 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNTcwMjM4NQ== simonw 9599 2020-05-29T01:21:15Z 2020-05-29T01:21:15Z OWNER

I think request.args.getlist() should return a list, not None, if the key does not exist.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
635702201 https://github.com/simonw/datasette/issues/774#issuecomment-635702201 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNTcwMjIwMQ== simonw 9599 2020-05-29T01:20:34Z 2020-05-29T01:20:34Z OWNER

Or change request.args to behave more like request.raw_args - mainly to return a single value when you look things up by key.

It's currently defined like this: https://github.com/simonw/datasette/blob/3c1a60589e14849344acd8aa6da0a60b40fbfc60/datasette/utils/init.py#L756-L766

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  
635530876 https://github.com/simonw/datasette/issues/774#issuecomment-635530876 https://api.github.com/repos/simonw/datasette/issues/774 MDEyOklzc3VlQ29tbWVudDYzNTUzMDg3Ng== simonw 9599 2020-05-28T18:50:18Z 2020-05-28T18:50:18Z OWNER

How about moving this functionality to the request object itself? python q = request["q"] # Raises KeyError if missing, otherwise returns first q = request.get("q", "default") # Returns first, or optional default or None facets = request.getlist("_facet")

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consolidate request.raw_args and request.args 626078521  

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])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 19.491ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows