home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1155953345

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/sqlite-utils/issues/439#issuecomment-1155953345 https://api.github.com/repos/simonw/sqlite-utils/issues/439 1155953345 IC_kwDOCGYnMM5E5nLB 9599 2022-06-15T03:53:43Z 2022-06-15T03:53:43Z OWNER

I tried fixing this by using .tell() to read the file position as I was iterating through it:

diff --git a/sqlite_utils/utils.py b/sqlite_utils/utils.py
index d2ccc5f..29ad12e 100644
--- a/sqlite_utils/utils.py
+++ b/sqlite_utils/utils.py
@@ -149,10 +149,13 @@ class UpdateWrapper:
     def __init__(self, wrapped, update):
         self._wrapped = wrapped
         self._update = update
+        self._tell = wrapped.tell()

     def __iter__(self):
         for line in self._wrapped:
-            self._update(len(line))
+            tell = self._wrapped.tell()
+            self._update(self._tell - tell)
+            self._tell = tell
             yield line
 ```
This did not work - I get this error:

File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/utils.py", line 206, in _extra_key_strategy
for row in reader:
File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/utils.py", line 156, in iter
tell = self._wrapped.tell()
OSError: telling position disabled by next() call
`` It looks like you can't use.tell()` during iteration: https://stackoverflow.com/questions/29618936/how-to-solve-oserror-telling-position-disabled-by-next-call

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1250495688  
Powered by Datasette · Queries took 1.089ms · About: github-to-sqlite