Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to return JSON creating multiple columns #5

Closed
simonw opened this issue Apr 5, 2024 · 4 comments
Closed

Option to return JSON creating multiple columns #5

simonw opened this issue Apr 5, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Contributor

simonw commented Apr 5, 2024

It would be great to have an option where the JavaScript function could return an object, and the enrichment would then create and populate a column for every key in that object.

Would help for breaking up JSON data into separate columns.

@simonw simonw added the enhancement New feature or request label Apr 5, 2024
@simonw
Copy link
Contributor Author

simonw commented Apr 5, 2024

For example I got this from datasette-paste importing a GeoJSON file:

CleanShot 2024-04-05 at 14 34 58@2x

@simonw
Copy link
Contributor Author

simonw commented Apr 5, 2024

Current UI:

CleanShot 2024-04-05 at 14 37 16@2x

I will copy the datasette-enrichments-re2 UI:

re

@simonw
Copy link
Contributor Author

simonw commented Apr 5, 2024

I'll call it "Output mode".

@simonw simonw closed this as completed in 7110451 Apr 5, 2024
simonw added a commit that referenced this issue Apr 5, 2024
@simonw
Copy link
Contributor Author

simonw commented Apr 5, 2024

It worked! I ran this:

CleanShot 2024-04-05 at 15 11 50@2x

function enrich(row) {
  return row.properties
}

Producing this:

CleanShot 2024-04-05 at 15 12 59@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant