home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 722816436 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 · 5 ✖

issue 1

  • .extract() shouldn't extract null values · 5 ✖

author_association 1

  • OWNER 5
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
710198162 https://github.com/simonw/sqlite-utils/issues/186#issuecomment-710198162 https://api.github.com/repos/simonw/sqlite-utils/issues/186 MDEyOklzc3VlQ29tbWVudDcxMDE5ODE2Mg== simonw 9599 2020-10-16T16:41:00Z 2020-10-16T16:41:00Z OWNER

Failing test: python def test_extract_null_values(fresh_db): fresh_db["species"].insert({"id": 1, "species": "Wolf"}, pk="id") fresh_db["individuals"].insert_all( [ {"id": 10, "name": "Terriana", "species": "Fox"}, {"id": 11, "name": "Spenidorm", "species": None}, {"id": 12, "name": "Grantheim", "species": "Wolf"}, {"id": 13, "name": "Turnutopia", "species": None}, {"id": 14, "name": "Wargal", "species": "Wolf"}, ], pk="id", ) fresh_db["individuals"].extract("species") assert fresh_db["species"].schema == ( "CREATE TABLE [species] (\n" " [id] INTEGER PRIMARY KEY,\n" " [species] TEXT\n" ")" ) assert fresh_db["individuals"].schema == ( 'CREATE TABLE "individuals" (\n' " [id] INTEGER PRIMARY KEY,\n" " [name] TEXT,\n" " [species_id] INTEGER,\n" " FOREIGN KEY(species_id) REFERENCES species(id)\n" ")" ) assert list(fresh_db["species"].rows) == [ {"id": 1, "species": "Wolf"}, {"id": 2, "species": "Fox"}, ] assert list(fresh_db["individuals"].rows) == [ {"id": 10, "name": "Terriana", "species_id": 2}, {"id": 11, "name": "Spenidorm", "species_id": None}, {"id": 12, "name": "Grantheim", "species_id": 1}, {"id": 13, "name": "Turnutopia", "species_id": None}, {"id": 14, "name": "Wargal", "species_id": 1}, ]

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.extract() shouldn't extract null values 722816436  
709706260 https://github.com/simonw/sqlite-utils/issues/186#issuecomment-709706260 https://api.github.com/repos/simonw/sqlite-utils/issues/186 MDEyOklzc3VlQ29tbWVudDcwOTcwNjI2MA== simonw 9599 2020-10-16T03:17:02Z 2020-10-16T03:17:17Z OWNER

Actually I think this should be an option to .extract() which controls if nulls are extracted or left alone. Maybe called extract_nulls=True/False.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.extract() shouldn't extract null values 722816436  
709706065 https://github.com/simonw/sqlite-utils/issues/186#issuecomment-709706065 https://api.github.com/repos/simonw/sqlite-utils/issues/186 MDEyOklzc3VlQ29tbWVudDcwOTcwNjA2NQ== simonw 9599 2020-10-16T03:16:22Z 2020-10-16T03:16:22Z OWNER

Either way I think I'm going to need to add some SQL which uses where a = b or (a is null and b is null).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.extract() shouldn't extract null values 722816436  
709705885 https://github.com/simonw/sqlite-utils/issues/186#issuecomment-709705885 https://api.github.com/repos/simonw/sqlite-utils/issues/186 MDEyOklzc3VlQ29tbWVudDcwOTcwNTg4NQ== simonw 9599 2020-10-16T03:15:39Z 2020-10-16T03:15:39Z OWNER

The alternative solution here would be that a single null value DOES get extracted. To implement this I would need to add some logic that uses is null instead of =.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.extract() shouldn't extract null values 722816436  
709705624 https://github.com/simonw/sqlite-utils/issues/186#issuecomment-709705624 https://api.github.com/repos/simonw/sqlite-utils/issues/186 MDEyOklzc3VlQ29tbWVudDcwOTcwNTYyNA== simonw 9599 2020-10-16T03:14:39Z 2020-10-16T03:14:39Z OWNER

How should this work with extractions covering multiple columns?

If there's a single column then it makes sense that a null value would not be extracted into the lookup table, but would instead become stay as null.

For a multiple column extraction, provided at least one of those columns is not null It should map to a record in the lookup table. Only if ALL of the extracted columns are null should the lookup value stay null.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.extract() shouldn't extract null values 722816436  

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