datasette / datasette-enrichments-quickjs

Enrich data with a custom JavaScript function
Apache License 2.0
1 stars 0 forks source link

Automatically convert JSON to string #3

Open simonw opened 4 months ago

simonw commented 4 months ago

This enrichment fails with an error:

function enrich(row) {
  return row.Counties.split(",")
}

Error binding parameter 1: type 'list' is not supported

This works:

function enrich(row) {
  return JSON.stringify(row.Counties.split(","))
}

It would be good if the first one automatically encoded as JSON rather than dying with an error.

simonw commented 4 months ago

Output column can be of type text, integer or float.

Should check what comes back from the function.