issue_comments
4 rows where author_association = "OWNER", issue = 1072792507 and user = 9599 sorted by updated_at descending
This data as json, CSV (advanced)
Suggested facets: created_at (date), updated_at (date)
issue 1
- `sqlite-utils insert --extract colname` · 4 ✖
id | html_url | issue_url | node_id | user | created_at | updated_at ▲ | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
1029479388 | https://github.com/simonw/sqlite-utils/issues/352#issuecomment-1029479388 | https://api.github.com/repos/simonw/sqlite-utils/issues/352 | IC_kwDOCGYnMM49XJvc | simonw 9599 | 2022-02-03T22:59:35Z | 2022-02-03T22:59:35Z | OWNER | Ran into this bug again while writing tests for this: - #186 |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
`sqlite-utils insert --extract colname` 1072792507 | |
1024727476 | https://github.com/simonw/sqlite-utils/issues/352#issuecomment-1024727476 | https://api.github.com/repos/simonw/sqlite-utils/issues/352 | IC_kwDOCGYnMM49FBm0 | simonw 9599 | 2022-01-28T23:01:06Z | 2022-01-28T23:01:06Z | OWNER | Manual test run with that prototype:
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
`sqlite-utils insert --extract colname` 1072792507 | |
1024726879 | https://github.com/simonw/sqlite-utils/issues/352#issuecomment-1024726879 | https://api.github.com/repos/simonw/sqlite-utils/issues/352 | IC_kwDOCGYnMM49FBdf | simonw 9599 | 2022-01-28T22:59:44Z | 2022-01-28T22:59:44Z | OWNER | Rough prototype, seems to work:; ```diff diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 771d432..431b93e 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -867,6 +867,12 @@ def insert_upsert_options(*, require_pk=False): ), load_extension_option, click.option("--silent", is_flag=True, help="Do not show progress bar"), + click.option( + "--extract", + "extracts", + multiple=True, + help="Columns to extract to another table", + ), ) ): fn = decorator(fn) @@ -906,6 +912,7 @@ def insert_upsert_implementation( load_extension=None, silent=False, bulk_sql=None, + extracts=None, ): db = sqlite_utils.Database(path) _load_extensions(db, load_extension) @@ -1008,6 +1015,8 @@ def insert_upsert_implementation( extra_kwargs["defaults"] = dict(default) if upsert: extra_kwargs["upsert"] = upsert + if extracts is not None: + extra_kwargs["extracts"] = extracts
@@ -1117,6 +1126,7 @@ def insert( truncate, not_null, default, + extracts, ): """ Insert records from FILE into a table, creating the table if it @@ -1174,6 +1184,7 @@ def insert( silent=silent, not_null=not_null, default=default, + extracts=extracts, ) except UnicodeDecodeError as ex: raise click.ClickException(UNICODE_ERROR.format(ex)) @@ -1207,6 +1218,7 @@ def upsert( analyze, load_extension, silent, + extracts, ): """ Upsert records based on their primary key. Works like 'insert' but if ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
`sqlite-utils insert --extract colname` 1072792507 | |
987454872 | https://github.com/simonw/sqlite-utils/issues/352#issuecomment-987454872 | https://api.github.com/repos/simonw/sqlite-utils/issues/352 | IC_kwDOCGYnMM46212Y | simonw 9599 | 2021-12-07T00:56:29Z | 2021-12-07T00:56:29Z | OWNER | Thought about this due to this issue, which should stay consistent with how the |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
`sqlite-utils insert --extract colname` 1072792507 |
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 1