Closed simonw closed 1 year ago
Perhaps where these pink arrows are:
Showing them in a line below the column details would probably fit better.
To do this efficiently, I think we select the first 1000 rows ordered by primary key, then within those select the first 5 values that are not null or blank.
with rows as (
select * from pypi_packages limit 1000
),
names as (
select name from rows where ("name" is not null and "name" != "") limit 5
),
classifiers as (
select distinct classifiers from rows where ("classifiers" is not null and "classifiers" != "") limit 5
)
select 'name', name from names union all select distinct 'classifiers', classifiers from classifiers
Better query:
with rows as (
select * from pypi_packages limit 1000
),
names as (
select name from rows where ("name" is not null and "name" != "") limit 5
),
classifiers as (
select distinct classifiers from rows where ("classifiers" is not null and "classifiers" != "") limit 5
),
strings as (
select 'name' as label, name as value from names union all select distinct 'classifiers', classifiers from classifiers
)
select label, json_group_array(value) as examples from strings group by label
I should truncate that as well.
with rows as (
select * from pypi_packages limit 1000
),
names as (
select name from rows where ("name" is not null and "name" != "") limit 5
),
classifiers as (
select distinct classifiers from rows where ("classifiers" is not null and "classifiers" != "") limit 5
),
strings as (
select 'name' as label, name as value from names
union all
select distinct 'classifiers', classifiers from classifiers
),
truncated_strings as (
select
label,
case
when length(value) > 30 then substr(value, 1, 30) || '...'
else value
end as value
from strings
)
select label, json_group_array(value) as examples from truncated_strings group by label;
Got this working, it looks like this:
To help people decide which column types to use, could show maybe the first five blank values from the table. Could be a tooltip.