issue_comments
9 rows where "created_at" is on date 2021-06-22 sorted by user
This data as json, CSV (advanced)
Suggested facets: issue_url, issue
id | html_url | issue_url | node_id | user ▼ | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
865491922 | https://github.com/simonw/sqlite-utils/issues/290#issuecomment-865491922 | https://api.github.com/repos/simonw/sqlite-utils/issues/290 | MDEyOklzc3VlQ29tbWVudDg2NTQ5MTkyMg== | simonw 9599 | 2021-06-22T03:05:35Z | 2021-06-22T03:05:35Z | OWNER | Potential names: - `db.query(sql)` - it's weird to have both this and `db.execute()` but it is at least short and memorable - `db.sql(sql)` - `db.execute_d(sql)` - ugly - `db.execute_dicts(sql)` - confusing - `db.execute_sql(sql)` - easily confused with `db.execute(sql)` I think `db.query(sql)` may be the best option here. | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | `db.query()` method (renamed `db.execute_returning_dicts()`) 926777310 | |
865495370 | https://github.com/simonw/sqlite-utils/issues/290#issuecomment-865495370 | https://api.github.com/repos/simonw/sqlite-utils/issues/290 | MDEyOklzc3VlQ29tbWVudDg2NTQ5NTM3MA== | simonw 9599 | 2021-06-22T03:14:30Z | 2021-06-22T03:14:30Z | OWNER | One small problem with the existing method: https://github.com/simonw/sqlite-utils/blob/8cedc6a8b29180e68326f6b76f249d5e39e4b591/sqlite_utils/db.py#L362-L365 It returns a full list, but what if the user would rather have a generator they can iterate over without loading the results into memory in one go? | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | `db.query()` method (renamed `db.execute_returning_dicts()`) 926777310 | |
865497846 | https://github.com/simonw/sqlite-utils/issues/290#issuecomment-865497846 | https://api.github.com/repos/simonw/sqlite-utils/issues/290 | MDEyOklzc3VlQ29tbWVudDg2NTQ5Nzg0Ng== | simonw 9599 | 2021-06-22T03:21:38Z | 2021-06-22T03:21:38Z | OWNER | The Python docs say: https://docs.python.org/3/library/sqlite3.html > To retrieve data after executing a SELECT statement, you can either treat the cursor as an iterator, call the cursor’s `fetchone()` method to retrieve a single matching row, or call `fetchall()` to get a list of the matching rows. Looking at the C source code, both `fetchmany()` and `fetchall()` work under the hood by assembling a Python list: https://github.com/python/cpython/blob/be1cb3214d09d4bf0288bc45f3c1f167f67e4514/Modules/_sqlite/cursor.c#L907-L972 - see calls to `PyList_Append()` So it looks like the most efficient way to iterate over a cursor may well be `for row in cursor:` - which I think calls this C function: https://github.com/python/cpython/blob/be1cb3214d09d4bf0288bc45f3c1f167f67e4514/Modules/_sqlite/cursor.c#L813-L876 | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | `db.query()` method (renamed `db.execute_returning_dicts()`) 926777310 | |
865510796 | https://github.com/simonw/sqlite-utils/issues/290#issuecomment-865510796 | https://api.github.com/repos/simonw/sqlite-utils/issues/290 | MDEyOklzc3VlQ29tbWVudDg2NTUxMDc5Ng== | simonw 9599 | 2021-06-22T04:04:40Z | 2021-06-22T04:04:48Z | OWNER | Still needs documentation, which will involve rewriting the whole [Executing queries](https://sqlite-utils.datasette.io/en/3.11/python-api.html#executing-queries) section. | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | `db.query()` method (renamed `db.execute_returning_dicts()`) 926777310 | |
865511810 | https://github.com/simonw/sqlite-utils/issues/290#issuecomment-865511810 | https://api.github.com/repos/simonw/sqlite-utils/issues/290 | MDEyOklzc3VlQ29tbWVudDg2NTUxMTgxMA== | simonw 9599 | 2021-06-22T04:07:34Z | 2021-06-22T18:26:21Z | OWNER | That documentation section is pretty weak at the moment - here's the whole thing: > ### Executing queries > > The `db.execute()` and `db.executescript()` methods provide wrappers around `.execute()` and `.executescript()` on the underlying SQLite connection. These wrappers log to the tracer function if one has been registered. > ```python > db = Database(memory=True) > db["dogs"].insert({"name": "Cleo"}) > db.execute("update dogs set name = 'Cleopaws'") > ``` > You can pass parameters as an optional second argument, using either a list or a dictionary. These will be correctly quoted and escaped. > ```python > # Using ? and a list: > db.execute("update dogs set name = ?", ["Cleopaws"]) > # Or using :name and a dictionary: > db.execute("update dogs set name = :name", {"name": "Cleopaws"}) > ``` - Talks about `.execute()` - I want to talk about `.query()` instead - Doesn't clarify that `.execute()` returns a `Cursor` - and assumes you know what to do with one - Doesn't show an example of a `select` query at all - The "tracer function" bit is confusing (should at least link to docs further down) - For `UPDATE` should show how to access the number of rows modified (probably using `.execute()` there) It does at least cover the two types of parameters, though that could be bulked out. | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | `db.query()` method (renamed `db.execute_returning_dicts()`) 926777310 | |
866182655 | https://github.com/simonw/sqlite-utils/issues/267#issuecomment-866182655 | https://api.github.com/repos/simonw/sqlite-utils/issues/267 | MDEyOklzc3VlQ29tbWVudDg2NjE4MjY1NQ== | simonw 9599 | 2021-06-22T17:24:03Z | 2021-06-22T17:24:03Z | OWNER | I'm re-opening this as a research task because it may be possible to cleanly implement this using a `dict` subclass - some notes on that here: https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/ Since this would just be for adding methods (and maybe a property for returning the primary keys for a row) the usual disadvantages of subclassing `dict` described in that article shouldn't apply. One catch: dictionaries already have a `.update()` method! So would have to pick another name. | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | row.update() or row.pk 915421499 | |
866184260 | https://github.com/simonw/sqlite-utils/issues/267#issuecomment-866184260 | https://api.github.com/repos/simonw/sqlite-utils/issues/267 | MDEyOklzc3VlQ29tbWVudDg2NjE4NDI2MA== | simonw 9599 | 2021-06-22T17:26:18Z | 2021-06-22T17:27:27Z | OWNER | If an`.update()` method doesn't work because it collides with an existing dictionary method a `.pk` property could still be nice: ```python for row in db["sometable"].rows: db["sometable"].update(row.pk, {"modified": 1}) ``` | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | row.update() or row.pk 915421499 | |
866219755 | https://github.com/simonw/sqlite-utils/issues/289#issuecomment-866219755 | https://api.github.com/repos/simonw/sqlite-utils/issues/289 | MDEyOklzc3VlQ29tbWVudDg2NjIxOTc1NQ== | simonw 9599 | 2021-06-22T18:13:26Z | 2021-06-22T18:13:26Z | OWNER | Thanks @adamchainz - `mypy` now has a foothold on this project (and runs in CI). | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | Mypy fixes for rows_from_file() 925677191 | |
866241836 | https://github.com/simonw/sqlite-utils/issues/289#issuecomment-866241836 | https://api.github.com/repos/simonw/sqlite-utils/issues/289 | MDEyOklzc3VlQ29tbWVudDg2NjI0MTgzNg== | adamchainz 857609 | 2021-06-22T18:44:36Z | 2021-06-22T18:44:36Z | NONE | Great! | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | Mypy fixes for rows_from_file() 925677191 |
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]);
author_association 2 ✖