mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
aeeb50f61b
commit
3683a6b626
3 changed files with 55 additions and 4 deletions
|
|
@ -143,7 +143,14 @@ METADATA = {
|
|||
},
|
||||
},
|
||||
'queries': {
|
||||
'pragma_cache_size': 'PRAGMA cache_size;'
|
||||
'pragma_cache_size': 'PRAGMA cache_size;',
|
||||
'neighborhood_search': '''
|
||||
select neighborhood, facet_cities.name, state
|
||||
from facetable
|
||||
join facet_cities on facetable.city_id = facet_cities.id
|
||||
where neighborhood like '%' || :text || '%'
|
||||
order by neighborhood;
|
||||
'''
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,6 +330,20 @@ def test_custom_sql(app_client):
|
|||
assert not data['truncated']
|
||||
|
||||
|
||||
def test_canned_query_with_named_parameter(app_client):
|
||||
response = app_client.get(
|
||||
"/fixtures/neighborhood_search.json?text=town"
|
||||
)
|
||||
assert [
|
||||
["Corktown", "Detroit", "MI"],
|
||||
["Downtown", "Los Angeles", "CA"],
|
||||
["Downtown", "Detroit", "MI"],
|
||||
["Greektown", "Detroit", "MI"],
|
||||
["Koreatown", "Los Angeles", "CA"],
|
||||
["Mexicantown", "Detroit", "MI"],
|
||||
] == response.json["rows"]
|
||||
|
||||
|
||||
def test_sql_time_limit(app_client_shorter_time_limit):
|
||||
response = app_client_shorter_time_limit.get(
|
||||
'/fixtures.json?sql=select+sleep(0.5)'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue