home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

20 rows where author_association = "OWNER" and "created_at" is on date 2021-08-18 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 9

  • `table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 6
  • Rethink how .ext formats (v.s. ?_format=) works before 1.0 5
  • Escaping FTS search strings 2
  • Research: handle gzipped CSV directly 2
  • Experiment with type hints 1
  • FTS quote functionality from datasette 1
  • Show column metadata plus links for foreign keys on arbitrary query results 1
  • Insert with --tsv and --no-headers give error about --nl arguments 1
  • Link to a better example on docs index 1

user 1

  • simonw 20

author_association 1

  • OWNER · 20 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
901475812 https://github.com/simonw/datasette/issues/1293#issuecomment-901475812 https://api.github.com/repos/simonw/datasette/issues/1293 IC_kwDOBm6k_c41u23k simonw 9599 2021-08-18T22:41:19Z 2021-08-18T22:41:19Z OWNER

Maybe I split this out into a separate Python library that gets tested against every SQLite release I can possibly try it against, and then bakes out the supported release versions into the library code itself?

I'm going to do this, and call the Python library sqlite-explain.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Show column metadata plus links for foreign keys on arbitrary query results 849978964  
901452199 https://github.com/simonw/sqlite-utils/issues/37#issuecomment-901452199 https://api.github.com/repos/simonw/sqlite-utils/issues/37 IC_kwDOCGYnMM41uxGn simonw 9599 2021-08-18T21:48:57Z 2021-08-18T21:48:57Z OWNER

I did a bunch of work on this in #266. The library is now pretty thoroughly typed, and I even found a couple of bugs using mypy along the way: #313 and #315.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Experiment with type hints 465815372  
901440752 https://github.com/simonw/sqlite-utils/issues/318#issuecomment-901440752 https://api.github.com/repos/simonw/sqlite-utils/issues/318 IC_kwDOCGYnMM41uuTw simonw 9599 2021-08-18T21:25:30Z 2021-08-18T21:25:30Z OWNER

Some questions:

  • Should this support compression formats other than gzip?
  • Should memory learn to auto-detect gzipped data?
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Research: handle gzipped CSV directly 974067156  
901440207 https://github.com/simonw/sqlite-utils/issues/318#issuecomment-901440207 https://api.github.com/repos/simonw/sqlite-utils/issues/318 IC_kwDOCGYnMM41uuLP simonw 9599 2021-08-18T21:24:28Z 2021-08-18T21:24:49Z OWNER

Something like this then:

sqlite-utils file.db "select * from t" --csv --gz > t.csv.gz

Maybe add a -o t.csv.gz option too so you don't have to use a >.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Research: handle gzipped CSV directly 974067156  
901403298 https://github.com/simonw/sqlite-utils/issues/295#issuecomment-901403298 https://api.github.com/repos/simonw/sqlite-utils/issues/295 IC_kwDOCGYnMM41ulKi simonw 9599 2021-08-18T20:19:04Z 2021-08-18T20:19:04Z OWNER

Thanks, this was a bug.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Insert with --tsv and --no-headers give error about --nl arguments 934123448  
901399139 https://github.com/simonw/sqlite-utils/issues/296#issuecomment-901399139 https://api.github.com/repos/simonw/sqlite-utils/issues/296 IC_kwDOCGYnMM41ukJj simonw 9599 2021-08-18T20:12:34Z 2021-08-18T20:13:12Z OWNER

Documentation for table.search(..., quote=True): https://sqlite-utils.datasette.io/en/latest/python-api.html#searching-with-table-search

In the API reference: https://sqlite-utils.datasette.io/en/latest/reference.html#sqlite_utils.db.Table.search

And for the CLI --quote option: https://sqlite-utils.datasette.io/en/latest/cli.html#executing-searches

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 944326512  
901398216 https://github.com/simonw/sqlite-utils/issues/296#issuecomment-901398216 https://api.github.com/repos/simonw/sqlite-utils/issues/296 IC_kwDOCGYnMM41uj7I simonw 9599 2021-08-18T20:11:01Z 2021-08-18T20:11:01Z OWNER

``` % sqlite-utils search fixtures.db searchable 'dog"' Error: malformed MATCH expression: [dog"]

Try running this again with the --quote option ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 944326512  
901390635 https://github.com/simonw/sqlite-utils/issues/296#issuecomment-901390635 https://api.github.com/repos/simonw/sqlite-utils/issues/296 IC_kwDOCGYnMM41uiEr simonw 9599 2021-08-18T19:58:53Z 2021-08-18T19:58:53Z OWNER

sqlite-utils search fixtures.db searchable 'dog"' Error: malformed MATCH expression: [dog"] This error message could suggest retrying with --quote.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 944326512  
901379930 https://github.com/simonw/sqlite-utils/issues/296#issuecomment-901379930 https://api.github.com/repos/simonw/sqlite-utils/issues/296 IC_kwDOCGYnMM41ufda simonw 9599 2021-08-18T19:40:38Z 2021-08-18T19:40:38Z OWNER

Also add sqlite-utils search ... --quote option.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 944326512  
901353345 https://github.com/simonw/sqlite-utils/issues/246#issuecomment-901353345 https://api.github.com/repos/simonw/sqlite-utils/issues/246 IC_kwDOCGYnMM41uY-B simonw 9599 2021-08-18T18:57:13Z 2021-08-18T18:57:13Z OWNER

More documentation: https://sqlite-utils.datasette.io/en/latest/python-api.html#quoting-characters-for-use-in-search

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Escaping FTS search strings 831751367  
901338841 https://github.com/simonw/sqlite-utils/issues/296#issuecomment-901338841 https://api.github.com/repos/simonw/sqlite-utils/issues/296 IC_kwDOCGYnMM41uVbZ simonw 9599 2021-08-18T18:33:26Z 2021-08-18T18:45:12Z OWNER

I think I'll do this as an optional table.search(..., escape=True) parameter.

Actually I'll do quote=True for consistency with the new db.quote_fts() method.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 944326512  
901345800 https://github.com/simonw/sqlite-utils/issues/246#issuecomment-901345800 https://api.github.com/repos/simonw/sqlite-utils/issues/246 IC_kwDOCGYnMM41uXII simonw 9599 2021-08-18T18:44:48Z 2021-08-18T18:44:48Z OWNER

The db.quote_fts(value) method from #247 can now be used for this - documentation here: https://sqlite-utils.datasette.io/en/latest/reference.html#sqlite_utils.db.Database.quote_fts

I'll be adding further improvements relating to this (a table.search(q, quote=True) parameter) in #296.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Escaping FTS search strings 831751367  
901338988 https://github.com/simonw/sqlite-utils/pull/247#issuecomment-901338988 https://api.github.com/repos/simonw/sqlite-utils/issues/247 IC_kwDOCGYnMM41uVds simonw 9599 2021-08-18T18:33:39Z 2021-08-18T18:33:39Z OWNER

This was also requested in #296.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
FTS quote functionality from datasette 832687563  
901338356 https://github.com/simonw/sqlite-utils/issues/296#issuecomment-901338356 https://api.github.com/repos/simonw/sqlite-utils/issues/296 IC_kwDOCGYnMM41uVT0 simonw 9599 2021-08-18T18:32:39Z 2021-08-18T18:32:39Z OWNER

This is a good call. I have a fix for this in Datasette but it's not in sqlite-utils yet: https://github.com/simonw/datasette/blob/adb5b70de5cec3c3dd37184defe606a082c232cf/datasette/utils/init.py#L824-L835

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`table.search(..., quote=True)` parameter and `sqlite-utils search --quote` option 944326512  
901337305 https://github.com/simonw/sqlite-utils/issues/317#issuecomment-901337305 https://api.github.com/repos/simonw/sqlite-utils/issues/317 IC_kwDOCGYnMM41uVDZ simonw 9599 2021-08-18T18:30:59Z 2021-08-18T18:30:59Z OWNER

I'm just going to remove this - I added it when the library was mostly undocumented, but it has comprehensive documentation now.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Link to a better example on docs index 972827346  
900715375 https://github.com/simonw/datasette/issues/1439#issuecomment-900715375 https://api.github.com/repos/simonw/datasette/issues/1439 IC_kwDOBm6k_c41r9Nv simonw 9599 2021-08-18T00:15:28Z 2021-08-18T00:15:28Z OWNER

Maybe I should use -/ to encode forward slashes too, to defend against any ASGI servers that might not implement raw_path correctly.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Rethink how .ext formats (v.s. ?_format=) works before 1.0 973139047  
900714630 https://github.com/simonw/datasette/issues/1439#issuecomment-900714630 https://api.github.com/repos/simonw/datasette/issues/1439 IC_kwDOBm6k_c41r9CG simonw 9599 2021-08-18T00:13:33Z 2021-08-18T00:13:33Z OWNER

The documentation should definitely cover how table names become URLs, in case any third party code needs to be able to calculate this themselves.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Rethink how .ext formats (v.s. ?_format=) works before 1.0 973139047  
900712981 https://github.com/simonw/datasette/issues/1439#issuecomment-900712981 https://api.github.com/repos/simonw/datasette/issues/1439 IC_kwDOBm6k_c41r8oV simonw 9599 2021-08-18T00:09:59Z 2021-08-18T00:12:32Z OWNER

So given the original examples, a table called table.csv would have the following URLs:

  • /db/table-.csv - the HTML version
  • /db/table-.csv.csv - the CSV version
  • /db/table-.csv.json - the JSON version

And if for some horific reason you had a table with the name /db/table-.csv.csv (so /db/ was the first part of the actual table name in SQLite) the URLs would look like this:

  • /db/%2Fdb%2Ftable---.csv-.csv - the HTML version
  • /db/%2Fdb%2Ftable---.csv-.csv.csv - the CSV version
  • /db/%2Fdb%2Ftable---.csv-.csv.json - the JSON version
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Rethink how .ext formats (v.s. ?_format=) works before 1.0 973139047  
900711967 https://github.com/simonw/datasette/issues/1439#issuecomment-900711967 https://api.github.com/repos/simonw/datasette/issues/1439 IC_kwDOBm6k_c41r8Yf simonw 9599 2021-08-18T00:08:09Z 2021-08-18T00:08:09Z OWNER

Here's an alternative I just made up which I'm calling "dot dash" encoding:

```python def dot_dash_encode(s): return s.replace("-", "--").replace(".", "-.")

def dot_dash_decode(s): return s.replace("-.", ".").replace("--", "-") And some examples:python for example in ( "hello", "hello.csv", "hello-and-so-on.csv", "hello-.csv", "hello--and--so--on-.csv", "hello.csv.", "hello.csv.-", "hello.csv.--", ): print(example) print(dot_dash_encode(example)) print(example == dot_dash_decode(dot_dash_encode(example))) print() Outputs: hello hello True

hello.csv hello-.csv True

hello-and-so-on.csv hello--and--so--on-.csv True

hello-.csv hello---.csv True

hello--and--so--on-.csv hello----and----so----on---.csv True

hello.csv. hello-.csv-. True

hello.csv.- hello-.csv-.-- True

hello.csv.-- hello-.csv-.---- True ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Rethink how .ext formats (v.s. ?_format=) works before 1.0 973139047  
900709703 https://github.com/simonw/datasette/issues/1439#issuecomment-900709703 https://api.github.com/repos/simonw/datasette/issues/1439 IC_kwDOBm6k_c41r71H simonw 9599 2021-08-18T00:03:09Z 2021-08-18T00:03:09Z OWNER

But... what if I invent my own escaping scheme?

I actually did this once before, in https://github.com/simonw/datasette/commit/9fdb47ca952b93b7b60adddb965ea6642b1ff523 - while I was working on porting Datasette to ASGI in https://github.com/simonw/datasette/issues/272#issuecomment-494192779 because ASGI didn't yet have the raw_path mechanism.

I could bring that back - it looked like this:

"table/and/slashes" => "tableU+002FandU+002Fslashes" "~table" => "U+007Etable" "+bobcats!" => "U+002Bbobcats!" "U+007Etable" => "UU+002B007Etable" But I didn't particularly like it - it was quite verbose.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Rethink how .ext formats (v.s. ?_format=) works before 1.0 973139047  

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 1011.335ms · About: github-to-sqlite