home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

15 rows where issue = 570309546 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

  • simonw 15

issue 1

  • Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() · 15 ✖

author_association 1

  • OWNER 15
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
625890190 https://github.com/simonw/datasette/issues/685#issuecomment-625890190 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg5MDE5MA== simonw 9599 2020-05-08T16:09:44Z 2020-05-08T16:09:56Z OWNER

Re-opening this ticket because I forgot to document execute_fn() (the old execute_against_connection_in_thread() method).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625889673 https://github.com/simonw/datasette/issues/685#issuecomment-625889673 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg4OTY3Mw== simonw 9599 2020-05-08T16:08:40Z 2020-05-08T16:08:40Z OWNER

I'm going to ship a release with just this change purely so I can start depending on it from my in-development https://github.com/simonw/datasette-media plugin.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625889303 https://github.com/simonw/datasette/issues/685#issuecomment-625889303 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg4OTMwMw== simonw 9599 2020-05-08T16:07:55Z 2020-05-08T16:07:55Z OWNER

New documentation is live here: https://datasette.readthedocs.io/en/latest/internals.html#database-class

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625887196 https://github.com/simonw/datasette/issues/685#issuecomment-625887196 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg4NzE5Ng== simonw 9599 2020-05-08T16:03:16Z 2020-05-08T16:03:16Z OWNER

[ Fun aside: I implemented and shipped this entire branch in my browser using the beta of GitHub's new Codespaces ]

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625868416 https://github.com/simonw/datasette/issues/685#issuecomment-625868416 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg2ODQxNg== simonw 9599 2020-05-08T15:23:04Z 2020-05-08T15:23:04Z OWNER

I'll move the code into datasette/database.py.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625866419 https://github.com/simonw/datasette/issues/685#issuecomment-625866419 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg2NjQxOQ== simonw 9599 2020-05-08T15:18:55Z 2020-05-08T15:18:55Z OWNER

This code should live somewhere other than datasette/utils/__init__.py. Especially the exceptions, since calling code needs to be able to sensibly import them.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625865434 https://github.com/simonw/datasette/issues/685#issuecomment-625865434 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg2NTQzNA== simonw 9599 2020-05-08T15:16:43Z 2020-05-08T15:16:43Z OWNER

Documentation for improved design: https://github.com/simonw/datasette/pull/763/files#diff-87703da03a02e0f8dae01f39abd6250f

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625862578 https://github.com/simonw/datasette/issues/685#issuecomment-625862578 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg2MjU3OA== simonw 9599 2020-05-08T15:10:16Z 2020-05-08T15:10:16Z OWNER

I'm not going to do .last() because it could be confusing if truncation has come into play.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625850152 https://github.com/simonw/datasette/issues/685#issuecomment-625850152 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg1MDE1Mg== simonw 9599 2020-05-08T14:44:37Z 2020-05-08T14:44:37Z OWNER

I'll write the API documentation first, in a branch.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625849497 https://github.com/simonw/datasette/issues/685#issuecomment-625849497 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg0OTQ5Nw== simonw 9599 2020-05-08T14:43:13Z 2020-05-08T14:43:13Z OWNER

I'm going to add .first() and .last() methods too. These will return the first or last row, or None if the results are empty (rather than raising an IndexError).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625841397 https://github.com/simonw/datasette/issues/685#issuecomment-625841397 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTg0MTM5Nw== simonw 9599 2020-05-08T14:25:56Z 2020-05-08T14:27:15Z OWNER

Maybe all I really want here is to add length and access-by-index methods to the Results class? So I don't have to do results.rows[0][0] to get at a single returned value.

Also how about a results.single_value() method which returns a value only if there is a single row with a single column, otherwise raises an exception?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625839046 https://github.com/simonw/datasette/issues/685#issuecomment-625839046 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTgzOTA0Ng== simonw 9599 2020-05-08T14:20:43Z 2020-05-08T14:25:05Z OWNER

The API design for the .execute() function is actually fine, I think it's more the API of the returned Results object that I want to improve.

That object encapsulates the returned data, the named columns and whether or not the result was truncated.

return Results(rows, truncated, cursor.description)

The rows argument comes from either rows = cursor.fetchmany(max_returned_rows + 1) or rows = cursor.fetchall(). It's a Python list of sqlite3.Row objects.

Here's the current class implementation:

https://github.com/simonw/datasette/blob/0784f2ef9d3ff6dd9df05f54cb51de29a6d11764/datasette/utils/init.py#L54-L68

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625817999 https://github.com/simonw/datasette/issues/685#issuecomment-625817999 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTgxNzk5OQ== simonw 9599 2020-05-08T13:33:23Z 2020-05-08T13:33:23Z OWNER

I'm going to rename execute_against_connection_in_thread() to just execute_fn().

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
625603221 https://github.com/simonw/datasette/issues/685#issuecomment-625603221 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDYyNTYwMzIyMQ== simonw 9599 2020-05-08T03:00:23Z 2020-05-08T03:00:23Z OWNER

Working with this in https://github.com/simonw/datasette-media/issues/2 made me really want to redesign this API: https://github.com/simonw/datasette-media/commit/be23ec3d05900b69a3d47bc1e0dd056c333125f4

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  
590682210 https://github.com/simonw/datasette/issues/685#issuecomment-590682210 https://api.github.com/repos/simonw/datasette/issues/685 MDEyOklzc3VlQ29tbWVudDU5MDY4MjIxMA== simonw 9599 2020-02-25T04:50:53Z 2020-02-25T04:50:53Z OWNER

Current implementations:

https://github.com/simonw/datasette/blob/a093c5f79fa034a97d2ad8b606745dd3b80365af/datasette/database.py#L103-L168

At the very least the method name execute_against_connection_in_thread() should be updated to something that's more similar to the new (and documented) .execute_write_fn() method.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Document (and reconsider design of) Database.execute() and Database.execute_against_connection_in_thread() 570309546  

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