home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where issue = 449818897 and user = 9599 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: updated_at (date)

user 1

  • simonw · 6 ✖

issue 1

  • Additional Column Constraints? · 6 ✖

author_association 1

  • OWNER 6
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
501572149 https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501572149 https://api.github.com/repos/simonw/sqlite-utils/issues/24 MDEyOklzc3VlQ29tbWVudDUwMTU3MjE0OQ== simonw 9599 2019-06-13T06:47:17Z 2019-06-13T06:47:17Z OWNER

@IgnoredAmbience this is now shipped in sqlite-utils 1.2 - documentation here:

  • https://sqlite-utils.readthedocs.io/en/latest/python-api.html#python-api-defaults-not-null
  • https://sqlite-utils.readthedocs.io/en/latest/cli.html#cli-defaults-not-null
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Additional Column Constraints? 449818897  
501516028 https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501516028 https://api.github.com/repos/simonw/sqlite-utils/issues/24 MDEyOklzc3VlQ29tbWVudDUwMTUxNjAyOA== simonw 9599 2019-06-13T01:42:36Z 2019-06-13T01:42:36Z OWNER

Maybe it's time to create a sqlite-utils create-table command here too, rather than forcing people to create tables only by inserting example data.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Additional Column Constraints? 449818897  
501515609 https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501515609 https://api.github.com/repos/simonw/sqlite-utils/issues/24 MDEyOklzc3VlQ29tbWVudDUwMTUxNTYwOQ== simonw 9599 2019-06-13T01:40:12Z 2019-06-13T01:40:47Z OWNER

But what to do for creating a table?

For the Python function I could do this: python db["cats"].create({ "id": int, "name": str, "score": int, "weight": float, }, pk="id", not_null={"weight"}, defaults={"score": 1})

The CLI tool only every creates tables as a side-effect of a sqlite-utils insert or sqlite-utils upsert. I can have them accept optional arguments, --not-null colname and --default colname value: echo '{"name": "Cleo", "age": 4, "score": 2}' | \ sqlite-utils insert dogs.db dogs - \ --not-null age \ --not-null name \ --default score 1

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Additional Column Constraints? 449818897  
501514575 https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501514575 https://api.github.com/repos/simonw/sqlite-utils/issues/24 MDEyOklzc3VlQ29tbWVudDUwMTUxNDU3NQ== simonw 9599 2019-06-13T01:34:55Z 2019-06-13T01:34:55Z OWNER

Since you can't have one without the other, I'm going with --not-null-default= and not_null_default= for the add column versions of this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Additional Column Constraints? 449818897  
501509642 https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501509642 https://api.github.com/repos/simonw/sqlite-utils/issues/24 MDEyOklzc3VlQ29tbWVudDUwMTUwOTY0Mg== simonw 9599 2019-06-13T01:06:09Z 2019-06-13T01:06:09Z OWNER

Hmm... we need the ability to pass --not-null when we are creating a table as well.

If you attempt to add NOT NULL to a column after a table has first been created you get this error:

sqlite3.OperationalError: Cannot add a NOT NULL column with default value NULL

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Additional Column Constraints? 449818897  
499603495 https://github.com/simonw/sqlite-utils/issues/24#issuecomment-499603495 https://api.github.com/repos/simonw/sqlite-utils/issues/24 MDEyOklzc3VlQ29tbWVudDQ5OTYwMzQ5NQ== simonw 9599 2019-06-06T18:02:20Z 2019-06-06T18:02:20Z OWNER

This seems reasonable. It could look like this:

python db["dogs"].add_column("instagram", str, not_null=True) db["dogs"].add_column("is_good_dog", bool, default=True) And this: bash $ sqlite-utils add-column mydb.db dogs instagram --not-null $ sqlite-utils add-column mydb.db dogs is_good_dog integer --default=1

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Additional Column Constraints? 449818897  

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