home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where author_association = "CONTRIBUTOR" and user = 167893 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue 5

  • Repeated calls to `Table.convert()` fail 2
  • CLI eats my cursor 1
  • Reading rows from a file => AttributeError: '_io.StringIO' object has no attribute 'readinto' 1
  • rows_from_file() raises confusing error if file-like object is not in binary mode 1
  • `Table.convert()` skips falsey values 1

user 1

  • mcarpenter · 6 ✖

author_association 1

  • CONTRIBUTOR · 6 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1540900733 https://github.com/simonw/sqlite-utils/issues/527#issuecomment-1540900733 https://api.github.com/repos/simonw/sqlite-utils/issues/527 IC_kwDOCGYnMM5b2Ed9 mcarpenter 167893 2023-05-09T21:15:05Z 2023-05-09T21:15:05Z CONTRIBUTOR

Sorry, I completely missed your first comment whilst on Easter break.

This looks like a good practical compromise before v4. Thanks!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`Table.convert()` skips falsey values 1578790070  
1444474487 https://github.com/simonw/sqlite-utils/issues/433#issuecomment-1444474487 https://api.github.com/repos/simonw/sqlite-utils/issues/433 IC_kwDOCGYnMM5WGO53 mcarpenter 167893 2023-02-24T20:57:43Z 2023-02-24T22:22:18Z CONTRIBUTOR

I think I see what is happening here, although I haven't quite work out a fix yet. Usually:

  • click.progressbar.render_progress() renders the cursor invisible on each invocation (update of the bar)
  • When the progress bar goes out of scope, the __exit()__ method is invoked, which calls render_finish() to make the cursor re-appear.

(See terminal escape sequences BEFORE_BAR and AFTER_BAR in click).

However the sqlite-utils utils.file_progress context manager wraps click.progressbar and yields an instance of a helper class:

python @contextlib.contextmanager def file_progress(file, silent=False, **kwargs): ... with click.progressbar(length=file_length, **kwargs) as bar: yield UpdateWrapper(file, bar.update)

The yielded UpdateWrapper goes out of scope quickly and click.progressbar.__exit__() is called. The cursor is made un-invisible. Hoewever bar is still live and so when the caller iterates on the yielded wrapper this invokes the bar's update method, calling render_progress(), each time printing the "make cursor invisible" escape code. The progressbar.__exit__ function is not called again, so the cursor doesn't re-appear.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
CLI eats my cursor 1239034903  
1435318713 https://github.com/simonw/sqlite-utils/issues/525#issuecomment-1435318713 https://api.github.com/repos/simonw/sqlite-utils/issues/525 IC_kwDOCGYnMM5VjTm5 mcarpenter 167893 2023-02-17T21:55:01Z 2023-02-17T21:55:01Z CONTRIBUTOR

Meanwhile, a cheap workaround is to invalidate the registered function cache: python table.convert(...) db._registered_functions = set() table.convert(...)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Repeated calls to `Table.convert()` fail 1575131737  
1423387341 https://github.com/simonw/sqlite-utils/issues/525#issuecomment-1423387341 https://api.github.com/repos/simonw/sqlite-utils/issues/525 IC_kwDOCGYnMM5U1yrN mcarpenter 167893 2023-02-08T23:48:52Z 2023-02-09T00:17:30Z CONTRIBUTOR

PR below

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Repeated calls to `Table.convert()` fail 1575131737  
1421571810 https://github.com/simonw/sqlite-utils/issues/520#issuecomment-1421571810 https://api.github.com/repos/simonw/sqlite-utils/issues/520 IC_kwDOCGYnMM5Uu3bi mcarpenter 167893 2023-02-07T22:43:09Z 2023-02-07T22:43:09Z CONTRIBUTOR

Hey, isn't this essentially the same issue as #448 ?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
rows_from_file() raises confusing error if file-like object is not in binary mode 1516644980  
1297703307 https://github.com/simonw/sqlite-utils/issues/448#issuecomment-1297703307 https://api.github.com/repos/simonw/sqlite-utils/issues/448 IC_kwDOCGYnMM5NWWGL mcarpenter 167893 2022-10-31T21:23:51Z 2022-10-31T21:27:32Z CONTRIBUTOR

The Windows aspect is a red herring: OP's sample above produces the same error on Linux. (Though I don't know what's going on with the CI).

The same error can also be obtained by passing an io from a file opened in non-binary mode ('r' as opposed to 'rb') to rows_from_file(). This is how I got here.

The fix for my case is easy: open the file in mode 'rb'. The analagous fix for OP's problem also works: use BytesIO in place of StringIO.

Minimal test case (derived from utils.py):

``` python import io from typing import cast

fp = io.StringIO("id,name\n1,Cleo") # error

fp = io.BytesIO(bytes("id,name\n1,Cleo", encoding='utf-8')) # okay reader = io.BufferedReader(cast(io.RawIOBase, fp)) reader.peek(1) # exception thrown here `` I see the signature ofrows_from_file()correctly hasfp: BinaryIObut I guess you'd need either a runtime type check for that (not allios havemode()), or to catch theAttributeErroronpeek()` to produce a better error for users. Neither option is ideal.

Some thoughts on testing binary-ness of ios in this SO question: https://stackoverflow.com/questions/44584829/how-to-determine-if-file-is-opened-in-binary-or-text-mode

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Reading rows from a file => AttributeError: '_io.StringIO' object has no attribute 'readinto' 1279144769  

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