home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where issue = 1279144769 and user = 167893 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

  • mcarpenter · 1 ✖

issue 1

  • Reading rows from a file => AttributeError: '_io.StringIO' object has no attribute 'readinto' · 1 ✖

author_association 1

  • CONTRIBUTOR 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
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 18.277ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows