issue_comments
7 rows where issue = 686978131 sorted by updated_at descending
This data as json, CSV (advanced)
Suggested facets: reactions, created_at (date), updated_at (date)
issue 1
- insert_all(..., alter=True) should work for new columns introduced after the first 100 records · 7 ✖
id | html_url | issue_url | node_id | user | created_at | updated_at ▲ | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
683178570 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-683178570 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4MzE3ODU3MA== | simonw 9599 | 2020-08-28T22:48:51Z | 2020-08-28T22:48:51Z | OWNER | Thanks @simonwiles, this is now released in 2.16.1: https://sqlite-utils.readthedocs.io/en/stable/changelog.html |
{ "total_count": 2, "+1": 1, "-1": 0, "laugh": 0, "hooray": 1, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 | |
682815377 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-682815377 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4MjgxNTM3Nw== | simonwiles 96218 | 2020-08-28T16:14:58Z | 2020-08-28T16:14:58Z | CONTRIBUTOR | Thanks! And yeah, I had updating the docs on my list too :) Will try to get to it this afternoon (budgeting time is fraught with uncertainty at the moment!). |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 | |
682771226 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-682771226 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4Mjc3MTIyNg== | simonw 9599 | 2020-08-28T15:57:42Z | 2020-08-28T15:57:42Z | OWNER | That pull request should update this section of the documentation too:
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 | |
682762911 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-682762911 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4Mjc2MjkxMQ== | simonw 9599 | 2020-08-28T15:54:57Z | 2020-08-28T15:55:20Z | OWNER | Here's a suggested test update: ```diff diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index a8791c3..12fa2f2 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -1074,6 +1074,13 @@ class Table(Queryable): all_columns = list(sorted(all_columns)) if hash_id: all_columns.insert(0, hash_id) + else: + all_columns += [ + column + for record in chunk + for column in record + if column not in all_columns + ] validate_column_names(all_columns) first = False # values is the list of insert data that is passed to the diff --git a/tests/test_create.py b/tests/test_create.py index a84eb8d..3a7fafc 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -707,13 +707,15 @@ def test_insert_thousands_using_generator(fresh_db): assert 10000 == fresh_db["test"].count -def test_insert_thousands_ignores_extra_columns_after_first_100(fresh_db): +def test_insert_thousands_adds_extra_columns_after_first_100(fresh_db): + # https://github.com/simonw/sqlite-utils/issues/139 fresh_db["test"].insert_all( [{"i": i, "word": "word_{}".format(i)} for i in range(100)] - + [{"i": 101, "extra": "This extra column should cause an exception"}] + + [{"i": 101, "extra": "Should trigger ALTER"}], + alter=True, ) rows = fresh_db.execute_returning_dicts("select * from test where i = 101") - assert [{"i": 101, "word": None}] == rows + assert [{"i": 101, "word": None, "extra": "Should trigger ALTER"}] == rows def test_insert_ignore(fresh_db): ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 | |
682285212 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-682285212 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4MjI4NTIxMg== | simonw 9599 | 2020-08-28T02:12:51Z | 2020-08-28T02:12:51Z | OWNER | I'd be happy to accept a PR for this, provided it included updated unit tests that illustrate it working. I think this is a really good improvement. |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 | |
682284908 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-682284908 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4MjI4NDkwOA== | simonw 9599 | 2020-08-28T02:11:40Z | 2020-08-28T02:11:40Z | OWNER | This is deliberate behaviour, but I'm not at all attached to it - you're right in pointing out that it's actually pretty unexpected. I'd be happy to change this behaviour so if you pass |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 | |
682182178 | https://github.com/simonw/sqlite-utils/issues/139#issuecomment-682182178 | https://api.github.com/repos/simonw/sqlite-utils/issues/139 | MDEyOklzc3VlQ29tbWVudDY4MjE4MjE3OA== | simonwiles 96218 | 2020-08-27T20:46:18Z | 2020-08-27T20:46:18Z | CONTRIBUTOR |
So the reason for this is that the With regard to the issue of ignoring columns, however, I made a fork and hacked a temporary fix that looks like this: https://github.com/simonwiles/sqlite-utils/commit/3901f43c6a712a1a3efc340b5b8d8fd0cbe8ee63 It doesn't seem to affect performance enormously (but I've not tested it thoroughly), and it now does what I need (and would expect, tbh), but it now fails the test here: https://github.com/simonw/sqlite-utils/blob/main/tests/test_create.py#L710-L716 The existence of this test suggests that @simonw is this something you'd be willing to look at a PR for? I assume you wouldn't want to change the default behaviour at this point, but perhaps an option could be provided, or at least a bit more of a warning in the docs. Are there oversights in the implementation that I've made? Would be grateful for your thoughts! Thanks! |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
insert_all(..., alter=True) should work for new columns introduced after the first 100 records 686978131 |
Advanced export
JSON shape: default, array, newline-delimited, object
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]);
user 2