home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

12 rows where "created_at" is on date 2017-11-17 and user = 9599 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

  • ?_group_count=country - return counts by specific column(s) 2
  • Dockerfile should build more recent SQLite with FTS5 and spatialite support 2
  • Detect foreign keys and use them to link HTML pages together 2
  • date, year, month and day querystring lookups 1
  • Support for ?field__isnull=1 or similar 1
  • add support for ?field__isnull=1 1
  • Allow --load-extension to be set via environment variables 1
  • Add spatialite, switch to debian and local build 1
  • Add keyboard shortcut to execute SQL query 1

user 1

  • simonw · 12 ✖

author_association 1

  • OWNER 12
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
345342512 https://github.com/simonw/datasette/issues/44#issuecomment-345342512 https://api.github.com/repos/simonw/datasette/issues/44 MDEyOklzc3VlQ29tbWVudDM0NTM0MjUxMg== simonw 9599 2017-11-17T19:27:53Z 2017-11-20T04:37:35Z OWNER

This should support multiple columns, e.g. ?_group_count=precinct&_group_count=candidate

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_group_count=country - return counts by specific column(s) 269731374  
345343079 https://github.com/simonw/datasette/issues/44#issuecomment-345343079 https://api.github.com/repos/simonw/datasette/issues/44 MDEyOklzc3VlQ29tbWVudDM0NTM0MzA3OQ== simonw 9599 2017-11-17T19:29:43Z 2017-11-17T19:29:43Z OWNER

Should this support sum/avg/etc as well?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_group_count=country - return counts by specific column(s) 269731374  
345262738 https://github.com/simonw/datasette/issues/36#issuecomment-345262738 https://api.github.com/repos/simonw/datasette/issues/36 MDEyOklzc3VlQ29tbWVudDM0NTI2MjczOA== simonw 9599 2017-11-17T14:45:37Z 2017-11-17T14:45:37Z OWNER

Consider for example https://fivethirtyeight.datasettes.com/fivethirtyeight/inconvenient-sequel%2Fratings

The idea here is to be able to support querystring parameters like this:

  • ?timestamp___date=2017-07-17 - return every item where the timestamp falls on that date
  • ?timestamp___year=2017 - return every item where the timestamp falls within 2017
  • ?timestamp___month=1 - return every item where the month component is January
  • ?timestamp___day=10 - return every item where the day-of-the-month component is 10

This is similar to #64 but a fair bit more complicated.

SQLite date functions are documented here: https://sqlite.org/lang_datefunc.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
date, year, month and day querystring lookups 268262480  
345260784 https://github.com/simonw/datasette/issues/64#issuecomment-345260784 https://api.github.com/repos/simonw/datasette/issues/64 MDEyOklzc3VlQ29tbWVudDM0NTI2MDc4NA== simonw 9599 2017-11-17T14:38:21Z 2017-11-17T14:38:21Z OWNER

This was fixed by ed2b3f25beac720f14869350baacc5f62b065194 in #107 - thanks @raynae!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Support for ?field__isnull=1 or similar 273181020  
345259115 https://github.com/simonw/datasette/issues/46#issuecomment-345259115 https://api.github.com/repos/simonw/datasette/issues/46 MDEyOklzc3VlQ29tbWVudDM0NTI1OTExNQ== simonw 9599 2017-11-17T14:32:12Z 2017-11-17T14:32:12Z OWNER

OK, I can confirm that the version in the new docker container supports FTS5, JSON and spatialite!

Notes on how I built the container and tested the spatialite extension are here: https://github.com/simonw/datasette/issues/112#issuecomment-345255655

To confirm that JSON and FTS5 are working, I ran the following:

$ docker run -it -p 8001:8001 6c9ca7e29181 python
Python 3.6.3 (default, Nov  4 2017, 14:24:48) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.connect(':memory:').execute('CREATE VIRTUAL TABLE email USING fts5(sender, title, body);')
<sqlite3.Cursor object at 0x7f2d90839960>
>>> list(sqlite3.connect(':memory:').execute('''SELECT json(' { "this" : "is", "a": [ "test" ] } ') '''))
[('{"this":"is","a":["test"]}',)]

If I do the same thing in python3 on my OS X laptop directly, I get this:

$ python3
Python 3.5.1 (default, Apr 18 2016, 11:46:32) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.connect(':memory:').execute('CREATE VIRTUAL TABLE email USING fts5(sender, title, body);')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
sqlite3.OperationalError: no such module: fts5
>>> list(sqlite3.connect(':memory:').execute('''SELECT json(' { "this" : "is", "a": [ "test" ] } ') '''))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
sqlite3.OperationalError: no such function: json
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Dockerfile should build more recent SQLite with FTS5 and spatialite support 271301468  
345256576 https://github.com/simonw/datasette/pull/115#issuecomment-345256576 https://api.github.com/repos/simonw/datasette/issues/115 MDEyOklzc3VlQ29tbWVudDM0NTI1NjU3Ng== simonw 9599 2017-11-17T14:22:51Z 2017-11-17T14:22:51Z OWNER

