dedent SQL for neighborhood_search fixture

Makes this page a little prettier:
https://latest.datasette.io/fixtures/neighborhood_search
This commit is contained in:
Simon Willison 2020-04-02 17:54:27 -07:00
commit b07312c2b3

View file

@ -11,6 +11,7 @@ import random
import sys import sys
import string import string
import tempfile import tempfile
import textwrap
import time import time
from urllib.parse import unquote, quote from urllib.parse import unquote, quote
@ -311,14 +312,16 @@ METADATA = {
"𝐜𝐢𝐭𝐢𝐞𝐬": "select id, name from facet_cities order by id limit 1;", "𝐜𝐢𝐭𝐢𝐞𝐬": "select id, name from facet_cities order by id limit 1;",
"pragma_cache_size": "PRAGMA cache_size;", "pragma_cache_size": "PRAGMA cache_size;",
"neighborhood_search": { "neighborhood_search": {
"sql": """ "sql": textwrap.dedent(
"""
select neighborhood, facet_cities.name, state select neighborhood, facet_cities.name, state
from facetable from facetable
join facet_cities join facet_cities
on facetable.city_id = facet_cities.id on facetable.city_id = facet_cities.id
where neighborhood like '%' || :text || '%' where neighborhood like '%' || :text || '%'
order by neighborhood; order by neighborhood;
""", """
),
"title": "Search neighborhoods", "title": "Search neighborhoods",
"description_html": "<b>Demonstrating</b> simple like search", "description_html": "<b>Demonstrating</b> simple like search",
}, },