home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 1856075668 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 · 3 ✖

issue 1

  • .transform() fails to drop column if table is part of a view · 3 ✖

author_association 1

  • OWNER 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1683404978 https://github.com/simonw/sqlite-utils/issues/586#issuecomment-1683404978 https://api.github.com/repos/simonw/sqlite-utils/issues/586 IC_kwDOCGYnMM5kVriy simonw 9599 2023-08-18T06:13:46Z 2023-08-18T06:13:46Z OWNER

I shipped the view recreating fix in datasette-edit-schema, so at least I can start exercising that fix and see if it has any weird issues.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.transform() fails to drop column if table is part of a view 1856075668  
1683398866 https://github.com/simonw/sqlite-utils/issues/586#issuecomment-1683398866 https://api.github.com/repos/simonw/sqlite-utils/issues/586 IC_kwDOCGYnMM5kVqDS simonw 9599 2023-08-18T06:05:50Z 2023-08-18T06:06:42Z OWNER

Options: - Provide a recreate_views: bool parameter to table.transform() controlling if views that might reference this table are stashed and dropped and recreated within a transaction as part of the operation. But should that be True or False by default? - Read that PRAGMA and automatically do that view workaround if it's turned on - Toggle that PRAGMA off for the duration of the .transform() operation and on again at the end. Does it only affect the current connection? - Try the transform() in a transaction, detect the "error in view", "no such table"error, if spotted then do the VIEW workaround and try again

I'm on the fence as to which of these I like the most. I'm tempted to go with the one which just drops VIEWS and recreates them all the time, because it feels simpler.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.transform() fails to drop column if table is part of a view 1856075668  
1683396150 https://github.com/simonw/sqlite-utils/issues/586#issuecomment-1683396150 https://api.github.com/repos/simonw/sqlite-utils/issues/586 IC_kwDOCGYnMM5kVpY2 simonw 9599 2023-08-18T06:02:18Z 2023-08-18T06:06:31Z OWNER

More notes in here: - https://github.com/simonw/datasette-edit-schema/issues/35#issuecomment-1683392873

Not all Python/SQLite installations exhibit this problem by default!

It turns out this is controlled by the legacy_alter_table pragma: https://sqlite.org/pragma.html#pragma_legacy_alter_table

If that PRAGMA is turned on (default in newer SQLites) then alter table will error if you try to rename a table that is referenced in a view.

Here's a one-liner to test if it is on or not:

bash python -c 'import sqlite3; print(sqlite3.connect(":memory:").execute("PRAGMA legacy_alter_table").fetchall())'

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.transform() fails to drop column if table is part of a view 1856075668  

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