This is great - I've been frustrated by how CodeMirror prevents me from hitting tab-enter to activate the "Run SQL" button.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add keyboard shortcut to execute SQL query 274877366  
345255655 https://github.com/simonw/datasette/issues/112#issuecomment-345255655 https://api.github.com/repos/simonw/datasette/issues/112 MDEyOklzc3VlQ29tbWVudDM0NTI1NTY1NQ== simonw 9599 2017-11-17T14:19:23Z 2017-11-17T14:19:23Z OWNER

I tesed this by first building and running a container using the new Dockerfile from #114:

docker build .
docker run -it -p 8001:8001 6c9ca7e29181 /bin/sh

Then I ran this inside the container itself:

apt update && apt-get install wget -y \
    && wget http://www.gaia-gis.it/spatialite-2.3.1/test-2.3.sqlite.gz \
    && gunzip test-2.3.sqlite.gz \
    && mv test-2.3.sqlite test23.sqlite \
    && datasette -h 0.0.0.0 test23.sqlite

I visited this URL to confirm I got an error due to spatialite not being loaded:

http://localhost:8001/test23-c88bc35?sql=select+ST_AsText%28Geometry%29+from+HighWays+limit+1

Then I checked that loading it with --load-extension worked correctly:

datasette -h 0.0.0.0 test23.sqlite \
    --load-extension=/usr/lib/x86_64-linux-gnu/mod_spatialite.so

Then, finally, I tested it with the new environment variable option:

SQLITE_EXTENSIONS=/usr/lib/x86_64-linux-gnu/mod_spatialite.so \
    datasette -h 0.0.0.0 test23.sqlite

Running it with an invalid environment variable option shows an error:

$ SQLITE_EXTENSIONS=/usr/lib/x86_64-linux-gnu/blah.so datasette \
    -h 0.0.0.0 test23.sqlite
Usage: datasette -h [OPTIONS] [FILES]...

Error: Invalid value for "--load-extension": Path "/usr/lib/x86_64-linux-gnu/blah.so" does not exist.
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow --load-extension to be set via environment variables 274617240  
345242447 https://github.com/simonw/datasette/issues/85#issuecomment-345242447 https://api.github.com/repos/simonw/datasette/issues/85 MDEyOklzc3VlQ29tbWVudDM0NTI0MjQ0Nw== simonw 9599 2017-11-17T13:22:33Z 2017-11-17T13:23:14Z OWNER

I could support explicit label columns using additional arguments to datasette serve:

datasette serve mydb.py --label-column mydb:table1:name --label-column mydb:table2:title

This would mean "in mydb, set the label column for table1 to name, and the label column for table2 to title"

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Detect foreign keys and use them to link HTML pages together 273678673  
345150048 https://github.com/simonw/datasette/issues/85#issuecomment-345150048 https://api.github.com/repos/simonw/datasette/issues/85 MDEyOklzc3VlQ29tbWVudDM0NTE1MDA0OA== simonw 9599 2017-11-17T05:35:25Z 2017-11-17T05:35:25Z OWNER

csvs-to-sqlite is now capable of generating databases with foreign key lookup tables: https://github.com/simonw/csvs-to-sqlite/releases/tag/0.3

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Detect foreign keys and use them to link HTML pages together 273678673  
345138347 https://github.com/simonw/datasette/issues/46#issuecomment-345138347 https://api.github.com/repos/simonw/datasette/issues/46 MDEyOklzc3VlQ29tbWVudDM0NTEzODM0Nw== simonw 9599 2017-11-17T03:52:25Z 2017-11-17T03:52:25Z OWNER

We now have a Dockerfile that compiles spatialite! https://github.com/simonw/datasette/pull/114/commits/6c6b63d890529eeefcefb7ab126ea3bd7b2315c1

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Dockerfile should build more recent SQLite with FTS5 and spatialite support 271301468  
345138134 https://github.com/simonw/datasette/pull/114#issuecomment-345138134 https://api.github.com/repos/simonw/datasette/issues/114 MDEyOklzc3VlQ29tbWVudDM0NTEzODEzNA== simonw 9599 2017-11-17T03:50:38Z 2017-11-17T03:50:38Z OWNER

Fantastic! Thank you very much.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add spatialite, switch to debian and local build 274733145  
345108644 https://github.com/simonw/datasette/pull/107#issuecomment-345108644 https://api.github.com/repos/simonw/datasette/issues/107 MDEyOklzc3VlQ29tbWVudDM0NTEwODY0NA== simonw 9599 2017-11-17T00:34:46Z 2017-11-17T00:34:46Z OWNER

Looks like your tests are failing because of a bug which I fixed in https://github.com/simonw/datasette/commit/9199945a1bcec4852e1cb866eb3642614dd32a48 - if you rebase to master the tests should pass.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
add support for ?field__isnull=1 274343647  

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