home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where issue = 702386948 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 4

  • simonw 5
  • dracos 2
  • limar 1
  • spdkils 1

author_association 2

  • OWNER 5
  • NONE 4

issue 1

  • .delete_where() does not auto-commit (unlike .insert() or .upsert()) · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1493051222 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-1493051222 https://api.github.com/repos/simonw/sqlite-utils/issues/159 IC_kwDOCGYnMM5Y_idW dracos 154364 2023-04-01T17:21:05Z 2023-04-01T17:21:05Z NONE

In a related issue, nearly a year later I just stumbled across this again, as I wondered why none of my rebuild-fts were rebuilding. It looks like: disable_fts in db.py commits; enable_fts partly commits except the last step (due to executescript committing a pending transaction); rebuild_fts won't commit unless manually done as above with e.g. a context manager.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
1111506339 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-1111506339 https://api.github.com/repos/simonw/sqlite-utils/issues/159 IC_kwDOCGYnMM5CQD2j dracos 154364 2022-04-27T21:35:13Z 2022-04-27T21:35:13Z NONE

Just stumbled across this, wondering why none of my deletes were working.

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
802032152 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-802032152 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDgwMjAzMjE1Mg== limar 1025224 2021-03-18T15:42:52Z 2021-03-18T15:42:52Z NONE

I confirm the bug. Happens for me in version 3.6. I use the call to delete all the records: table.delete_where() This does not delete anything.

I see that delete() method DOES use context manager with self.db.conn: which should help. You may want to align the code of both methods.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
693695177 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-693695177 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDY5MzY5NTE3Nw== simonw 9599 2020-09-16T22:17:53Z 2020-09-16T22:17:53Z OWNER

@spdkils can you share a minimal code example that exhibits the behavior you're seeing?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
693694968 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-693694968 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDY5MzY5NDk2OA== simonw 9599 2020-09-16T22:17:19Z 2020-09-16T22:17:19Z OWNER

That's strange... this test here doesn't manually commit a transaction and passes:

https://github.com/simonw/sqlite-utils/blob/7805d53bcf11199bd1f2b07e05ae90151f9d0eb0/tests/test_delete.py#L17-L23

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
693694343 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-693694343 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDY5MzY5NDM0Mw== simonw 9599 2020-09-16T22:15:39Z 2020-09-16T22:15:39Z OWNER

Independent of the transaction changes in #121 I may be able to check self.conn.in_transaction to see if a transaction is active and, if one is NOT active, execute the delete inside of one. https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.in_transaction

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
693589321 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-693589321 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDY5MzU4OTMyMQ== simonw 9599 2020-09-16T18:41:42Z 2020-09-16T18:41:42Z OWNER

Yeah I'm going to class this as a bug - that's definitely confusing.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
693486183 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-693486183 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDY5MzQ4NjE4Mw== spdkils 11712349 2020-09-16T15:34:13Z 2020-09-16T15:34:13Z NONE

I appreciate the response, it's just unexpected.

If I insert, it commits, if I update it commits, if I upsert it commits... if I delete.. it doesn't??? Confused me...

I did just db commit it... But it's confusing.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  
693199049 https://github.com/simonw/sqlite-utils/issues/159#issuecomment-693199049 https://api.github.com/repos/simonw/sqlite-utils/issues/159 MDEyOklzc3VlQ29tbWVudDY5MzE5OTA0OQ== simonw 9599 2020-09-16T06:20:26Z 2020-09-16T06:20:26Z OWNER

See #121 - I need to think harder about how this all interacts with transactions.

You can do this:

python with db.conn: db["mytable"].delete_where() But that should be documented and maybe rethought.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
.delete_where() does not auto-commit (unlike .insert() or .upsert()) 702386948  

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