?_shape=array experimental feature

This commit is contained in:
Simon Willison 2018-05-01 10:40:33 -07:00
commit af4cb39d8f
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52

View file

@ -254,7 +254,7 @@ class BaseView(RenderMixin):
) )
# Deal with the _shape option # Deal with the _shape option
shape = request.args.get('_shape', 'lists') shape = request.args.get('_shape', 'lists')
if shape in ('objects', 'object'): if shape in ('objects', 'object', 'array'):
columns = data.get('columns') columns = data.get('columns')
rows = data.get('rows') rows = data.get('rows')
if rows and columns: if rows and columns:
@ -283,6 +283,8 @@ class BaseView(RenderMixin):
'database': name, 'database': name,
'database_hash': hash, 'database_hash': hash,
} }
if shape == 'array':
data = data['rows']
headers = {} headers = {}
if self.ds.cors: if self.ds.cors: