home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where author_association = "CONTRIBUTOR" and "updated_at" is on date 2022-09-27 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue 2

  • Stream all results for arbitrary SQL and canned queries 5
  • [SPIKE] Don't truncate query CSVs 1

user 1

  • fgregg 6

author_association 1

  • CONTRIBUTOR · 6 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1259718517 https://github.com/simonw/datasette/issues/526#issuecomment-1259718517 https://api.github.com/repos/simonw/datasette/issues/526 IC_kwDOBm6k_c5LFcd1 fgregg 536941 2022-09-27T16:02:51Z 2022-09-27T16:04:46Z CONTRIBUTOR

i think that max_returned_rows is a defense mechanism, just not for connection exhaustion. max_returned_rows is a defense mechanism against memory bombs.

if you are potentially yielding out hundreds of thousands or even millions of rows, you need to be quite careful about data flow to not run out of memory on the server, or on the client.

you have a lot of places in your code that are protective of that right now, but max_returned_rows acts as the final backstop.

so, given that, it makes sense to have removing max_returned_rows altogether be a non-goal, but instead allow for for specific codepaths (like streaming csv's) be able to bypass.

that could dramatically lower the surface area for a memory-bomb attack.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Stream all results for arbitrary SQL and canned queries 459882902  
1258910228 https://github.com/simonw/datasette/issues/526#issuecomment-1258910228 https://api.github.com/repos/simonw/datasette/issues/526 IC_kwDOBm6k_c5LCXIU fgregg 536941 2022-09-27T03:11:07Z 2022-09-27T03:11:07Z CONTRIBUTOR

i think this feature would be safe, as its really only the time limit that can, and imo, should protect against long running queries, as it is pretty easy to make very expensive queries that don't return many rows.

moving away from max_returned_rows will requires some thinking about:

  1. memory usage and data flows to handle potentially very large result sets
  2. how to avoid rendering tens or hundreds of thousands of html rows.
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Stream all results for arbitrary SQL and canned queries 459882902  
1258878311 https://github.com/simonw/datasette/issues/526#issuecomment-1258878311 https://api.github.com/repos/simonw/datasette/issues/526 IC_kwDOBm6k_c5LCPVn fgregg 536941 2022-09-27T02:19:48Z 2022-09-27T02:19:48Z CONTRIBUTOR

this sql query doesn't trip up maximum_returned_rows but does timeout

sql with recursive counter(x) as ( select 0 union select x + 1 from counter ) select * from counter LIMIT 10 OFFSET 100000000

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Stream all results for arbitrary SQL and canned queries 459882902  
1258871525 https://github.com/simonw/datasette/issues/526#issuecomment-1258871525 https://api.github.com/repos/simonw/datasette/issues/526 IC_kwDOBm6k_c5LCNrl fgregg 536941 2022-09-27T02:09:32Z 2022-09-27T02:14:53Z CONTRIBUTOR

thanks @simonw, i learned something i didn't know about sqlite's execution model!

Imagine if Datasette CSVs did allow unlimited retrievals. Someone could hit the CSV endpoint for that recursive query and tie up Datasette's SQL connection effectively forever.

why wouldn't the sqlite_timelimit guard prevent that?


on my local version which has the code to turn off truncations for query csv, sqlite_timelimit does protect me.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Stream all results for arbitrary SQL and canned queries 459882902  
1258849766 https://github.com/simonw/datasette/issues/526#issuecomment-1258849766 https://api.github.com/repos/simonw/datasette/issues/526 IC_kwDOBm6k_c5LCIXm fgregg 536941 2022-09-27T01:27:03Z 2022-09-27T01:27:03Z CONTRIBUTOR

i agree with that concern! but if i'm understanding the code correctly, maximum_returned_rows does not protect against long-running queries in any way.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Stream all results for arbitrary SQL and canned queries 459882902  
1258803261 https://github.com/simonw/datasette/pull/1820#issuecomment-1258803261 https://api.github.com/repos/simonw/datasette/issues/1820 IC_kwDOBm6k_c5LB9A9 fgregg 536941 2022-09-27T00:03:09Z 2022-09-27T00:03:09Z CONTRIBUTOR

the pattern in this PR max_returned_rows control the maximum rows rendered through html and json, and the csv render bypasses that.

i think it would be better to have each of these different query renderers have more direct control for how many rows to fetch, instead of relying on the internals of the execute method.

generally, users will not want to paginate through tens of thousands of results, but often will want to download a full query as json or as csv.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
[SPIKE] Don't truncate query CSVs 1386456717  

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 914.374ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows