home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "OWNER", issue = 581339961 and user = 9599 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 · 7 ✖

issue 1

  • .columns_dict doesn't work for all possible column types · 7 ✖

author_association 1

  • OWNER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
599247833 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599247833 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTI0NzgzMw== simonw 9599 2020-03-15T18:37:28Z 2020-03-15T18:37:43Z OWNER

Released in 2.4.2.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  
599128891 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599128891 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTEyODg5MQ== simonw 9599 2020-03-14T20:03:45Z 2020-03-14T20:03:45Z OWNER

I'm going to keep treating them as str.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  
599127453 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599127453 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTEyNzQ1Mw== simonw 9599 2020-03-14T19:50:08Z 2020-03-14T19:50:08Z OWNER

If the declared type for a column contains the string "BLOB" or if no type is specified then the column has affinity BLOB

I currently treat those as str - it sounds like I should treat them as bytes:

https://github.com/simonw/sqlite-utils/blob/43f1c6ab4e3a6b76531fb6f5447adb83d26f3971/sqlite_utils/db.py#L68-L69

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  
599127197 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599127197 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTEyNzE5Nw== simonw 9599 2020-03-14T19:48:06Z 2020-03-14T19:48:06Z OWNER

Actually it looks like I should implement the exact rules described in https://www.sqlite.org/datatype3.html#determination_of_column_affinity

The affinity of a column is determined by the declared type of the column, according to the following rules in the order shown:

  1. If the declared type contains the string "INT" then it is assigned INTEGER affinity.
  2. If the declared type of the column contains any of the strings "CHAR", "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the type VARCHAR contains the string "CHAR" and is thus assigned TEXT affinity.
  3. If the declared type for a column contains the string "BLOB" or if no type is specified then the column has affinity BLOB.
  4. If the declared type for a column contains any of the strings "REAL", "FLOA", or "DOUB" then the column has REAL affinity.
  5. Otherwise, the affinity is NUMERIC.

Note that the order of the rules for determining column affinity is important. A column whose declared type is "CHARINT" will match both rules 1 and 2 but the first rule takes precedence and so the column affinity will be INTEGER.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  
599126831 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599126831 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTEyNjgzMQ== simonw 9599 2020-03-14T19:45:28Z 2020-03-14T19:45:28Z OWNER

Turns out there are a TON of valid column definitions that aren't being considered yet - https://www.sqlite.org/datatype3.html#affinity_name_examples - stuff like VARYING CHARACTER(255) and DECIMAL(10,5).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  
599125557 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599125557 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTEyNTU1Nw== simonw 9599 2020-03-14T19:35:29Z 2020-03-14T19:35:29Z OWNER

Fixing that would technically constitute a breaking change for library consumers, so it should be a major version release.

I'm not inclined to release 3.0 just for this one issue, so I'm going to hold back on fixing that and address the smaller issue in this bug as a dot release instead for the moment.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  
599125455 https://github.com/simonw/sqlite-utils/issues/92#issuecomment-599125455 https://api.github.com/repos/simonw/sqlite-utils/issues/92 MDEyOklzc3VlQ29tbWVudDU5OTEyNTQ1NQ== simonw 9599 2020-03-14T19:34:35Z 2020-03-14T19:34:35Z OWNER

From https://www.sqlite.org/datatype3.html it looks like FLOAT is a supported keyword for creating tables but REAL is the correct keyword.

So actually sqlite-utils gets this wrong, because when we create a table we turn Python float values into a FLOAT column. Looks like the correct behaviour would be to turn them into a REAL column.

https://github.com/simonw/sqlite-utils/blob/43f1c6ab4e3a6b76531fb6f5447adb83d26f3971/sqlite_utils/db.py#L28-L48

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.columns_dict doesn't work for all possible column types 581339961  

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