home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where author_association = "NONE" and "updated_at" is on date 2021-12-08 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: issue_url, reactions, updated_at (date)

user 2

  • 20after4 3
  • rayvoelker 1

issue 2

  • Document how to send multiple values for "Named parameters" 3
  • Add new `"sql_file"` key to Canned Queries in metadata? 1

author_association 1

  • NONE · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
988468238 https://github.com/simonw/datasette/issues/1528#issuecomment-988468238 https://api.github.com/repos/simonw/datasette/issues/1528 IC_kwDOBm6k_c466tQO 20after4 30934 2021-12-08T03:35:45Z 2021-12-08T03:35:45Z NONE

FWIW I implemented something similar with a bit of plugin code:

```python @hookimpl def canned_queries(datasette: Datasette, database: str) -> Mapping[str, str]: # load "canned queries" from the filesystem under # www/sql/db/query_name.sql queries = {}

sqldir = Path(__file__).parent.parent / "sql"
if database:
    sqldir = sqldir / database

if not sqldir.is_dir():
    return queries

for f in sqldir.glob('*.sql'):
    try:
        sql = f.read_text('utf8').strip()
        if not len(sql):
            log(f"Skipping empty canned query file: {f}")
            continue
        queries[f.stem] = { "sql": sql }
    except OSError as err:
        log(err)

return queries

```

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
Add new `"sql_file"` key to Canned Queries in metadata? 1060631257  
988463455 https://github.com/simonw/datasette/issues/1304#issuecomment-988463455 https://api.github.com/repos/simonw/datasette/issues/1304 IC_kwDOBm6k_c466sFf 20after4 30934 2021-12-08T03:23:14Z 2021-12-08T03:23:14Z NONE

I actually think it would be a useful thing to add support for in datasette. It wouldn't be difficult to unwind an array of params and add the placeholders automatically.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document how to send multiple values for "Named parameters"  863884805  
988461884 https://github.com/simonw/datasette/issues/1304#issuecomment-988461884 https://api.github.com/repos/simonw/datasette/issues/1304 IC_kwDOBm6k_c466rs8 20after4 30934 2021-12-08T03:20:26Z 2021-12-08T03:20:26Z NONE

The easiest or most straightforward thing to do is to use named parameters like:

sql select * where key IN (:p1, :p2, :p3)

And simply construct the list of placeholders dynamically based on the number of values.

Doing this is possible with datasette if you forgo "canned queries" and just use the raw query endpoint and pass the query sql, along with p1, p2 ... in the request.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document how to send multiple values for "Named parameters"  863884805  
988459453 https://github.com/simonw/datasette/issues/1304#issuecomment-988459453 https://api.github.com/repos/simonw/datasette/issues/1304 IC_kwDOBm6k_c466rG9 rayvoelker 9308268 2021-12-08T03:15:27Z 2021-12-08T03:15:27Z NONE

I was thinking if there were a way to use some sort of sting function to "unpack" the values and convert them into ints... hm

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document how to send multiple values for "Named parameters"  863884805  

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