home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 642651572 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 10

issue 1

  • Plugin hook for instance/database/table metadata · 10 ✖

author_association 1

  • OWNER 10
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
869071236 https://github.com/simonw/datasette/issues/860#issuecomment-869071236 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDg2OTA3MTIzNg== simonw 9599 2021-06-26T22:56:28Z 2021-06-26T22:56:28Z OWNER

This work is continuing in #1384.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
733288841 https://github.com/simonw/datasette/issues/860#issuecomment-733288841 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMzI4ODg0MQ== simonw 9599 2020-11-24T23:19:47Z 2020-11-24T23:20:24Z OWNER

Here's what I have today - it's an undocumented datasette.metadata() method that returns a full JSON dictionary of values OR a single value if the optional key= argument is provided: https://github.com/simonw/datasette/blob/f2e2bfcdd9ad4891f3f66c9104c09943d943ffe4/datasette/app.py#L357-L388

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
733288522 https://github.com/simonw/datasette/issues/860#issuecomment-733288522 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMzI4ODUyMg== simonw 9599 2020-11-24T23:18:47Z 2020-11-24T23:18:47Z OWNER

In #942 I want to add support for per-column metadata - which means this new lookup mechanism will need to be able to answer the question "what description is available for this column".

So what should the .metadata() method look like? A couple of options:

  • datasette.metadata("description", table=x, database=y) - can take optional column= too.
  • datasette.table_metadata("description", table=x, database=y) and datasette.database_metadata("description", database=y) and so on - multiple methods for the different types of metadata.
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
733287619 https://github.com/simonw/datasette/issues/860#issuecomment-733287619 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMzI4NzYxOQ== simonw 9599 2020-11-24T23:16:21Z 2020-11-24T23:16:21Z OWNER

I'll also allow any key to be looked up - so if users want to invent their own metadata keys other than the default license_url etc they can do so.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
733287416 https://github.com/simonw/datasette/issues/860#issuecomment-733287416 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMzI4NzQxNg== simonw 9599 2020-11-24T23:15:44Z 2020-11-24T23:15:44Z OWNER

I'm going to go with a plugin hook (and Datasette method) that returns individual values - so you ask it for e.g. the license_url for a specific table and it returns a string or None.

The default plugin hook implementation that ships with Datasette will then implement cascading lookups against metadata.json - but other plugins will be able to provide their own implementations, which should make it easy to build a plugin that lets you keep metadata in a database file and edit it interactively.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
733175454 https://github.com/simonw/datasette/issues/860#issuecomment-733175454 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMzE3NTQ1NA== simonw 9599 2020-11-24T19:06:07Z 2020-11-24T19:06:07Z OWNER

I see two ways this plugin hook could work. It could be asked about a specific instance, database or table and return the full metadata for that object. OR it could ask for a specific metadata field - e.g. source_url for table X, and return that.

The more finely grained one would allow plugins to implement their own cascading rules pretty easily. Is there a reason it would be better for the hook to return an entire block of JSON for a specific table or database?

I also need to decide if this hook is just going to be about source/license/about displayed metadata, or if it will include the functionality that has been sneaking into metadata.json over time - stuff like page size, default sort order or default facets.

Perhaps I should split those out into a "configuration" concept first, after renaming --config to --setting in #992.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
731658059 https://github.com/simonw/datasette/issues/860#issuecomment-731658059 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMTY1ODA1OQ== simonw 9599 2020-11-22T00:31:47Z 2020-11-22T00:33:48Z OWNER

Documented behaviour right now, for metadata set at the instance level, is: https://docs.datasette.io/en/stable/metadata.html

The above metadata will be displayed on the index page of your Datasette-powered site. The source and license information will also be included in the footer of every page served by Datasette.

...

Metadata at the top level of the JSON will be shown on the index page and in the footer on every page of the site. The license and source is expected to apply to all of your data.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
731657660 https://github.com/simonw/datasette/issues/860#issuecomment-731657660 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMTY1NzY2MA== simonw 9599 2020-11-22T00:27:32Z 2020-11-22T00:31:54Z OWNER

Open question: how should cascading work? If a table is missing a field but the database or instance has it, should that value cascade down to the table?

It feels like license should definitely cascade: if an instance lists a certain license that should absolutely filter through to all databases and tables.

But... should the other fields cascade? Cascading description doesn't feel right at all, and neither does title.

What about about and about_url and source and source_url? I'm a bit torn on whether they should cascade or not. I'm leaning towards cascading them.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
731657486 https://github.com/simonw/datasette/issues/860#issuecomment-731657486 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDczMTY1NzQ4Ng== simonw 9599 2020-11-22T00:25:34Z 2020-11-22T00:25:34Z OWNER

There are three layers of metadata: table, database and instance.

Currently the metadata fields are (ignoring not-quite-metadata like sort and sort_desc):

  • title
  • description (or description_html)
  • about / about_url
  • source / source_url
  • license / license_url
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  
647189535 https://github.com/simonw/datasette/issues/860#issuecomment-647189535 https://api.github.com/repos/simonw/datasette/issues/860 MDEyOklzc3VlQ29tbWVudDY0NzE4OTUzNQ== simonw 9599 2020-06-21T22:25:16Z 2020-06-21T22:25:27Z OWNER

This is also relevant to #639, and may mean I can close that ticket in place of this one. I'm going to get this at least to a proof-of-concept stage first though.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Plugin hook for instance/database/table metadata 642651572  

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