docs
id | page | ref | title | content | breadcrumbs | references |
---|---|---|---|---|---|---|
metadata:specifying-units-for-a-column | metadata | specifying-units-for-a-column | Specifying units for a column | Datasette supports attaching units to a column, which will be used when displaying values from that column. SI prefixes will be used where appropriate. Column units are configured in the metadata like so: [[[cog metadata_example(cog, { "databases": { "database1": { "tables": { "example_table": { "units": { "column1": "metres", "column2": "Hz" } } } } } }) ]]] [[[end]]] Units are interpreted using Pint , and you can see the full list of available units in Pint's unit registry . You can also add custom units to the metadata, which will be registered with Pint: [[[cog metadata_example(cog, { "custom_units": [ "decibel = [] = dB" ] }) ]]] [[[end]]] | ["Metadata"] | [{"href": "https://pint.readthedocs.io/", "label": "Pint"}, {"href": "https://github.com/hgrecco/pint/blob/master/pint/default_en.txt", "label": "unit registry"}, {"href": "http://pint.readthedocs.io/en/latest/defining.html", "label": "custom units"}] |