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

Support 'Accept: 'text/csv'' response? #157

Open
skoschik opened this issue Aug 15, 2024 · 2 comments
Open

Support 'Accept: 'text/csv'' response? #157

skoschik opened this issue Aug 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@skoschik
Copy link

Hi,

First off, thank you for the great work on this data provider for PostgREST! It's been a tremendous asset in my project. I would like to request a feature or get your thoughts on supporting the 'Accept: text/csv' header and its response in this provider. PostgREST offers the ability to export data in CSV format by including this header, which could be really useful for exporting lists directly from React Admin.

Background:
I've added the 'Accept: text/csv' header using the meta property that ra-data-postgrest provides via getList. This works great for exporting lists in CSV format directly from PostgREST, but...

Issue:
I'm encountering difficulties with the response handling. The current implementation expects JSON responses, which is incompatible when receiving CSV data from the API.

Feature Request:
Does CSV handling make sense to implement within this library, or do you have guidance on how to achieve it?

Thank you again for your efforts on this project! Looking forward to your insights.

@scheiblr
Copy link
Collaborator

Hey @skoschik,

thanks for opening this issue. Making the DP capable of handling the CSV export functionality of PostgREST sounds like a decent idea and I believe it could be realized, but is a question of effort which I currently do not know. What I can think of right now, should be doable:

If you want to give it a try, go for it ;)

Anyways, just for interest and understanding: may I ask you, how you are actually using the DP as you need would like rely on that feature, as the react-admin frontend list-component has already a csv export?

Kind regards

@skoschik
Copy link
Author

skoschik commented Sep 3, 2024

Hey thanks for the feedback @scheiblr!

Great info and I'll give it a closer look soon.

Also regarding my use case: I believe react-admin CSV exporter does the JSON to CSV serialization on the frontend. For larger datasets it was just too slow (sending and having frontend serialize)

@scheiblr scheiblr added the enhancement New feature or request label Sep 12, 2024
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

2 participants