in azure/functions/sql.py [0:0]
def encode(cls, obj: typing.Any, *,
expected_type: typing.Optional[type]) -> meta.Datum:
if isinstance(obj, sql.SqlRow):
data = sql.SqlRowList([obj])
elif isinstance(obj, sql.SqlRowList):
data = obj
elif isinstance(obj, collections.abc.Iterable):
data = sql.SqlRowList()
for row in obj:
if not isinstance(row, sql.SqlRow):
raise NotImplementedError(
f'Unsupported list type: {type(obj)}, \
lists must contain SqlRow objects')
else:
data.append(row)
else:
raise NotImplementedError(f'Unsupported type: {type(obj)}')
return meta.Datum(
type='json',
value=json.dumps([dict(d) for d in data])
)