home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 904036200

This data as json

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/1445#issuecomment-904036200 https://api.github.com/repos/simonw/datasette/issues/1445 904036200 IC_kwDOBm6k_c414n9o 9599 2021-08-23T19:08:54Z 2021-08-23T19:08:54Z OWNER

Figured out a query for searching across every column in every table! https://til.simonwillison.net/datasette/search-all-columns-trick#user-content-same-trick-for-the-entire-database

sql with tables as ( select name as table_name from sqlite_master where type = 'table' ), queries as ( select 'select ''' || tables.table_name || ''' as _table, rowid from "' || tables.table_name || '" where ' || group_concat( '"' || name || '" like ''%'' || :search || ''%''', ' or ' ) as query from pragma_table_info(tables.table_name), tables group by tables.table_name ) select group_concat(query, ' union all ') from queries The SQL query this generates for larger databases is extremely long - but it does seem to work for smaller databases.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
977323133  
Powered by Datasette · Queries took 1.537ms · About: github-to-sqlite