Label column finder is now case-insensitive

Closes #1544
This commit is contained in:
Simon Willison 2021-12-07 12:03:42 -08:00 committed by GitHub
commit 737115ea14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,7 +286,7 @@ class Database:
return explicit_label_column
column_names = await self.execute_fn(lambda conn: table_columns(conn, table))
# Is there a name or title column?
name_or_title = [c for c in column_names if c in ("name", "title")]
name_or_title = [c for c in column_names if c.lower() in ("name", "title")]
if name_or_title:
return name_or_title[0]
# If a table has two columns, one of which is ID, then label_column is the other one