github
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/datasette/issues/942#issuecomment-898051645 | https://api.github.com/repos/simonw/datasette/issues/942 | 898051645 | IC_kwDOBm6k_c41hy49 | 9599 | 2021-08-13T00:02:25Z | 2021-08-13T00:02:25Z | OWNER | And on mobile: ![5FAF8D73-7199-4BB7-A5B8-9E46DCB4A985](https://user-images.githubusercontent.com/9599/129284817-dc13cbf4-144e-4f4c-8fb7-470602e2eea0.jpeg) | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-898050457 | https://api.github.com/repos/simonw/datasette/issues/942 | 898050457 | IC_kwDOBm6k_c41hymZ | 9599 | 2021-08-12T23:59:53Z | 2021-08-12T23:59:53Z | OWNER | Documentation: https://docs.datasette.io/en/latest/metadata.html#column-descriptions Live demo: https://latest.datasette.io/fixtures/roadside_attractions <img width="1045" alt="fixtures__roadside_attractions__4_rows" src="https://user-images.githubusercontent.com/9599/129284675-ef2fd6ed-54ba-4f6a-add5-7a9253921279.png"> | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-898037650 | https://api.github.com/repos/simonw/datasette/issues/942 | 898037650 | IC_kwDOBm6k_c41hveS | 9599 | 2021-08-12T23:23:54Z | 2021-08-12T23:23:54Z | OWNER | I like this enough that I'm going to ship it as an alpha and try it out on a couple of live projects. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-898037456 | https://api.github.com/repos/simonw/datasette/issues/942 | 898037456 | IC_kwDOBm6k_c41hvbQ | 9599 | 2021-08-12T23:23:34Z | 2021-08-12T23:23:34Z | OWNER | Prototype with a `<dl>`: <img width="721" alt="fixtures__sortable__201_rows" src="https://user-images.githubusercontent.com/9599/129282175-c94dcf74-beb3-4f0a-9106-f75d19369fb0.png"> ```diff diff --git a/datasette/static/app.css b/datasette/static/app.css index c6be1e9..bf068fd 100644 --- a/datasette/static/app.css +++ b/datasette/static/app.css @@ -836,6 +841,16 @@ svg.dropdown-menu-icon { background-repeat: no-repeat; } +dl.column-descriptions dt { + font-weight: bold; +} +dl.column-descriptions dd { + padding-left: 1.5em; + white-space: pre-wrap; + line-height: 1.1em; + color: #666; +} + .anim-scale-in { animation-name: scale-in; animation-duration: 0.15s; diff --git a/datasette/templates/table.html b/datasette/templates/table.html index 211352b..466e8a4 100644 --- a/datasette/templates/table.html +++ b/datasette/templates/table.html @@ -51,6 +51,14 @@ {% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %} +{% if metadata.columns %} +<dl class="column-descriptions"> + {% for column_name, column_description in metadata.columns.items() %} + <dt>{{ column_name }}</dt><dd>{{ column_description }}</dd> + {% endfor %} +</dl> +{% endif %} + {% if filtered_table_rows_count or human_description_en %} <h3>{% if filtered_table_rows_count or filtered_table_rows_count == 0 %}{{ "{:,}".format(filtered_table_rows_count) }} row{% if filtered_table_rows_count == 1 %}{% else %}s{% endif %}{% endif %} {% if human_description_en %}{{ human_description_en }}{% endif %} ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-898022235 | https://api.github.com/repos/simonw/datasette/issues/942 | 898022235 | IC_kwDOBm6k_c41hrtb | 9599 | 2021-08-12T22:52:23Z | 2021-08-12T22:52:23Z | OWNER | I like this. Need to solve for mobile though where the cog menu isn't visible - I think I'll do that with a definition list at the top of the page. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-898021895 | https://api.github.com/repos/simonw/datasette/issues/942 | 898021895 | IC_kwDOBm6k_c41hroH | 9599 | 2021-08-12T22:51:36Z | 2021-08-12T22:51:36Z | OWNER | Prototype: <img width="650" alt="fixtures__sortable__201_rows" src="https://user-images.githubusercontent.com/9599/129279808-08d56b2f-a4d6-4147-b3a6-542c62b566c1.png"> ```diff diff --git a/datasette/static/app.css b/datasette/static/app.css index c6be1e9..5ca64cb 100644 --- a/datasette/static/app.css +++ b/datasette/static/app.css @@ -784,9 +784,14 @@ svg.dropdown-menu-icon { font-size: 0.7em; color: #666; margin: 0; - padding: 0; padding: 4px 8px 4px 8px; } +.dropdown-menu .dropdown-column-description { + margin: 0; + color: #666; + padding: 4px 8px 4px 8px; + max-width: 20em; +} .dropdown-menu li { border-bottom: 1px solid #ccc; } diff --git a/datasette/static/table.js b/datasette/static/table.js index 991346d..a903112 100644 --- a/datasette/static/table.js +++ b/datasette/static/table.js @@ -9,6 +9,7 @@ var DROPDOWN_HTML = `<div class="dropdown-menu"> <li><a class="dropdown-not-blank" href="#">Show not-blank rows</a></li> </ul> <p class="dropdown-column-type"></p> +<p class="dropdown-column-description"></p> </div>`; var DROPDOWN_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -166,6 +167,14 @@ var DROPDOWN_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="14" heig } else { columnTypeP.style.display = "none"; } + + var columnDescriptionP = menu.querySelector(".dropdown-column-description"); + if (th.dataset.columnDescription) { + columnDescriptionP.innerText = th.dataset.columnDescription; + columnDescriptionP.style.display = 'block'; + } else { + columnDescriptionP.style.display = 'none'; + } menu.style.position = "absolute"; menu.style.top = menuTop + 6 + "px"; menu.style.left = menuLeft + "px"; diff --git a/datasette/templates/_table.html b/datasette/templates/_table.html index d765937..64… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-737402392 | https://api.github.com/repos/simonw/datasette/issues/942 | 737402392 | MDEyOklzc3VlQ29tbWVudDczNzQwMjM5Mg== | 9599 | 2020-12-02T18:08:55Z | 2020-12-02T18:08:55Z | OWNER | SQLite does let you add comments in your CREATE TABLE statements: ```sql CREATE TABLE something ( id integer primary key, -- integer primary key created text -- created date as ISO datetime ); ``` But the only mechanism for reading those back is to retrieve that `CREATE TABLE` block of SQL from the `sqlite_master` table and run a parser against it. I've so far resisted adding a SQL syntax parser to Datasette for complexity reasons - though I'm increasingly thinking I'll need to do it at some point. I think I'll leave this to plugins. I'm definitely going to build a plugin that lets you store metadata for tables and columns in a SQLite database table, which will then support interactively editing metadata through a UI. A plugin which extracts column comments from the SQLite CREATE TABLE comments would be feasible too, if I design the plugin hooks well. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-727626657 | https://api.github.com/repos/simonw/datasette/issues/942 | 727626657 | MDEyOklzc3VlQ29tbWVudDcyNzYyNjY1Nw== | 9599 | 2020-11-15T19:54:44Z | 2020-11-15T19:54:44Z | OWNER | This will also benefit from the metadata plugin hook: #860 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-675720040 | https://api.github.com/repos/simonw/datasette/issues/942 | 675720040 | MDEyOklzc3VlQ29tbWVudDY3NTcyMDA0MA== | 9599 | 2020-08-18T21:05:24Z | 2020-08-18T21:05:24Z | OWNER | Is `columns` the right key for this in the table metadata block? I might want to use that for initial values for `?_col=` in #615. Alternative names: - `column_descriptions` - `column_info` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 | |
https://github.com/simonw/datasette/issues/942#issuecomment-675715472 | https://api.github.com/repos/simonw/datasette/issues/942 | 675715472 | MDEyOklzc3VlQ29tbWVudDY3NTcxNTQ3Mg== | 9599 | 2020-08-18T20:55:02Z | 2020-08-18T20:55:02Z | OWNER | Could display these as tooltips on icons something like this (from the experimental `datasette-inspect-columns` plugin): <img width="500" alt="fixtures__facetable__15_rows_and_NOAA_tides_second_attempt_-_Jupyter_Notebook" src="https://user-images.githubusercontent.com/9599/90564416-37eff380-e15a-11ea-95e5-b556e9039a2a.png"> This would need to take accessibility into account, and would need a different display for the mobile web layout. Need to consider how it will interact with the column menu suggested in #690. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
681334912 |